Skip to content

Add poetry to manage dependencies and metadata

Ishaan Arora requested to merge pulsar17/extensions:poetry-init into master

What does the merge request do?

This MR adds poetry to manage dependencies.

It introduces the new pyproject.toml config file which replaces setuptools based files except MANIFEST.in. This change shouldn't be drastic as setuptools wasn't being used to package anything.

A flattened python dependency list including transitive dependencies is also output in CI (using poetry) for packagers.

Sister MR - inkscape/extras/extension-manager!3 (merged)

Rationale for choosing poetry

I looked at the following tools - pip-tools, pipenv, and poetry.

I rejected pip-tools because it has the same workflow as requirements.txt. Managing multiple requirements file is not a good experience.

I rejected pipenv because the file it uses, namely Pipfile to specify the dependencies, hasn't been standardized in spite of it being the tool recommended by PyPA.

I accepted poetry because it uses the standardized pyproject.toml. It also has the best developer experience of all the options.

Arguments against choosing poetry

Although poetry uses pyproject.toml, it does not use the format defined by PEP 631 to specify dependencies. (The above remark is just to mention that poetry deviates from the standard. However, even if we package using it for PyPI, we will be fine as it produces identical enough sdist/wheel as setuptools that PyPI needs)

It is a different build-backend than setuptools. If in future, we decide to package inkex separately for distros (Ubuntu, Fedora, etc - to be installed with something like apt install python3-inkex), we might find some paper cuts here and there.

...

closes #453 (closed)

Implementation notes

Since pyproject.toml has been added, inkscape's CMake scripts might need to be modified to exclude this file.

The installation of poetry should be inside extensions' Docker image rather than duplicating it for every job in CI.

Summary for release notes

No change in the inkex/ but the module inkex.py has been removed since it was interfering with poetry install. ...

Checklist

  • Add unit tests (if applicable) [not applicable]
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Ishaan Arora

Merge request reports