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

Improve build setup #5634

Closed
wants to merge 3 commits into from
Closed

Conversation

abravalheri
Copy link

@abravalheri abravalheri commented Mar 1, 2023

Hi @maximlt and maintainers, this PR was created in response to pypa/setuptools#3841.

Please feel free to ignore/close or use parts of it in other PRs.

The main idea is to simplify setup.py to keep only configuration that needs to be dynamically computed (and package_dir since it is directly related them).

Everything else that is static can be moved to pyproject.toml.

Notes:

  • You can use package_dir config to logic remap package directories to other locations (as long as they are inside the same project root).
    • This should obviate the need for copying the examples folder.
  • Newer versions of pip / setuptools deprecate direct usage of python setup.py ..., these might even no longer be called.
    • Therefore it makes less sense to keep checks for develop and install in sys.argv.
  • The installation environment should already come with both param and pyct pre-installed in the correct versions (specified in pyproject.toml [build-system]). Therefore version checks for those dependencies can be removed.
  • As long as pip is relatively modern (released a couple of years ago), it should be possible for a package to depend on itself+extras.
    • This is a way of avoid repeating dependencies in extras, while still specifying them statically.

(If you have an intention of using this PR, please double check if I did not miss anything in pyproject.toml when doing the conversion...)

(I also believe that it should be OK to remove graft holoviews/examples from MANIFEST.in, but I haven't checked that).


Please note that when installing in editable mode some static analysis tools like vscode code intel and mypy may have trouble to find the package. This happens because static analysis tools may - understandably - have trouble to deal with dynamic parts of the Python language, such as MetaPathFinder and PathEntryFinder.

To workaround that you can use pip install -e . --config-settings editable_mode=compat for the installation. Note however that the package holoviews.examples will not be accessible for imports if the project is installed in that way.

The idea is to try to keep only configuration that needs to be dynamically
computed (and `package_dir` since it is directly related them).

Everything else can be defined statically in `pyproject.toml`.

Notes:

- Newer versions of `pip` / `setuptools` deprecate direct usage of `python setup.py ...`,
  these might no longer be called.
  Therefore it makes little sense to keep checks for `develop` and
  `install` in `sys.argv`.

- The installation environment should come with both `param` and `pyct`
  installed with the right versions (according to `pyproject.toml`).
  Therefore version checks for those dependencies might be removed.
@abravalheri abravalheri marked this pull request as ready for review March 24, 2023 17:21
@hoxbro
Copy link
Member

hoxbro commented May 17, 2024

Thank you for the PR. I did use part of it when upgrading our build setup.

@hoxbro hoxbro closed this May 17, 2024
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.

None yet

2 participants