diff --git a/.gitignore b/.gitignore index e8fc9848..3c671588 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,6 @@ cython_debug/ # rever rever/ + +# setuptools_scm +_version.py diff --git a/conda_libmamba_solver/__init__.py b/conda_libmamba_solver/__init__.py index e13e99c7..177a0868 100644 --- a/conda_libmamba_solver/__init__.py +++ b/conda_libmamba_solver/__init__.py @@ -1,6 +1,16 @@ # Copyright (C) 2022 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause -__version__ = "22.8.1" + +try: + from ._version import version as __version__ +except ImportError: + try: + from importlib_metadata import version + + __version__ = version("conda_libmamba_solver") + del version + except ImportError: + __version__ = "0.0.0.unknown" from warnings import warn as _warn diff --git a/dev/bashrc_linux.sh b/dev/bashrc_linux.sh index e7925154..b37af348 100644 --- a/dev/bashrc_linux.sh +++ b/dev/bashrc_linux.sh @@ -11,12 +11,11 @@ restore_e() { trap restore_e EXIT sudo /opt/conda/condabin/conda install -y -p /opt/conda \ - "flit-core>=3.2,<4" \ --file /opt/conda-libmamba-solver-src/dev/requirements.txt \ --file /opt/conda-libmamba-solver-src/tests/requirements.txt cd /opt/conda-libmamba-solver-src -sudo env FLIT_ROOT_INSTALL=1 /opt/conda/bin/python -m flit install --symlink --deps=none +sudo /opt/conda/bin/python -m pip install -e . --no-deps cd /opt/conda-src export RUNNING_ON_DEVCONTAINER=${RUNNING_ON_DEVCONTAINER:-} diff --git a/dev/requirements.txt b/dev/requirements.txt index 4a187c11..f7f68789 100644 --- a/dev/requirements.txt +++ b/dev/requirements.txt @@ -1,4 +1,7 @@ -libmambapy>=1.0 -libarchive +# build-time +pip +# run-time conda>=22.9 # should be 22.11 importlib-metadata +libarchive +libmambapy>=1.0 diff --git a/news/127-hatchling b/news/127-hatchling new file mode 100644 index 00000000..b2055255 --- /dev/null +++ b/news/127-hatchling @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* + +### Docs + +* + +### Other + +* Change the build-system to `hatchling` + `hatch-cvs` for a `setuptools-scm`-like versioning setup. (#128 via #127) diff --git a/pyproject.toml b/pyproject.toml index 482d36f0..7479bea4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["flit_core >=3.2,<4"] -build-backend = "flit_core.buildapi" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" [project] name = "conda-libmamba-solver" @@ -37,8 +37,8 @@ homepage = "https://github.com/conda/conda-libmamba-solver" [project.entry-points.conda] conda-libmamba-solver = "conda_libmamba_solver.plugin" -[tool.flit.module] -name = "conda_libmamba_solver" +[tool.hatch.version] +source = "vcs" [tool.black] line-length = 99 diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ec767e52..e777ecef 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,6 +1,6 @@ package: name: "conda-libmamba-solver" - version: {{ GIT_DESCRIBE_TAG }}.{{ GIT_BUILD_STR }} + version: "{{ GIT_DESCRIBE_TAG }}.{{ GIT_BUILD_STR }}" source: # git_url is nice in that it won't capture devenv stuff. However, it only @@ -28,6 +28,13 @@ test: - conda_libmamba_solver commands: - CONDA_SOLVER=libmamba conda create -n test --dry-run scipy + - >- + python -c + "import conda_libmamba_solver as cls; + from importlib.metadata import version; + assert '{{ PKG_VERSION }}' == cls.__version__ == version('conda_libmamba_solver'), + '{{ PKG_VERSION }}' + f', {cls.__version__}, ' + version('conda_libmamba_solver') + " about: home: https://github.com/conda/conda-libmamba-solver