poetry new project
ℹ️ This will create a project folder in the current path.
poetry init
poetry install
Or
poetry install --no-root
poetry add package
poetry add git+repo_url
poetry run command
poetry env list --full-path
We do not need a virtual env docker. It is already isolated. So, we use
poetry config virtualenvs.create false
setting to turn it off.
cat requirements.txt|xargs poetry add
For starting a new project we use:
poetry new --src <path>
It generates this structure:
.
├── pyproject.toml
├── README.rst
├── src
│ └── project_name
│ └── __init__.py
└── tests
├── __init__.py
└── test_project_name.py
In that project_name.py we find the version.
poetry version
poetry version 21.12.22
A typical release workflow with poetry looks something like this:
Use poetry to bump your package version: poetry version patch
Bumping version from 0.1.0 to 0.1.1
Create a tag to define your release in git
git tag 0.1.1 git push --tags
Hope you used the same version number for both steps
To avoid human errors, we can link our poetry version to our git tags.
Update pyproject.toml to have a generic version placeholder
[tool.poetry]
version = "0.0.0"
Update your release script to fetch the git version before building the package artifacts
poetry version $(git describe --tags --abbrev=0) poetry build
>>> import pkg_resources
>>> my_version = pkg_resources.get_distribution('my-package-name').version
[tool.poetry.scripts] dbcli = 'getfinancing.persistence.cli.dbcli:main'
poetry show --tree
poetry add pymysql@latest
cat requirements.txt|xargs poetry add
This creates the repo gf accessed with credentials.
poetry config repositories.gf https://pip.getfinancing.us/simple/ poetry config http-basic.gf $PYPI_USER $PYPI_PSW
poetry env use python3.9