podman-py icon indicating copy to clipboard operation
podman-py copied to clipboard

[wip] Migrate the project to pyproject.toml

Open inknos opened this issue 1 year ago • 1 comments

This is a WIP pr. before getting merged I expect a lot of changes and reviews. The automation, release process and gating will need to be tested as well before going.

Changes introduced by this PR:

  • package definition and dependencies are incorporated in pyproject.toml. package management is now done by hatch as suggested by the python docs.
    • building rpms will be handled via hatch
    • where not possible to use hatch (such as Centos Stream 8) it will use flit
    • things like testing requirements are now handled a bit differently. the testing packages are now specified in a dev environment which is now entirely managed by hatch. a big advantage of that is how the requirements are defined. now, it is sufficient to do hatch shell to get to the dev environment and have all the necessary tools in the virtual shell (the ones defined in test-requirements.txt). the environment where tests run is also better defined this way. with this PR, only the packages needed for testing are pulled. packages such as linting tools and pre-commit are not included in the testing env.
    • setup.py, setup.cfg, *requirements.txt are no longer needed.
  • pre-commit is now used to run black, isort, pylint. all these checks are incorporated in one tool: ruff. the single pre-commit hook will check linting and formatting in the same environment, limiting the opinionated issues that happen from here and there and alolowing to drop more dependencies that cause issues from time to time.
    • Consequently, cirrus does not require lint checks anymore since they are delegated to a separate check in pre-commit which is run in a gh workflow
  • no more tox. this hurts but the way tox was used is to run lint, black, and coverage steps. as noted above, lint and black are now handled specifically. now, tox is used to handle virtual environments only and to run coverage tests. this is perfectly implemented in hatch, so since we are switching the build backend why don't use it's builtin testing capabilities too? this also have some performances improvement, but I'd need to do some more research on that.
    • Packages that can be dropped
      • setuptools
      • sphinx (not really dropped but more like split in the [docs] package
      • wheel
      • black
      • pylint
      • tox
    • Packages that are added
      • hatch (build backend, replaces setuptools/wheel)
      • pre-commit (already used in many projects and pulled separately online)
      • ruff (pulled by pre-commit, replaces black, isort, pylint)
  • drop python 3.6 and 3.8 from UPSTREAM. reasons:

Important missing parts that I am still figuring out how to wire up:

  • Package RPM upstream
    • requests-mock is limited by a version that is not released in fedora. This forbids from using a dependency check in the specfile. At the present time, this issue has a workaround which removes the minimum requirements. It worked locally but let's see how it behaves on GH
  • Package RPM for CentOS 8

inknos avatar Aug 19 '24 12:08 inknos

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inknos

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar Nov 27 '24 12:11 openshift-ci[bot]

Closing in favor of this issue which will track all the steps one by one. https://github.com/containers/podman-py/issues/474

Too many steps in a single PR

inknos avatar Nov 28 '24 14:11 inknos