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

Enable back setuptools automatic discovery #414

Merged
merged 1 commit into from
Apr 3, 2024
Merged

Enable back setuptools automatic discovery #414

merged 1 commit into from
Apr 3, 2024

Conversation

dlax
Copy link
Member

@dlax dlax commented Apr 3, 2024

Fix #411

@asarubbo, can you check if this resolves #411 on Gentoo?
@mikelolasagasti, can you check if this change works for Fedora, as this reverts the one from #378?

@dlax dlax force-pushed the setuptools-find branch from edc9826 to caa26fa Compare April 3, 2024 08:06
@mikelolasagasti
Copy link
Contributor

Patched pyproject.toml on top of 3.5.0 and fails with:

error: Installed (but unpackaged) file(s) found:
   /usr/lib/python3.12/site-packages/docs/imgs/logo-horizontal.png
   /usr/lib/python3.12/site-packages/docs/imgs/logo-horizontal.svg
   /usr/lib/python3.12/site-packages/docs/imgs/logo.svg
   /usr/lib/python3.12/site-packages/docs/imgs/screenshot.png
   /usr/lib/python3.12/site-packages/docs/man/build-man.sh
   /usr/lib/python3.12/site-packages/docs/man/pg_activity.1
   /usr/lib/python3.12/site-packages/docs/man/pg_activity.pod
   /usr/lib/python3.12/site-packages/tests/__pycache__/conftest.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/conftest.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_activities.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_activities.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_config.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_config.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_data.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_data.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_types.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_types.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_views.cpython-312.opt-1.pyc
   /usr/lib/python3.12/site-packages/tests/__pycache__/test_views.cpython-312.pyc
   /usr/lib/python3.12/site-packages/tests/conftest.py
   /usr/lib/python3.12/site-packages/tests/data/local-processes-input.json
   /usr/lib/python3.12/site-packages/tests/test_activities.py
   /usr/lib/python3.12/site-packages/tests/test_config.py
   /usr/lib/python3.12/site-packages/tests/test_data.py
   /usr/lib/python3.12/site-packages/tests/test_scroll.txt
   /usr/lib/python3.12/site-packages/tests/test_types.py
   /usr/lib/python3.12/site-packages/tests/test_ui.txt
   /usr/lib/python3.12/site-packages/tests/test_views.py
   /usr/lib/python3.12/site-packages/tests/test_views.txt
   /usr/lib/python3.12/site-packages/tests/test_widgets.txt

Environment info:

INFO: Buildroot is handled by package management downloaded with a bootstrap image:
  rpm-4.19.1-2.fc40.x86_64
  rpm-sequoia-1.5.0-2.fc40.x86_64
  python3-dnf-4.18.2-1.fc40.noarch
  yum-4.18.2-1.fc40.noarch
  dnf5-5.1.10-3.fc40.x86_64
  dnf5-plugins-5.1.10-3.fc40.x86_64
Finish: chroot init

@asarubbo
Copy link

asarubbo commented Apr 3, 2024

@asarubbo, can you check if this resolves #411 on Gentoo?

It works for me, but it introduces another problem and the package manager denies to install the package:

 * python3_10: running distutils-r1_run_phase distutils-r1_python_install
 * The following unexpected files/directories were found top-level
 * in the site-packages directory:
 * 
 *   /usr/lib/python3.10/site-packages/tests
 * 
 * This is most likely a bug in the build system.  More information
 * can be found in the Python Guide:
 * https://projects.gentoo.org/python/guide/qawarn.html#stray-top-level-files-in-site-packages
 * ERROR: dev-db/pg_activity-3.5.0::x-portage failed (install phase):
 *   Failing install because of stray top-level files in site-packages

I think it is self-explain, but if you have doubts please let me know.

@dlax
Copy link
Member Author

dlax commented Apr 3, 2024

Thank you both for testing.
I just pushed another commit here; can you please try again and report back?

@asarubbo
Copy link

asarubbo commented Apr 3, 2024

Thank you both for testing. I just pushed another commit here; can you please try again and report back?

this works for me. No further errors

@mikelolasagasti
Copy link
Contributor

works for me also.

@dlax dlax force-pushed the setuptools-find branch from 6be0666 to 517178c Compare April 3, 2024 12:39
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 force-pushed the setuptools-find branch from 517178c to fd9679c Compare April 3, 2024 12:42
@dlax dlax merged commit fd9679c into master Apr 3, 2024
6 checks passed
@dlax dlax deleted the setuptools-find branch April 3, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setuptools warning
3 participants