Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setuptools warning #411

Closed
asarubbo opened this issue Apr 2, 2024 · 5 comments · Fixed by #414
Closed

setuptools warning #411

asarubbo opened this issue Apr 2, 2024 · 5 comments · Fixed by #414
Assignees

Comments

@asarubbo
Copy link

asarubbo commented Apr 2, 2024

By packaging 3.5.0 on Gentoo Linux I see the following setuptools warning:

 * QA Notice: setuptools warnings detected:
 * 
 *      Package 'pgactivity.profiles' is absent from the `packages` configuration.
 *      Package 'pgactivity.queries' is absent from the `packages` configuration.
@dlax
Copy link
Member

dlax commented Apr 3, 2024

What command do you run to get these warnings?

@dlax dlax self-assigned this Apr 3, 2024
@dlax
Copy link
Member

dlax commented Apr 3, 2024

Based on https://setuptools.pypa.io/en/latest/userguide/datafiles.html it's not clear to me what would be missing in our setup.

@asarubbo
Copy link
Author

asarubbo commented Apr 3, 2024

What command do you run to get these warnings?

the warning comes from portage that search for 'setuptools warning' string:
https://github.com/gentoo/portage/blob/08a2bc3800ea2e997716903244ec041339b45b06/lib/portage/package/ebuild/doebuild.py#L2395

The exact command used to build is:

python3.12 -m gpep517 build-wheel --prefix=/usr --backend setuptools.build_meta --output-fd 3 --wheel-dir /var/tmp/portage/dev-db/pg_activity-3.5.0/work/pg_activity-3.5.0-python3_12/wheel

For completeness I'm attaching the full build log:
pg_activity-3.5.0_20240403-070656.log.txt

An interesting part is:

/usr/lib/python3.12/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'pgactivity.profiles' is absent from the `packages` configuration.
!!

        ********************************************************************************
        ############################
        # Package would be ignored #
        ############################
        Python recognizes 'pgactivity.profiles' as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that 'pgactivity.profiles' is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want 'pgactivity.profiles' to be distributed and are
        already explicitly excluding 'pgactivity.profiles' via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        ********************************************************************************

@dlax
Copy link
Member

dlax commented Apr 3, 2024 via email

dlax added a commit that referenced this issue Apr 3, 2024
This reverts commit 8a5fa22, which was
introduced as a workaround for an issue RPM build system:

  rpm-software-management/rpm#2532

but now poses problems with recent setuptools versions that warn about
missing packages:

  #411

Now that the RPM issue got resolved, it seems safe to get back to
automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.
dlax added a commit that referenced this issue Apr 3, 2024
This reverts commit 8a5fa22, which was
introduced as a workaround for an issue RPM build system:
rpm-software-management/rpm#2532

but now poses problems with recent setuptools versions that warn about
missing packages: #411

Now that the RPM issue got resolved, it seems safe to get back to
automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.
dlax added a commit that referenced this issue Apr 3, 2024
This reverts commit 8a5fa22, which was
introduced as a workaround for an issue RPM build system
(rpm-software-management/rpm#2532) but now
poses problems with recent setuptools versions that warn about missing
packages: #411

Now that the RPM issue got resolved, it seems safe to get back to
automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.
dlax added a commit that referenced this issue Apr 3, 2024
This reverts commit 8a5fa22, which was
introduced as a workaround for an issue RPM build system
(rpm-software-management/rpm#2532) but now
poses problems with recent setuptools versions that warn about missing
packages: #411

Now that the RPM issue got resolved, it seems safe to get back to
automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.
dlax added a commit that referenced this issue Apr 3, 2024
Automatic package discovery by setuptools was disabled in commit
8a5fa22, somehow as a workaround for an issue RPM build system
(rpm-software-management/rpm#2532) or maybe
because it was misconfigured then.

However, having to declare packages explicitly (options 'packages' in
'[tool.setuptools]' section of pyproject.toml) is tedious and
error-prone as shown in #411
which indicates that we were missing some sub-packages.

In the meantime, the RPM issue got resolved, so it seems safe to get
back to automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.

So we get back to automatic discovery here, although not using
[tool.setuptools.packages.find], but simply letting setuptools discover
the "flat-layout" we're using, as can be seen by the following messages
from 'python -m build' un:

    * Building sdist...
    No `packages` or `py_modules` configuration, performing automatic discovery.
    `flat-layout` detected -- analysing .
    discovered packages -- ['pgactivity', 'pgactivity.profiles', 'pgactivity.queries']

This requires no configuration as we use common excluded names (like
'tests', 'docs').
dlax added a commit that referenced this issue Apr 3, 2024
Automatic package discovery by setuptools was disabled in commit
8a5fa22, somehow as a workaround for an issue RPM build system
(rpm-software-management/rpm#2532) or maybe
because it was misconfigured then.

However, having to declare packages explicitly (options 'packages' in
'[tool.setuptools]' section of pyproject.toml) is tedious and
error-prone as shown in #411
which indicates that we were missing some sub-packages.

In the meantime, the RPM issue got resolved, so it seems safe to get
back to automatic discovery as this resolves the later issue in a more
future-proof way than explicitly listing packages.

So we get back to automatic discovery here, although not using
[tool.setuptools.packages.find], but simply letting setuptools discover
the "flat-layout" we're using, as can be seen by the following messages
from 'python -m build' un:

    * Building sdist...
    No `packages` or `py_modules` configuration, performing automatic discovery.
    `flat-layout` detected -- analysing .
    discovered packages -- ['pgactivity', 'pgactivity.profiles', 'pgactivity.queries']

This requires no configuration as we use common excluded names (like
'tests', 'docs').
@dlax dlax closed this as completed in #414 Apr 3, 2024
@dlax
Copy link
Member

dlax commented Apr 3, 2024

Just released version 3.5.1 with this and #410 fixed.

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

Successfully merging a pull request may close this issue.

2 participants