Skip to content

Commit

Permalink
Simplify dev dependencies (#68)
Browse files Browse the repository at this point in the history
* Simplify pyproject.toml by removing optional deps in favor of hatch

* Run tests on all branches

* Specify on condition for workflows

* Update old action versions
  • Loading branch information
aazuspan committed Jun 16, 2023
1 parent 3c03c2b commit e3090b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 75 deletions.
25 changes: 7 additions & 18 deletions .github/workflows/tests-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
name: tests-coverage

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
- '.pre-commit-config.yaml'
- 'docs/**'
- '**.md'
- '**.rst'
on: pull-request

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest-cov
pip install -e .[test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install hatch
- name: Store EE token
run: |
python ./.github/scripts/make_ee_token.py
env:
EE_TOKEN: ${{ secrets.EE_TOKEN }}
- name: Test with pytest
run: |
pytest --cov=./ --cov-report=xml
hatch run test:coverage --cov-report=xml
- name: Upload to Codecov
run: |
bash <(curl -s https://codecov.io/bash)
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
# This workflow sets up the Earth Engine token and runs all tests.

name: tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: push

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e .[test]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install hatch
- name: Store EE token
run: |
python ./.github/scripts/make_ee_token.py
env:
EE_TOKEN: ${{ secrets.EE_TOKEN }}
- name: Test with pytest
run: |
pytest .
hatch run test:all
4 changes: 2 additions & 2 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Setup
git clone https://github.com/{username}/wxee
cd wxee
pip install -e .[dev]
pre-commit install
pip install hatch
hatch run -e test pre-commit install
#. Create a new feature branch.

Expand Down
45 changes: 4 additions & 41 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: GIS",
"Typing :: Typed",
]
Expand All @@ -38,52 +39,14 @@ dependencies = [
"xarray",
]

[project.optional-dependencies]
dev = [
"black",
"hatch",
"hvplot",
"isort",
"matplotlib",
"mock",
"mypy",
"nbsphinx",
"pre-commit",
"pytest",
"pytest-cov",
"requests_mock",
"sphinx",
"sphinx_rtd_theme",
"netcdf4",
"plotly>=5.2.2",
]
doc = [
"nbsphinx",
"sphinx",
"sphinx_rtd_theme",
]
test = [
"netcdf4",
"plotly>=5.2.2",
"hvplot",
"matplotlib",
"mock",
"pytest",
"pytest-cov",
"requests_mock",
]

[project.urls]
Homepage = "https://github.com/aazuspan/wxee"

[tool.hatch.version]
path = "wxee/__init__.py"


[tool.hatch.build.targets.sdist]
include = [
"/wxee",
]
include = ["/wxee"]

[tool.hatch.envs.docs]
dependences = [
Expand All @@ -96,9 +59,9 @@ dependences = [
build = "sphinx-build -b html docs docs/_build/html"
view = "python -m webbrowser -t docs/_build/html/index.html"


[tool.hatch.envs.test]
dependencies = [
"pre-commit",
"netcdf4",
"plotly>=5.2.2",
"hvplot",
Expand All @@ -112,7 +75,7 @@ dependencies = [
[tool.hatch.envs.test.scripts]
all = "pytest . {args}"
local = "pytest . -m 'not ee' {args}"
coverage = "pytest . --cov=wxee --cov-report=html {args}"
coverage = "pytest . --cov=wxee {args}"
view-coverage = "python -m webbrowser -t htmlcov/index.html"

[tool.pytest.ini_options]
Expand Down

0 comments on commit e3090b2

Please sign in to comment.