Search code examples
pythongitversion-controlpython-poetrypyproject.toml

Should the toml file be added to version control for a python poetry managed project?


Should the pyproject.toml file be added to version control for a python poetry managed project? The poetry documentation mentions adding the lock file, however I was unable to find guidance on the pyproject.toml file.

https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control


Solution

  • Yes, you should.

    The pyproject.toml is the heart of your Poetry based project. It contains the metadata like name and version and the definitions of the direct dependencies.

    Without this file it is impossible to install the project and its dependencies. Furthermore you cannot build and publish the package.

    The lock file only does not include enough information to install the project (https://github.com/python-poetry/poetry/issues/1301).