Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace poetry with pip, build with hatchling, dynamically calculate minimum dependencies with uv #733

Merged
merged 39 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1b7343b
Specify dependency groups in a way that doesn't require poetry
mfisher87 Jun 30, 2024
f2e15ce
Add new poetry hooks
mfisher87 Jun 30, 2024
732abd1
Update Python compatibility in README
mfisher87 Jun 30, 2024
a31b7ae
Attempt to fix tests by installing test dependencies
mfisher87 Jun 30, 2024
5704abb
Decouple test, lint, typecheck scripts
mfisher87 Jun 30, 2024
82189e7
Remove redundant config
mfisher87 Jun 30, 2024
5b819a3
Avoid duplicate test workflow runs
mfisher87 Jun 30, 2024
21be5f2
Install docs dependencies during readthedocs build
mfisher87 Jun 30, 2024
24a5191
Migrate poetry dependency specification to standardized specification
mfisher87 Sep 4, 2024
edd6442
Replace caret dependency notation
mfisher87 Sep 7, 2024
6ac66b7
Fixup conditional dependency specifications
mfisher87 Sep 7, 2024
a39a519
Unpin kerchunk extra dependencies
mfisher87 Sep 7, 2024
4c57306
Remove poetry
mfisher87 Sep 7, 2024
cde7b85
Calculate minimum dependencies dynamically with uv
mfisher87 Sep 7, 2024
5f5986f
Encode mypy's files and python version in config
mfisher87 Sep 7, 2024
6dada1a
Replace poetry in GitHub Actions
mfisher87 Sep 7, 2024
8e8a7e7
Replace poetry in conda dev environment
mfisher87 Sep 7, 2024
8643011
Replace poetry for binder
mfisher87 Sep 7, 2024
bd3fe74
Replace poetry for readthedocs
mfisher87 Sep 7, 2024
cadcbdd
Add nox dev dependency and fixup noxfile
mfisher87 Sep 7, 2024
e194f14
Fixup composable action
mfisher87 Sep 7, 2024
c0cf028
Install test deps for mindeps test action
mfisher87 Sep 7, 2024
9818907
Upgrade minimum evrsions of some test dependencies
mfisher87 Sep 7, 2024
7c4eb2e
Add uv lockfile pre-commit check
mfisher87 Sep 7, 2024
4409b11
Add docs dependencies to conda dev env
mfisher87 Sep 11, 2024
bff4354
Restore integration tests to run on all supported Python versions
mfisher87 Sep 11, 2024
adbc43c
Move dev environment file out of CI directory
mfisher87 Sep 11, 2024
82381d7
Fix typo
mfisher87 Sep 14, 2024
87c22ea
Use modern syntax to get Actions output into GUI
mfisher87 Sep 14, 2024
c5c414e
Fix spelling
mfisher87 Sep 14, 2024
f53b451
Explicitly source instead of using dot alias
mfisher87 Sep 14, 2024
f96b5f0
Clarify supported versions of Python in README
mfisher87 Sep 14, 2024
d1b619d
Add development guide note for conda users
mfisher87 Sep 17, 2024
df578ed
Clarify purpose of Nox vs full dev env
mfisher87 Sep 17, 2024
0923beb
Replace reference to Make
mfisher87 Sep 17, 2024
54e0ae1
Merge branch 'main' into poetry-groups-to-pep621-optional-deps
mfisher87 Sep 17, 2024
a6aee82
Rename conda dev environment file
mfisher87 Sep 17, 2024
2cef7fb
Remove references to removed/moved files
mfisher87 Sep 17, 2024
de313be
Move build system to top of pyproject
mfisher87 Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ jobs:
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- name: Install Dependencies
- name: Install dependencies
if: ${{ !env.ACT }}
run: poetry install
- name: Install Dependencies
run: poetry install -E test
- name: Install dependencies
if: ${{ env.ACT }}
# When using `act` to run the workflow locally, the `poetry install` command
# may fail due to network issues when running multiple Docker containers.
run: poetry install || poetry install || poetry install
run: poetry install -E test || poetry install -E test || poetry install -E test
- name: Test
env:
EARTHDATA_USERNAME: ${{ secrets.EDL_USERNAME }}
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Unit Tests

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]

