Execute the following to create the pyproject.toml file.
poetry init
poetry new foo
Which will initialize the project with the following directory structure:
foo
├── README.md
├── foo
│ └── __init__.py
├── pyproject.toml
└── tests
└── __init__.py
2 directories, 4 files
A useful flag is --src which will nest the package inside the src folder resulting in the following directory structure:
foo
├── README.md
├── pyproject.toml
├── src
│ └── foo
│ └── __init__.py
└── tests
└── __init__.py
3 directories, 4 files
poetry install
The command will read dependencies from pyproject.toml and install them. If there is no virtualenv activated, it will also create one. If there's no poetry.lock file it will create one.
poetry add flask
adding the --dev parameter is used to mark a dependency as a development dependency.
poetry show
show the dependency tree
poetry show --tree
poetry update foo
poetry remove foo