sneakers-the-rat / paper-feeds

A FastAPI web server for creating RSS feeds for scholarly journals with the magic of adversarial interoperability
GNU General Public License v3.0
63 stars 4 forks source link

Static file and templates incorrectly packaged in wheel/sdist #34

Closed sneakers-the-rat closed 10 months ago

sneakers-the-rat commented 10 months ago

We are using a very normal src layout at the moment:

paper-feeds
|- src
|  |- paper_feeds
|  |- static
|  |- templates

The problem is that poetry doesn't want to handle files that are outside of the python directory:

and apparently PyPA now recommends that we put those inside the package folder itself, sort of defeating the purpose of a src directory structure imo: https://setuptools.pypa.io/en/latest/userguide/datafiles.html#non-package-data-files

The current use of include here: https://github.com/sneakers-the-rat/paper-feeds/blob/c2ea3694e4a10b018b08f4ac8d8a0ea1ff23a030/pyproject.toml#L12-L15

results in a directory structure like this when the wheel is installed from eg. pypi

| site-packages
  |- static
  |- templates
  |- paper_feeds
  |- ... all the other packages

which is just mind boggling behavior. The change in directory nesting depth and structure causes the program to not be able to find those directories - and we definitely don't want them to just be littering the site-packages directory and potentially conflicting with other packages anyway.

To fix, we just need to put the static and templates directories within the python package, should be pretty straightforward.