From 22e9aeab2467ac23ff0ed4a7be0ec31c3bb7c63e Mon Sep 17 00:00:00 2001 From: Nathan Collier Date: Tue, 17 Dec 2024 13:05:13 -0500 Subject: [PATCH] CHANGE: move to uv for CI / environments (#80) * first step at moving to uv * move to uv for CI, no need for environment.yml * debugging github actions * use uv to build for docs * let it go * use their recommendation * remove yaml file we no longer need --- .github/workflows/ci.yml | 23 +++++++--------- .readthedocs.yml | 13 ++++++--- ci/environment-docs.yml | 20 -------------- ci/environment.yml | 19 ------------- pyproject.toml | 58 +++++++++++++++++++++++++++++++++++++--- setup.cfg | 34 ----------------------- 6 files changed, 72 insertions(+), 95 deletions(-) delete mode 100644 ci/environment-docs.yml delete mode 100644 ci/environment.yml delete mode 100644 setup.cfg diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6df00fa..f8e2e84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,24 +31,19 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch all history for all branches and tags. + fetch-depth: 0 - - name: Create conda environment - uses: mamba-org/setup-micromamba@v1 - with: - cache-downloads: true - environment-file: ci/environment.yml - environment-name: intake-esgf-dev - create-args: >- - python=${{ matrix.python-version }} + - name: Install uv environment + uses: astral-sh/setup-uv@v4 + + - name: Set up Python ${{ matrix.python-version }} + run: uv python install ${{ matrix.python-version }} - - name: Install intake-esgf - run: | - python -m pip install -e . --no-deps --force-reinstall + - name: Install intake-esgf and dependencies + run: uv sync - name: Run Tests - run: | - python -m pytest + run: uv run pytest - name: Upload code coverage to Codecov uses: codecov/codecov-action@v3.1.4 diff --git a/.readthedocs.yml b/.readthedocs.yml index 1aed175..8fc85b8 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,7 +1,12 @@ version: 2 -conda: - environment: ci/environment-docs.yml + build: - os: "ubuntu-20.04" + os: "ubuntu-24.04" tools: - python: "mambaforge-4.10" + python: "3.12" + commands: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + - uv sync --extra docs + - uv run -m sphinx -T -b html -d doc/_build/doctrees -D language=en doc $READTHEDOCS_OUTPUT/html diff --git a/ci/environment-docs.yml b/ci/environment-docs.yml deleted file mode 100644 index b48d808..0000000 --- a/ci/environment-docs.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: intake-esgf-doc -channels: - - conda-forge - - defaults -dependencies: - - furo - - numpydoc - - xarray - - dask - - distributed - - netCDF4 - - matplotlib - - ipywidgets - - nc-time-axis - - pip - - pip: - - myst_nb - - sphinx_autosummary_accessors - - sphinx_copybutton - - -e .. diff --git a/ci/environment.yml b/ci/environment.yml deleted file mode 100644 index 0f8a0e5..0000000 --- a/ci/environment.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: intake-esgf-dev -channels: - - conda-forge - - nodefaults -dependencies: - - python>=3.10 - - pandas - - dask - - xarray - - netCDF4 - - globus-sdk - - requests - - tqdm[notebook] - - pyyaml - - jupyterlab - - matplotlib - - pytest - - pytest-cov - - pre-commit diff --git a/pyproject.toml b/pyproject.toml index ffc8fcd..c2f6424 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,54 @@ -# https://snarky.ca/what-the-heck-is-pyproject-toml/ +[project] +name = "intake-esgf" +description = "Programmatic access to the ESGF holdings" +readme = "README.md" +authors = [ + { name = "Nathan Collier", email = "nathaniel.collier@gmail.com" } +] +classifiers = ["Development Status :: 4 - Beta", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering"] +license = { file="LICENSE" } +requires-python = ">=3.10" +dependencies = [ + "dask", + "globus-sdk", + "netcdf4", + "pandas", + "pyyaml", + "requests", + "tqdm", + "xarray", +] +dynamic=["version"] + +[dependency-groups] +dev = [ + "pytest-cov", +] + +[project.optional-dependencies] +docs = [ + "distributed", + "furo", + "ipywidgets", + "matplotlib", + "myst-nb", + "nc-time-axis", + "numpydoc", + "sphinx-autosummary-accessors", + "sphinx-copybutton", +] +notebook = [ + "ipywidgets", + "tqdm[notebook]", +] [build-system] requires = ["setuptools", "setuptools_scm", "wheel"] @@ -8,8 +58,8 @@ build-backend = "setuptools.build_meta" version_scheme = "no-guess-dev" local_scheme = "node-and-date" fallback_version = "0.0.0" -write_to = "intake_esgf/_version.py" -write_to_template = '__version__ = "{version}"' +version_file = "intake_esgf/_version.py" +version_file_template = '__version__ = "{version}"' [tool.pytest.ini_options] console_output_style = "count" @@ -24,7 +74,7 @@ omit = ["*/intake_esgf/tests/*"] [tool.ruff] target-version = "py310" ignore = [ - "E501", # line too long - let black worry about that + "E501", # let black worry about line length ] select = [ "F", # Pyflakes diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b62f59c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,34 +0,0 @@ -[metadata] -name = intake-esgf -author = Nathan Collier -author_email = nathaniel.collier@gmail.com -license = BSD-3-Clause -description = An intake-esm inspired catalog for ESGF -long_description = file: README.md -long_description_content_type=text/markdown -classifiers = - Development Status :: 4 - Beta - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Intended Audience :: Science/Research - Topic :: Scientific/Engineering -requires-python = ">=3.10" - -[options] -install_requires = - pandas - dask - xarray - netCDF4 - globus-sdk - requests - tqdm[notebook] - pyyaml - -[tool:pytest] -python_files = test_*.py -testpaths = intake_esgf/tests