Submodules

Problèmes rencontrés

  • Ne jamais mettre le dossier du submodule dans le gitignore

Installation

  • git submodule add https://github.com/chaconinc/DbConnector

Modification du repo upstream

  • Update l’url dans .gitmodules
  • git submodule sync

Suppresion

Mise a jour

  • git submodule update to sync the submodule from upstream
  • Mettre a jour :
    • cd <sub_module>
    • git pull

Mise à jour du back

  • git pull
  • git submodule update –init –recursive

Développement sur le submodule

  • chaque submodule doit etre push avant de push sur le repo principal
  • Utiliser : git config push.recurseSubmodules check (block) pour enforce ca ou git config push.recurseSubmodules on-demand
  • ou git submodule foreach git push
  • rajouter un pre commti check

Subtree

  • alternative to git submodule
  • transparent for deploy and other devs
  • slightly harder to contribute upstream

Forking

  • can contribute back just by doing a regular pull request to the upstream repo
  • forked repo should be configured to pull changes from the original upstream repo by adding a remote (see this) : git remote add upstream <upstream_repo>
  • sync :
    • git fetch upstream
    • git merge upstream/main
  • on dev sur main sur le fork
  • on sync l’upstream dans main

Setup

  • Create your ~/.pypirc with creds
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[distutils]
index-servers =
    pypi
    testpypi

[pypi]
repository = https://upload.pypi.org/legacy/
username = thibaultlebrun
password = <pass>

[testpypi]
repository = https://test.pypi.org/legacy/
username = thibaultlebrun
password = <pass>

Local work on the fork

The –skip-lock is there to don’t mess with the Pipfile.lock and make things faster as locking is slow

Syncing upstream changes to our fork

  • cd sqladmin
  • git remote add upstream git@github.com:aminalaee/sqladmin.git (if not done)
  • Pulling upstream changes git pull upstream main
  • pushing to our repo : git push origin main

Deploying a new version of the sqladmin package

  • update the version number manually (setup.cfg and init.py)
  • the project uses hatch project manager: install with pip install hatch
  • publish package with : make sqladmin_publish
  • pipenv update kessel.sqladmin (this needs to be improved, does not work well with pipenv -e, right now we need rm -rf sqladmin and uninstall then reinstall)

Pypi

Working with a fork