silx icon indicating copy to clipboard operation
silx copied to clipboard

Build: Simplified `setup.py`

Open t20100 opened this issue 3 years ago • 1 comments

Merge PR #3649 first!

This PR cleans-up/removes features from setup.py since:

running python setup.py directly as a script is considered deprecated. This also means that users should avoid running commands directly via python setup.py <command>.

https://setuptools.pypa.io/en/latest/deprecated/commands.html

We can look at packages such as invoke for this.

This PR:

  • Removes setup.py commands:

    • Remove python setup.py test (https://github.com/silx-kit/silx/commit/84b3d7047ccb74f1a7bca1e62258a63209181695): There is run_test.py for it.
    • Remove python setup.py build_doc &cie and document how to call sphinx directly (https://github.com/silx-kit/silx/commit/ea1d920da1964075886c75c1b5e0419872a39f7b): Sphinx setuptools integration is deprecated.
    • Remove python setup.py clean override (https://github.com/silx-kit/silx/commit/c9db62e9f2ff09d1fbdd4fd6bdf512b83caeb9da): There is no equivalent for that, but it allows to get rid of the last distutils import.
  • Prepares for not calling setup.py build directly:

    • Deprecate python setup.py build arguments (--no-openmp, --openmp, --force-cython) and document the env. var. that provides the same feature (https://github.com/silx-kit/silx/commit/e5ee93adcf04f369cf523df507db4bac3262cfda and https://github.com/silx-kit/silx/commit/d080eafc1a7b1b7b42fc471b7f88a561b6297a04). I renamed the env. var. with a SILX_ prefix while at it.
    • Rework and document SPECFILE_USE_GNU_SOURCE (https://github.com/silx-kit/silx/commit/ba22270b8ccb596ae9869ec54d969cf2b5897c1e).
    • Document SILX_FULL_INSTALL_REQUIRES and SILX_INSTALL_REQUIRES_STRIP env. var. (https://github.com/silx-kit/silx/commit/6ae33008c7bbe348757e7e7d819e09170eea8dd6)
  • Misc:

    • Fixed documentation by de duplicating the doc of silx.io.commonh5.Group (https://github.com/silx-kit/silx/commit/75324d254156b2965e8913d62766951abc52c96a)
    • Simplify setup kwargs (https://github.com/silx-kit/silx/commit/c02fec2558ffd6352ed244a64cebdf2cd3d0f711)

With this PR, setup.py no longer rely on distutils. 2 setup.py commands remains (build_man and debian_src) which are related to Linux packaging.

closes #3574

t20100 avatar Sep 01 '22 13:09 t20100

Release CI passes with this PR: https://gitlab.esrf.fr/silx/bob/silx/-/pipelines/85576

t20100 avatar Sep 01 '22 14:09 t20100

Rebased to master, ready for review

t20100 avatar Sep 27 '22 09:09 t20100

I dont like much env var for build. Is that a real problem to support such options?

What is the aim?

Else, i am fine with it anyway.

vallsv avatar Sep 27 '22 09:09 vallsv

I dont like much env var for build. Is that a real problem to support such options?

Neither do I... but "running python setup.py directly as a script is considered deprecated.", and passing options through pip's --global-option is more complex than using env. var. and anyway not self documented.

What is the aim?

Be future-proof

t20100 avatar Sep 27 '22 09:09 t20100