Skip to content

Make project installable into a virtualenv

Ian Wienand requested to merge iwienand/revumatic:pyproject into next

Currently this project can not be installed into a virtualenv as you would expect. It's kind of a little bit worse than than doing nothing; because there's an incomplete pyproject.toml file "venv/bin/pip install ." looks like it might work, but then fails with errors.

This converts the project to be a regular python project.

The pyproject.toml file is written out with the required options to be a setuptools project.

The current source layout is problematic; it would install a top-level module called "modules" which is too generic hence and a namespacing issue. This appears to be worked around with in the existing .spec file by installing into subdirectories manually; this is a problem when we want setuptools to install it. The "modules" directory is moved to "revumatic"; this requires "from modules" to be converted to "from revumatic" in the source code.

The main script is moved to an entry-point, so venv/bin/revumatic "just works". Requirements are moved into the pyproject.toml file.

setuptools-scm does the work of the current manual versioning things; it understands the latest git tag and adds correct developemnt extensions from it.

I have re-written the spec file to create a package from the sdist generated source; currently the existing .spec copies raw .py files from the gitlab archive of the tag, which means it doesn't have required dist-info metadata, etc. This updated version means we can use the standard rpm packaging tools which sort out dependencies automatically, etc. This is the only "breaking" part of the change; as I imagine the COPR repo will need to be updated to build correctly.

I think this is worth doing to make this a more standard project. For reference, I hit this trying to create some Ansible to install this project in the rhel-developer-toolbox environment. By making this a "regular" project, it means things like the broader Python eco-system, such as Ansible, can deal with it trivially; reducing barriers to having people actually use the tool, which is the point of it all 😄

Edited by Ian Wienand

Merge request reports