Skip to content

Commit 8ae049a

Browse files
committed
Update github actions
1 parent 5c9ac1f commit 8ae049a

6 files changed

Lines changed: 75 additions & 58 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,32 @@ on:
99
pull_request:
1010
branches: ['main']
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
16+
ruff:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
21+
with:
22+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
23+
- name: Set up Python 3.14
24+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
25+
with:
26+
python-version: '3.14'
27+
cache: pip
28+
cache-dependency-path: pyproject.toml
29+
- name: Install Ruff
30+
run: python -m pip install --upgrade pip ruff
31+
- name: Ruff check
32+
run: ruff check .
33+
- name: Ruff format check
34+
run: ruff format --check .
35+
1336
build:
37+
needs: ruff
1438
runs-on: ${{ matrix.os }}
1539
strategy:
1640
fail-fast: false
@@ -20,20 +44,18 @@ jobs:
2044

2145
steps:
2246
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
47+
with:
48+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
2349
- name: Set up Python ${{ matrix.python-version }}
2450
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
2551
with:
2652
python-version: ${{ matrix.python-version }}
53+
cache: pip
54+
cache-dependency-path: pyproject.toml
2755
- name: Install dependencies
2856
run: |
2957
python -m pip install --upgrade pip
3058
pip install .[test,nldi]
31-
- name: Lint with flake8
32-
run: |
33-
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3759
- name: Test with pytest and report coverage
3860
run: |
3961
coverage run -m pytest tests/

.github/workflows/python-publish.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@ permissions:
1717

1818
jobs:
1919
deploy:
20-
2120
runs-on: ubuntu-latest
2221

2322
steps:
24-
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
25-
- name: Set up Python
26-
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
27-
with:
28-
python-version: '3.x'
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install build
33-
pip install setuptools setuptools-scm wheel twine check-manifest
34-
- name: Build package
35-
run: python -m build
36-
- name: Publish package
37-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
38-
with:
39-
user: __token__
40-
password: ${{ secrets.PYPI_API_TOKEN }}
23+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
24+
- name: Set up Python 3.13
25+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
26+
with:
27+
python-version: '3.13'
28+
cache: pip
29+
cache-dependency-path: pyproject.toml
30+
- name: Install build tooling
31+
run: |
32+
python -m pip install --upgrade pip build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/sphinx-docs.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: Sphinx Docs Build
44

55
on:
66
push:
7+
branches: ['main']
78
pull_request:
89

910
jobs:
@@ -14,21 +15,20 @@ jobs:
1415
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
1516
with:
1617
persist-credentials: false
17-
- name: Install dataretrieval, dependencies, and Sphinx then build docs
18-
shell: bash -l {0}
18+
- name: Set up Python 3.13
19+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
20+
with:
21+
python-version: '3.13'
22+
cache: pip
23+
cache-dependency-path: pyproject.toml
24+
- name: Install documentation dependencies
1925
run: |
2026
python -m pip install --upgrade pip
2127
pip install .[doc,nldi]
2228
ipython kernel install --name "python3" --user
23-
sudo apt update -y && sudo apt install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended dvipng pandoc
29+
sudo apt-get update -y
30+
sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended dvipng pandoc
2431
(cd docs && make html)
25-
- name: Debug
26-
run: |
27-
echo $REF
28-
echo $EVENT_NAME
29-
echo ${{ github.event_name == 'push' }}
30-
echo ${{ github.ref == 'refs/heads/main' }}
31-
echo ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
3232
- name: Deploy to GitHub Pages
3333
uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29
3434
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

docs/source/meta/installing.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ Installation Guide
44
Whether you are a user or developer we recommend installing ``dataretrieval``
55
in a virtual environment. This can be done using something like ``virtualenv``
66
or ``conda``. Package dependencies are listed in the `requirements.txt`_ file,
7-
a full list of dependencies necessary for development are listed in the
8-
`requirements-dev.txt`_ file.
7+
a full list of dependencies necessary for development are available from the
8+
``dev`` extra in ``pyproject.toml``.
99

1010
.. _requirements.txt: https://github.com/DOI-USGS/dataretrieval-python/blob/main/requirements.txt
1111

12-
.. _requirements-dev.txt: https://github.com/DOI-USGS/dataretrieval-python/blob/main/requirements-dev.txt
13-
1412

1513
User Installation
1614
-----------------
@@ -59,8 +57,7 @@ the package for development:
5957

6058
.. code-block:: bash
6159
62-
$ pip install -r requirements-dev.txt
63-
$ pip install -e .
60+
$ pip install -e ".[dev]"
6461
6562
To check your installation you can run the tests with the following commands:
6663

pyproject.toml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ test = [
3636
"pytest-cov[all]",
3737
"coverage",
3838
"requests-mock",
39-
"flake8",
4039
]
4140
doc = [
4241
"docutils<0.22",
@@ -52,6 +51,23 @@ doc = [
5251
nldi = [
5352
'geopandas>=0.10'
5453
]
54+
dev = [
55+
"pytest > 5.0.0",
56+
"pytest-cov[all]",
57+
"coverage",
58+
"requests-mock",
59+
"ruff",
60+
"docutils<0.22",
61+
"sphinx",
62+
"sphinx-rtd-theme",
63+
"nbsphinx",
64+
"nbsphinx_link",
65+
"ipython",
66+
"ipykernel",
67+
"matplotlib",
68+
"folium>=0.12",
69+
"geopandas>=0.10",
70+
]
5571

5672
[project.urls]
5773
homepage = "https://github.com/DOI-USGS/dataretrieval-python"

requirements-dev.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)