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

pyproject.toml: fix setuptools warnings #513

Merged
merged 1 commit into from
May 11, 2023

Conversation

band-a-prend
Copy link
Contributor

The offered patch is similar to that was early in #474 but for pyproject.toml.

Introduced changes fix setuptools warnings:

* Installing 'ford.css' as data is deprecated, please list it in `packages`.
* Installing 'ford.fonts' as data is deprecated, please list it in `packages`.
* Installing 'ford.js' as data is deprecated, please list it in `packages`.
* Installing 'ford.templates' as data is deprecated, please list it in `packages`.
* Installing 'ford.tipuesearch' as data is deprecated, please list it in `packages`.
* Installing 'ford.tipuesearch.img' as data is deprecated, please list it in `packages`.

The following parts aren't used due to it are applied by default:

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
namespaces = true

P.S.
Maybe there is another way to list data explicitly instead of

[tool.setuptools.packages.find]
include  = ["ford*"]

@ZedThree
Copy link
Member

ZedThree commented May 9, 2023

I think for listing data explicitly, there are a few options:

  1. explicitly add directories in MANIFEST.in
  2. add list of file extensions under [tool.setuptools.package-data] in pyproject.toml
  3. use the file finder entry point from setuptools_scm

We already use setuptools_scm to get the version number, so using it to find tracked files would be great. I'm not sure how to do this exactly.

I've also just come across importlib_resources, which looks like we should be using that too

@band-a-prend
Copy link
Contributor Author

It seems it's sufficient to do what warning asks: list mentioned items in packages, i.e.

[tools.setuptools]
packages = ["ford", "ford.css", "ford.fonts", "ford.js", "ford.templates", "ford.tipuesearch", "ford.tipuesearch.img"]

[tool.setuptools.package-data]
ford = "config.json", "favicon.png"]

I will recheck it and then will rebase the commit.

@ZedThree
Copy link
Member

Are you able to investigate using setuptools_scm to do this, at all? I suspect that would be the nicest option, as if we ever change the package structure, we wouldn't need to also update pyproject.toml

Introduced changes fix setuptools warnings:

* Installing 'ford.css' as data is deprecated, please list it in `packages`.
* Installing 'ford.fonts' as data is deprecated, please list it in `packages`.
* Installing 'ford.js' as data is deprecated, please list it in `packages`.
* Installing 'ford.templates' as data is deprecated, please list it in `packages`.
* Installing 'ford.tipuesearch' as data is deprecated, please list it in `packages`.
* Installing 'ford.tipuesearch.img' as data is deprecated, please list it in `packages`.

The following parts aren't used due to it are applied by default:

[tool.setuptools]
include-package-data = true
[tool.setuptools.packages.find]
namespaces = true

Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
@band-a-prend
Copy link
Contributor Author

Are you able to investigate using setuptools_scm to do this, at all? I suspect that would be the nicest option, as if we ever change the package structure, we wouldn't need to also update pyproject.toml

I tried handle problem with setuptools_scm but without success - as didn't understand how to handle it's file finders.

For Gentoo Linux I package FORD using PyPi's FORD-6.2.5.tar.gz (from this page) etc. tarballs.
Maybe to use setuptools_scm the FORD git source tree is required while PyPi's tarball doesn't contain it.

The presented in tarball MANIFEST.in seems could be removed. At least I don't see that README.md and output-example.png are installed for me by setuptools even without patch. And the other part of it just duplicate the explicit list of additional package data. But if some exclusion is planning later then it could be useful again.

@ZedThree
Copy link
Member

Ah yes, setuptools_scm would require the git source tree. We might be able to do something fancy like make our own tarball and upload it as an artefact on release, but that seems a lot more complicated than this fix.

If you're happy this works for your use case, let's just go with this

@ZedThree ZedThree merged commit 62b8d7f into Fortran-FOSS-Programmers:master May 11, 2023
@band-a-prend band-a-prend deleted the setup_warn branch May 11, 2023 09:58
@band-a-prend
Copy link
Contributor Author

Thanks!

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.

2 participants