Open maximlt opened 1 year ago
I thought we'd already investigated this and had problems, but it looks like it was for an earlier incarnation of declarative files: https://github.com/holoviz/holoviz/issues/154 . As that issue hints, maybe the toml version eliminates those limitations now that it's in wider use? In HoloViz we do love our declarative approaches, when they actually work! :-)
Yes indeed things should be better at this point. Yet pyproject.toml isn't fully declarative, in the sense that there are still some fields that can/need to be computed dynamically. This is for instance the case for version, and we'll have to see if param.version
works in that case too without any change.
Probably trying to convert Panel from setup.py to pyproject.toml would give us enough insight.
I had a brief look at this and will list here some difficulties to address:
param.version
would be required or we would need to find a replacement. Keeping track of a discussion on this here: https://github.com/pyviz-dev/autover/issues/47all
but there may be others. It looks like the extras can depend on other extras self-referencing the package, e.g. all = ['param[test]', 'param[docs]', 'param[examples]']
. Would be nice to find the spec that documents that (navigating the Python packaging docs is not easy)../examples
to ./hvplot/examples
). TBD. Just noting that this is only done when this is true: if 'develop' not in sys.argv and 'egg_info' not in sys.argv
.[ ] Template the conda recipe with metadata read from pyproject.toml
. conda-build
can read data from TOML: {% set pyproject = load_file_data('../pyproject.toml', from_recipe_dir=True) %}
. It gets trickier with dynamic fields like version
. One approach is to compute the version dynamically and inject it with an environment variable. E.g. this is how you'd do it with setuptools_scm
:
VERSION=`python -m setuptools_scm` conda build conda.recipe
Having to rely on a declarative file like pyproject.toml instead of on a Python module like setup.py will bring some advantages. It would for instance make it easier to collect the dependencies required by a package and convert them to an environment.yml file. A project like conda-lock has very good support for this file format.