changedetection.io icon indicating copy to clipboard operation
changedetection.io copied to clipboard

Modernize setuptools to use pyproject.toml

Open kruton opened this issue 1 year ago • 4 comments

This is inline with the recommendations in Python Packaging User Guide. Migration to the new format should not change any build steps since the newer build invocations are already being used (e.g., python -m build).

requirements.txt is left as-is and read as "dynamic" data (i.e., outside of the pyproject.toml file) by setuptools. A further enhancement may be to separate out the production requirements from the development environment requirements if any exist.

zip_safe directive is removed since it is deprecated.

scripts is also deprecated in favor of entry_points which is now under [projects.scripts] in the same format. This means the changedetection.py file is not included, but it appears to be intended for local development as the changedetection.io script created during installation from entry_points has the same function.

include_package_data is true by default in pyproject.toml format, so it is excluded from the new file.

The changes were verified to build the same .whl and .tar.gz by examining the artifacts. The exceptions are:

  • In the .whl file there is no longer changedetection.py in the scripts directory.
  • zip_safe is no longer included
  • pyproject.toml is now included
  • In PKG-INFO:
    • Home-page field is now in Project-URL
    • Additional Classifier for Apache License 2.0
    • Keywords are now keywords instead of a long string

kruton avatar Jul 25 '24 00:07 kruton

I'm opening pull requests for random things because I was trying to test my change to the JavaScript sent to Playwright and found the testing instructions difficult to follow.

I'm going to try to port the test infrastructure to use testcontainers-python which should allow anyone (including CI systems) to simply run "pytest" and have it start up the containers it needs. Hopefully it will also make it easier to understand how to set up the correct environment on new tests.

kruton avatar Jul 25 '24 05:07 kruton

thanks so much for this, I have to admit my python skills in general arent so great :) so this helps a lot!

dgtlmoon avatar Jul 25 '24 12:07 dgtlmoon

I'm going to try to port the test infrastructure to use testcontainers-python which should allow anyone (including CI systems) to simply run "pytest" and have it start up the containers it needs. Hopefully it will also make it easier to understand how to set up the correct environment on new tests.

ok interesting, lets do that on another PR and i'll take a look

dgtlmoon avatar Jul 25 '24 12:07 dgtlmoon

@dgtlmoon sorry, I forgot to push my change for the license files a few months ago!

kruton avatar Nov 14 '24 21:11 kruton