Expand Down Expand Up @@ -42,14 +44,16 @@ jobs:
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
- name: Install Dependencies
- name: Install dependencies
if: ${{ !env.ACT }}
run: poetry install
- name: Install Dependencies
run: poetry install -E test
- name: Install dependencies
if: ${{ env.ACT }}
# When using `act` to run the workflow locally, the `poetry install` command
# may fail due to network issues when running multiple Docker containers.
run: poetry install || poetry install || poetry install
run: poetry install -E test || poetry install -E test || poetry install -E test
- name: Typecheck
run: poetry run bash scripts/typecheck.sh
- name: Test
run: poetry run bash scripts/test.sh
- name: Upload coverage
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ repos:
- id: no-commit-to-branch # protects `main` by default
- id: trailing-whitespace

- repo: https://github.com/python-poetry/poetry
rev: '1.8.3'
hooks:
- id: poetry-check
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fail if the lockfile hasn't been updated, or if there's a typo in a package name in poetry config.

# This hook is very slow! Run with `pre-commit run -a poetry-lock --hook-stage manual`
- id: poetry-lock
stages: [manual]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
hooks:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Visit [our quick start guide](https://earthaccess.readthedocs.io/en/latest/quick

## Compatibility

Only **Python 3.8+** is supported.
Only **Python 3.9+** is supported.
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved


## How to Contribute to `earthaccess`
Expand Down
137 changes: 73 additions & 64 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,76 +31,85 @@ classifiers = [
"License :: OSI Approved :: MIT License",
]

requires-python = ">=3.9"

# NOTE: Minimum dependencies are tested with the packages defined in the
# `ci/environment-mindeps.yaml` conda environment. When updating minimum dependencies
# here, make sure to also update `ci/environment-mindeps.yaml`.
[tool.poetry.dependencies]
python = ">=3.9,<4.0"
python-cmr = ">=0.10.0"
pqdm = ">=0.1"
requests = ">=2.26"
s3fs = ">=2022.11"
fsspec = ">=2022.11"
tinynetrc = "^1.3.1"
multimethod = ">=1.8"
kerchunk = { version = ">=0.1.2", optional = true }
dependencies = [
"python-cmr >=0.10.0",
"pqdm >=0.1",
"requests >=2.26",
"s3fs >=2022.11",
"fsspec >=2022.11",
"tinynetrc ^1.3.1",
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved
"multimethod >=1.8",
"importlib-resources >=6.3.2",
"typing_extensions >=4.10.0",
"numpy >=1.24.0;python<3.12",
"numpy >=1.26.0;python>=3.12",
]

## Optional dependencies; can be opted-in with extra specifications below
## This is so verbose because Poetry requires it: https://python-poetry.org/docs/pyproject#extras
## If we switch to PEP621 specification, we can specify extras (called
## "optional" under PEP621) with versions in one line:
#https://peps.python.org/pep-0621/#example
# kerchunk requires numpy, but numpy >=1.26.0 is required for Python 3.12 support
numpy = [
{ version = ">=1.24.0", optional = true, python = "<3.12" },
{ version = ">=1.26.0", optional = true, python = ">=3.12" }
[project.optional-dependencies]
kerchunk = [
"kerchunk >=2022.1.0",
"dask >=0.1.2",
]
dask = { version = ">=2022.1.0", optional = true }
importlib-resources = ">=6.3.2"
typing_extensions = ">=4.10.0"

[tool.poetry.extras]
kerchunk = ["kerchunk", "dask"]

[tool.poetry.group.dev.dependencies]
python-magic = ">=0.4"
mypy = ">=0.812"
jupyterlab = ">=3"
pre-commit = ">=2.4"
pytest = ">=6.0"
pytest-cov = ">=2.8"
pytest-watch = ">=4.2"
# Prevent install of 1.6.0 because the module mkdocs.tests
# is no longer exported, which causes mkdocs-jupyter to
# break with a ModuleNotFoundError.
mkdocs = ">=1.2,!=1.6.0"
mkdocs-material = ">=7.1,<10.0"
mkdocs-redirects = ">=1.2.1"
markdown-callouts = ">=0.2.0"
markdown-include = ">=0.6"
mkdocstrings = {extras = ["python"], version = ">=0.19.0"}
mkdocs-jupyter = ">=0.19.0"
pymdown-extensions = ">=9.2"
pygments = ">=2.11.1"
responses = ">=0.14"
ruff = ">=0.4.2"
types-requests = ">=0.1"
types-setuptools = ">=0.1"
ipywidgets = ">=7.7.0"
widgetsnbextension = ">=3.6.0"
# for notebook integrations and documentation examples
xarray = ">=2023.01"
matplotlib = ">=3.3"
h5netcdf = ">=0.11"
pyproj = [
{ version = ">=3.5.0", python = "<3.12" },
{ version = ">=3.6.1", python = ">=3.12" }
dev = [
"bump-my-version >=0.10.0",
"pre-commit >=2.4",
"ruff >=0.4.2",
]
bump-my-version = ">=0.10.0"
vcrpy = ">=6.0.1"
# The following error occurs when building the docs, so we must explicitly
# include lxml-html-clean as a dev dependency until mkdocs-jupyter is updated:
#
# ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
# Install lxml[html_clean] or lxml_html_clean directly.
#
# See https://github.com/danielfrg/mkdocs-jupyter/issues/200
# See https://github.com/danielfrg/mkdocs-jupyter/issues/197
lxml-html-clean = ">=0.1.1"
test = [
"mypy >=0.812",
"pytest >=6.0",
"pytest-cov >=2.8",
"pytest-watch >=4.2",
"python-magic >=0.4",
"responses >=0.14",
"types-requests >=0.1",
"types-setuptools >=0.1",
"vcrpy >=6.0.1",
]
docs = [
"jupyterlab >=3",
"ipywidgets >=7.7.0",
"widgetsnbextension >=3.6.0",
# Prevent install of 1.6.0 because the module mkdocs.tests
# is no longer exported, which causes mkdocs-jupyter to
# break with a ModuleNotFoundError.
# for notebook integrations and documentation examples
"mkdocs >=1.2,!=1.6.0",
"mkdocs-material >=7.1,<10.0",
"mkdocs-redirects >=1.2.1",
"markdown-callouts >=0.2.0",
"markdown-include >=0.6",
"mkdocs-jupyter >=0.19.0",
"mkdocstrings[python] >=0.19.0",
"pymdown-extensions >=9.2",
"pygments >=2.11.1",
"xarray >=2023.01",
"matplotlib >=3.3",
"h5netcdf >=0.11",
"pyproj >=3.5.0;python<3.12",
"pyproj >=3.6.1;python>=3.12",
# The following error occurs when building the docs, so we must explicitly
# include lxml-html-clean as a dev dependency until mkdocs-jupyter is updated:
#
# ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
# Install lxml[html_clean] or lxml_html_clean directly.
#
# See https://github.com/danielfrg/mkdocs-jupyter/issues/200
# See https://github.com/danielfrg/mkdocs-jupyter/issues/197
"lxml-html-clean >=0.1.1",
]


[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build:
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install -E docs
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry env info
- pip freeze

Expand Down
1 change: 0 additions & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

set -ex

mypy earthaccess stubs tests
ruff check .
1 change: 0 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ set -e
set -x

pytest tests/unit --cov=earthaccess --cov=tests --cov-report=term-missing "${@}" -s --tb=native --log-cli-level=INFO
bash ./scripts/lint.sh
5 changes: 5 additions & 0 deletions scripts/typecheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -ex

mypy .
Loading