Skip to content

[RPM Packaging] The format used in 'pyproject.toml' for 'packages' key does not seem to fit standards for RPM build #165

Closed

Description

@ArmandBENETEAU

Hello tappy team!

I am working in an organization that is using the TAP format, and in this goal we are building this tappy project as a '.rpm' package.
However since, the last release (v3.2) and especially since the modification of your build method, we are not able to package directly this project.

The good new is that I've found the cause of this issue.

Indeed, in your pyproject.toml file, there is this section:

[tool.hatch.build.targets.wheel]
sources = ["src"]
packages = ["tap"]

And after some tests, it seems that the standard RPM tools[1] used to build a rpm package from a python repository does not always recognize this syntax. Simply changing this section to the following fixes the problem in my case.

[tool.hatch.build.targets.wheel]
sources = ["src"]
packages = ["src/tap"]

I guess it depends on the version of hatchling used, but since it is not explicitly set in your project...
For information the hatchling version I'm using is 1.27.0.

Best regards and have a beautiful day!
Armand.

PS: this issue is also valid for pytest-tap repo!

Activity

  1. mblayman commented on Oct 28, 2025

    @mblayman
    Member

    Thanks for the report. Do you have confidence in the fix? There is an open PR for pytest-tap with a similar fix, but it doesn't work and leaves the built package with no files in it (python-tap/pytest-tap#105). I'm open to a fix, but it has to be something that work.

    BTW, I'm a solo maintainer with drive-by contributors and I'm not actively working on the project lately. The odds of getting this fixed go up greatly with a PR. 😁 The test suite runs against tox, so it should be pretty clear if the fix works from a CI run. I won't have time to work on this this week.

  2. ArmandBENETEAU commented on Oct 29, 2025

    @ArmandBENETEAU
    ContributorAuthor

    Hi ! I have no problem to open a PR, I will try to do so in the next day. I usually open an issue before because sometime the maintainers of repositories would rather have an issue first and then a PR if they agree.

    I will also have a look on the PR you mentioned. Thanks!

  3. ArmandBENETEAU commented on Oct 29, 2025

    @ArmandBENETEAU
    ContributorAuthor

    So I have a bit of time today and I've started investigating. Let me write here my first observations.

    I've forked the project, created the virtual environment locally on my laptop, installed tox and uv and let's go!

    For each case I will also give the version of hatchling used.
    For the "modified file case", the modification I am doing is the following:

    diff --git a/pyproject.toml b/pyproject.toml
    index b0d617c..34118d9 100644
    --- a/pyproject.toml
    +++ b/pyproject.toml
    @@ -58,7 +58,7 @@ sources = ["src"]
     
     [tool.hatch.build.targets.wheel]
     sources = ["src"]
    -packages = ["tap"]
    +packages = ["src/tap"]
     
     [tool.pytest.ini_options]
     pythonpath = [".", "src"]

    I will use two build commands: uv build (it is the one used here) and python3 -m pip wheel . (the one used in the rpm packaging environment and probably for Debian packaging as well).

    Case 1: original pyproject.toml file + build command line: uv build

    Results: I correctly have all the python files in the wheel.

    > uv build
    Building source distribution...
    Building wheel from source distribution...
    Successfully built dist/tap_py-3.2.1.tar.gz
    Successfully built dist/tap_py-3.2.1-py3-none-any.whl
    
    > unzip -l dist/tap_py-3.2.1-py3-none-any.whl 
    Archive:  dist/tap_py-3.2.1-py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
           85  2020-02-02 00:00   tap/__init__.py
           48  2020-02-02 00:00   tap/__main__.py
         1509  2020-02-02 00:00   tap/adapter.py
         1791  2020-02-02 00:00   tap/directive.py
          762  2020-02-02 00:00   tap/formatter.py
         4824  2020-02-02 00:00   tap/line.py
         2943  2020-02-02 00:00   tap/loader.py
         2124  2020-02-02 00:00   tap/main.py
         6803  2020-02-02 00:00   tap/parser.py
         3378  2020-02-02 00:00   tap/rules.py
         5066  2020-02-02 00:00   tap/runner.py
         7576  2020-02-02 00:00   tap/tracker.py
           71  2020-02-02 00:00   tap/tests/__init__.py
         1079  2020-02-02 00:00   tap/tests/factory.py
          187  2020-02-02 00:00   tap/tests/test_example.py
          208  2020-02-02 00:00   tap/tests/testcase.py
         7787  2020-02-02 00:00   tap_py-3.2.1.dist-info/METADATA
           87  2020-02-02 00:00   tap_py-3.2.1.dist-info/WHEEL
           60  2020-02-02 00:00   tap_py-3.2.1.dist-info/entry_points.txt
          391  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/AUTHORS
         1342  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/LICENSE
         1641  2020-02-02 00:00   tap_py-3.2.1.dist-info/RECORD
    ---------                     -------
        49762                     22 files
    

    Version of hatchling used: 1.27.0

    > unzip -p dist/tap_py-3.2.1-py3-none-any.whl tap_py-3.2.1.dist-info/WHEEL | grep Generator
    Generator: hatchling 1.27.0
    

    Case 2: modified pyproject.toml file + build command line: uv build

    Results: I do not have any python file, just "dist-info" directory.

    > uv build
    Building source distribution...
    Building wheel from source distribution...
    Successfully built dist/tap_py-3.2.1.tar.gz
    Successfully built dist/tap_py-3.2.1-py3-none-any.whl
    
    > unzip -l dist/tap_py-3.2.1-py3-none-any.whl
    Archive:  dist/tap_py-3.2.1-py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
         7787  2020-02-02 00:00   tap_py-3.2.1.dist-info/METADATA
           87  2020-02-02 00:00   tap_py-3.2.1.dist-info/WHEEL
           60  2020-02-02 00:00   tap_py-3.2.1.dist-info/entry_points.txt
          391  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/AUTHORS
         1342  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/LICENSE
          488  2020-02-02 00:00   tap_py-3.2.1.dist-info/RECORD
    ---------                     -------
        10155                     6 files
    

    Version of hatchling used: 1.27.0

    > unzip -p dist/tap_py-3.2.1-py3-none-any.whl tap_py-3.2.1.dist-info/WHEEL | grep Generator
    Generator: hatchling 1.27.0
    

    Case 3: original pyproject.toml file + build command line: python3 -m pip wheel .

    Results: I do not have any python file, just "dist-info" directory.

    > python3 -m pip wheel .
    Processing /mnt/0a5a58ce-e253-4950-aded-f30bbc0b55df/development/github.com/tappy
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: tap.py
      Building wheel for tap.py (pyproject.toml) ... done
      Created wheel for tap.py: filename=tap_py-3.2.1-py3-none-any.whl size=4837 sha256=3adef21d2b734d8ab841e9e25a53e905d9b47ea167711ba36f3db170b8316761
      Stored in directory: /tmp/pip-ephem-wheel-cache-diri57kf/wheels/3e/39/ec/87fa11dca6b176259de020191d468ea40c6fa614fd3d2a8c9f
    Successfully built tap.py
    
    > unzip -l tap_py-3.2.1-py3-none-any.whl
    Archive:  tap_py-3.2.1-py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
         7787  2020-02-02 00:00   tap_py-3.2.1.dist-info/METADATA
           87  2020-02-02 00:00   tap_py-3.2.1.dist-info/WHEEL
           60  2020-02-02 00:00   tap_py-3.2.1.dist-info/entry_points.txt
          391  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/AUTHORS
         1342  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/LICENSE
          488  2020-02-02 00:00   tap_py-3.2.1.dist-info/RECORD
    ---------                     -------
        10155                     6 files
    

    Version of hatchling used: 1.27.0

    > unzip -p tap_py-3.2.1-py3-none-any.whl tap_py-3.2.1.dist-info/WHEEL | grep Generator
    Generator: hatchling 1.27.0
    

    Case 4: modified pyproject.toml file + build command line: python3 -m pip wheel .

    Results: I correctly have all the python files in the wheel.

    > python3 -m pip wheel .
    Processing /mnt/0a5a58ce-e253-4950-aded-f30bbc0b55df/development/github.com/tappy
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
      Preparing metadata (pyproject.toml) ... done
    Building wheels for collected packages: tap.py
      Building wheel for tap.py (pyproject.toml) ... done
      Created wheel for tap.py: filename=tap_py-3.2.1-py3-none-any.whl size=19291 sha256=d83eb9c5c76c0fe49bd296102927c2fcbb8455485b85064d1c410f33ecd982ee
      Stored in directory: /tmp/pip-ephem-wheel-cache-p7l9d4mg/wheels/3e/39/ec/87fa11dca6b176259de020191d468ea40c6fa614fd3d2a8c9f
    Successfully built tap.py
    
    > unzip -l tap_py-3.2.1-py3-none-any.whl
    Archive:  tap_py-3.2.1-py3-none-any.whl
      Length      Date    Time    Name
    ---------  ---------- -----   ----
           85  2020-02-02 00:00   tap/__init__.py
           48  2020-02-02 00:00   tap/__main__.py
         1509  2020-02-02 00:00   tap/adapter.py
         1791  2020-02-02 00:00   tap/directive.py
          762  2020-02-02 00:00   tap/formatter.py
         4824  2020-02-02 00:00   tap/line.py
         2943  2020-02-02 00:00   tap/loader.py
         2124  2020-02-02 00:00   tap/main.py
         6803  2020-02-02 00:00   tap/parser.py
         3378  2020-02-02 00:00   tap/rules.py
         5066  2020-02-02 00:00   tap/runner.py
         7576  2020-02-02 00:00   tap/tracker.py
           71  2020-02-02 00:00   tap/tests/__init__.py
         1079  2020-02-02 00:00   tap/tests/factory.py
          187  2020-02-02 00:00   tap/tests/test_example.py
          208  2020-02-02 00:00   tap/tests/testcase.py
         7787  2020-02-02 00:00   tap_py-3.2.1.dist-info/METADATA
           87  2020-02-02 00:00   tap_py-3.2.1.dist-info/WHEEL
           60  2020-02-02 00:00   tap_py-3.2.1.dist-info/entry_points.txt
          391  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/AUTHORS
         1342  2020-02-02 00:00   tap_py-3.2.1.dist-info/licenses/LICENSE
         1641  2020-02-02 00:00   tap_py-3.2.1.dist-info/RECORD
    ---------                     -------
        49762                     22 files
    

    Version of hatchling used: 1.27.0

    > unzip -p tap_py-3.2.1-py3-none-any.whl tap_py-3.2.1.dist-info/WHEEL | grep Generator
    Generator: hatchling 1.27.0
    

    Conclusion

    So... there is something weird between how uv is building and how python3 -m pip wheel is building. What could be great to find is how we could conciliate both.

    The positive point from this experiment is that it shows that the problem does not come from the hatchling version.

  4. ArmandBENETEAU commented on Oct 29, 2025

    @ArmandBENETEAU
    ContributorAuthor

    Solution found! See your PR #166 😉

  5. mblayman commented on Oct 30, 2025

    @mblayman
    Member

    Fixed with #166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions