boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
21 stars 10 forks source link

Deprecated installation of tests #284

Open dschwoerer opened 1 year ago

dschwoerer commented 1 year ago

It seems some tests are currently installed as data, but that might change in the future.

See the output of setuptools below:

/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'xbout.calc.tests' as data is deprecated, please list it in `packages`.
    !!
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'xbout.calc.tests' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.
    'xbout.calc.tests' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).
    Please make sure that 'xbout.calc.tests' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).
    You can read more about "package discovery" and "data files" on setuptools
    documentation page.
!!
  check.warn(importable)
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'xbout.tests.data.options' as data is deprecated, please list it in `packages`.
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'xbout.tests.data.restart' as data is deprecated, please list it in `packages`.
/usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'xbout.tests.inputs' as data is deprecated, please list it in `packages`.
ZedThree commented 1 year ago

Might be better to just move all the tests to a top-level directory so they're not installed at all?

dschwoerer commented 1 year ago

Would that not still be pulled in (and than provide a top-level package)? https://github.com/boutproject/xBOUT/blob/master/setup.cfg#L41

johnomotani commented 1 year ago

Might be better to just move all the tests to a top-level directory so they're not installed at all?

I think having tests installed is a feature - it means you can test the installed package by doing

$ pytest --pyargs xbout
ZedThree commented 1 year ago

For finding the packages, it's trivial to just have packages = ["xbout"] as there's only the one package to install.

Ah, I didn't realise people tested installed packages! When developing, I usually do an editable install into a virtual env, which does test the package as it would be installed, but I can't say I ever test any package I've installed from pypi.

johnomotani commented 1 year ago

Ah, I didn't realise people tested installed packages! When developing, I usually do an editable install into a virtual env, which does test the package as it would be installed, but I can't say I ever test any package I've installed from pypi.

I don't know if it's actually useful, but it seems nice to have as a possibility!

Edit: also we use that method at the moment to run the tests on conda-forge, although it would probably be possible to change that.