Fortran-FOSS-Programmers / ford

Automatically generates FORtran Documentation from comments within the code.
https://forddocs.readthedocs.io
GNU General Public License v3.0
407 stars 133 forks source link

pyproject.toml: fix setuptools warnings #513

Closed band-a-prend closed 1 year ago

band-a-prend commented 1 year ago

The offered patch is similar to that was early in https://github.com/Fortran-FOSS-Programmers/ford/pull/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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

band-a-prend commented 1 year ago

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 commented 1 year ago

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

band-a-prend commented 1 year ago

Thanks!