Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build python project based on pyproject.toml

I would like to understand current state of Python build systems and requirements management.

Imagine, that I checked out sources of some project that is using poetry (or pipenv). And this project has pyproject.toml file with build system specified. Of course I can look into pyproject, see that this one is using Poetry, install poetry and run poetry install, but I would like to avoid it.

Question: Is there a build-system-agnostic way to build Python project?

By "build" I mean install all the necessary requirements for the project to be run in-place.

With requirements.txt I would achieve that by running pip install -r requirements.txt.

like image 551
Andrey Tatarinov Avatar asked Nov 05 '19 10:11

Andrey Tatarinov


1 Answers

To install the project (and its dependencies), recent versions of pip are perfectly capable of doing this:

path/to/python -m pip install path/to/project

or

path/to/python -m pip install --editable path/to/project

To build distributions of the project, currently build is the only build back-end agnostic tool I know of:

python -m build
like image 77
sinoroc Avatar answered Oct 27 '22 17:10

sinoroc