One aspect of conda packaging that's worth adopting is the 'test' block of the meta.yaml which contains commands necessary to *test* the built package.
You can add a pytest command to setup.py, but it's not as easy as: https://github.com/conda-forge/python-feedstock/blob/master/recipe/meta.yaml#L227-L291 : ```yaml test: downstreams: - cython - setuptools requires: - ripgrep - cmake - ninja - {{ compiler('c') }} # Tried to use enable_language(C) to avoid needing this. It does not work. - {{ compiler('cxx') }} files: - tests/distutils/* - tests/cmake/* - tests/cython/* - tests/prefix-replacement/* commands: - echo on # [win] - set # [win] - python -V - python3 -V # [not win] - 2to3 -h - pydoc -h - python3-config --help # [not win] - set "PIP_NO_BUILD_ISOLATION=False" # [win] - set "PIP_NO_DEPENDENCIES=True" # [win] - set "PIP_IGNORE_INSTALLED=True" # [win] - set "PIP_NO_INDEX=True" # [win] - set "PIP_CACHE_DIR=%CONDA_PREFIX%/pip_cache" # [win] - set "TEMP=%CONDA_PREFIX%/tmp" # [win] - mkdir "%TEMP%" # [win] - python -Im ensurepip --upgrade --default-pip # [win] # tzdata/zoneinfo test that will need the tzdata package to pass - python -c "from zoneinfo import ZoneInfo; from datetime import datetime; dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo('America/Los_Angeles')); print(dt.tzname())" - python -m venv test-venv - python -c "import sysconfig; print(sysconfig.get_config_var('CC'))" # [not win] - _CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_cos6_linux_gnu python -c "import sysconfig; print(sysconfig.get_config_var('CC'))" # [linux64] # check for unreplaced @ symbols in sysconfig files - for f in ${CONDA_PREFIX}/lib/python*/_sysconfig*.py; do echo "Checking $f:"; if [[ `rg @ $f` ]]; then echo "FAILED ON $f"; cat $f; exit 1; fi; done # [linux64 or osx] - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix] - test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix] # https://github.com/conda-forge/python-feedstock/issues/384 - if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win] - if exist %PREFIX%\\Scripts\\idle exit 1 # [win] - if exist %PREFIX%\\Scripts\\2to3 exit 1 # [win] - if not exist %PREFIX%\\Scripts\\pydoc-script.py exit 1 # [win] - if not exist %PREFIX%\\Scripts\\idle-script.py exit 1 # [win] - if not exist %PREFIX%\\Scripts\\2to3-script.py exit 1 # [win] - if not exist %PREFIX%\\Scripts\\idle.exe exit 1 # [win] - if not exist %PREFIX%\\Scripts\\2to3.exe exit 1 # [win] - if not exist %PREFIX%\\Scripts\\pydoc.exe exit 1 # [win] - pushd tests - pushd distutils - python setup.py install -v -v - python -c "import foobar" - popd - pushd prefix-replacement # [unix] - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake - cmake -GNinja -DPY_VER={{ version }} # --trace --debug-output --debug-trycompile . - popd - popd - test ! -f default.profraw # [osx] ``` In which package you then store integration tests for your whole application and it's integrated dependencies is then up to you. Unfortunately, we often don't include tests/ in our packages, so it's literally not possible to run the tests in production even if you have pytest_requires installed. Perhaps distros would do well to implement support for integration and per-package tests. On Thu, Feb 25, 2021, 12:55 Fred Drake <f...@fdrake.net> wrote: > On Thu, Feb 25, 2021 at 5:35 AM Wes Turner <wes.tur...@gmail.com> wrote: > >> The challenge with version conflicts is often less that you need to go >> update the constraints (which has little to do with sysadmin'ing, TBH) and >> more that you have insufficient *integration tests* and you're relying upon >> something else running the per-package tears. >> > > Sometimes, auto-correct really does understand! > > Your point is right on target, and really can't be understated. > > > -Fred > > -- > Fred L. Drake, Jr. <fred at fdrake.net> > "There is nothing more uncommon than common sense." > --Frank Lloyd Wright >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/2QMXHSDF5L4QEJU5C2FVZ3AZHWEHUMXA/ Code of Conduct: http://python.org/psf/codeofconduct/