|
| 1 | + |
| 2 | +## Contribution |
| 3 | + |
| 4 | + |
| 5 | +### Github preparation |
| 6 | + |
| 7 | ++ [Git - First-Time Git Setup](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) |
| 8 | + ```shell |
| 9 | + git config --global user.name "John Doe" |
| 10 | + git config --global user.email [email protected] |
| 11 | + ``` |
| 12 | + |
| 13 | ++ [About remote repositories - GitHub Docs](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls) |
| 14 | +```shell |
| 15 | +ssh-keygen -p -f ~/.ssh/id_ed25519 |
| 16 | +``` |
| 17 | + |
| 18 | ++ [SSH and GPG keys on Github](https://github.com/settings/keys) |
| 19 | +```shell |
| 20 | +cat ~/.ssh/id_ed25519.pub |
| 21 | +``` |
| 22 | + |
| 23 | +if, after git push will ask for credentials put the API key as passwort |
| 24 | ++ [Personal Access Tokens (Classic)](https://github.com/settings/tokens) |
| 25 | + |
| 26 | + |
| 27 | +### Repository update |
| 28 | + |
| 29 | +To update a release of a Python package, you'll typically go through the following general steps: |
| 30 | + |
| 31 | +1. Update the code or documentation to incorporate the new changes or improvements. |
| 32 | + |
| 33 | +2. Update the package version number to indicate a new release: |
| 34 | + - Follow semantic versioning (or "semver") principles, using version numbers like MAJOR.MINOR.PATCH: |
| 35 | + - Increment the MAJOR version when you make incompatible API changes, |
| 36 | + - Increment the MINOR version when you add functionality in a backward-compatible manner, and |
| 37 | + - Increment the PATCH version when you make backward-compatible bug fixes. |
| 38 | + - Change the version number in your package's `__init__.py` file, `setup.cfg`, `pyproject.toml` file, wherever it's defined. |
| 39 | + |
| 40 | +3. Update the `CHANGELOG` or `HISTORY` file (if you have one) to document the changes introduced in the new version. |
| 41 | + |
| 42 | +4. Commit the changes and push them to your version control system (e.g., git). |
| 43 | + ```shell |
| 44 | + git status |
| 45 | + git add . |
| 46 | + git commit -m "updated version" |
| 47 | + git push |
| 48 | + ``` |
| 49 | + |
| 50 | +5. Tag the commit with the version number: |
| 51 | + ```shell |
| 52 | + git tag -a v0.1.7 -m "Release version 0.1.7" |
| 53 | + git push --tags |
| 54 | + ``` |
| 55 | + |
| 56 | +## Build |
| 57 | ++ [build 1.0.3](https://pypa-build.readthedocs.io/en/latest/) |
| 58 | + |
| 59 | +Build the new distribution files for the package using your chosen build tool, typically the build package: |
| 60 | +Run the build module from the root of the project where the `pyproject.toml` file is located: |
| 61 | +This command will generate distribution files in the newly created `dist/` directory within your project. You will find both a source archive (`.tar.gz`) and a wheel file (`.whl`). |
| 62 | + ```shell |
| 63 | + pip install build |
| 64 | + python -m build --version 0.1.5 |
| 65 | + python -m build |
| 66 | + ``` |
| 67 | + |
| 68 | + |
| 69 | ++ [Versioning - Hatch](https://hatch.pypa.io/latest/version/) |
| 70 | + ```bash |
| 71 | + hatch version release |
| 72 | + ``` |
| 73 | + |
| 74 | +### Publish |
| 75 | +After the build completes successfully, upload the new distribution files to the Python Package Index (PyPI). |
| 76 | +Upload your package to PyPI using `twine` |
| 77 | + ```shell |
| 78 | + twine upload dist/* |
| 79 | + ``` |
| 80 | + |
| 81 | +### Github Release |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +If your project is hosted on GitHub or a similar platform, you may also want to create a GitHub release: |
| 86 | +- Go to the "Releases" section of your repository. |
| 87 | +- Draft a new release, using the new tag you've created. |
| 88 | +- Add release notes summarizing the changes. |
| 89 | +- Optionally, attach binaries or additional files that accompany the release. |
| 90 | +- Publish the release. |
| 91 | +
|
| 92 | +
|
| 93 | +### Test |
| 94 | +```bash |
| 95 | +pytest |
| 96 | +``` |
0 commit comments