Python packaging
… to be updated.
Cool
Poetry tutorial
Create
poetry new package-name
:
package-name/
├── package-name/
│ └── __init__.py
├── tests/
│ ├── __init__.py
│ └── test_package-name.py
├── pyproject.toml
└── README.md
- Edit
pyproject.toml
as needed - Run
pipreqs ../
inpackage-name/package-name
- Make poetry lock file and auto-specify dependecies via
poetry add $( cat requirements.txt )
- Build the dist:
poetry build
- (First time) configure PyPI credentials
poetry config pypi-token.pypi my-token
wheremy-token
is your api token. - Publish to PyPI:
poetry publish
- (Optional) add
dist/
to a.gitignore
.
Update
- (Optional) dependency resolvation:
- Run
pipreqs ../
inpackage-name/package-name
- Make poetry lock file and auto-specify dependecies via
poetry add $( cat requirements.txt )
- Run
- Edit version number in
pyproject.toml
- Build the dist:
poetry build
- Publish to PyPI:
poetry publish