Contents
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 ougit 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
|
|
Local work on the fork
git clone git@github.com:Kessel-Media/sqladmin.git sqladmin
pipenv install -e sqladmin --skip-lock
: pipenv editable dependency
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
- Create your own python package and publish it to pypi
- tuto officiel
- Generate the source distribution :
python setup.py sdist
- Push to pypi :
twine upload --repository testpypi dist/* --verbose
- twine will read credentials from
~/.pypirc
: see doc - package name can be different than import names (like I did with sqladmin). Can happen in the following cases :