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

Add support for python 3.13 #473

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build_deploy_master_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install -e .[docs]
python -m pip install -e .[docs,all]

- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
Expand Down
31 changes: 19 additions & 12 deletions .github/workflows/build_deploy_stable_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,32 @@ jobs:
run: |
git fetch --tags --force # Retrieve annotated tags.

- name: Get tags
run: git fetch --tags origin

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
- uses: mamba-org/setup-micromamba@v2
with:
python-version: "3.11"
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: dascore
micromamba-version: '2.0.2-1' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: environment.yml
condarc-file: .github/test_condarc.yml
init-shell: >-
bash
powershell
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python-version }}

# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore

- name: install dascore with docbuild reqs
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install -e .[docs]
python -m pip install -e .[docs,all]

- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
Expand Down
29 changes: 10 additions & 19 deletions .github/workflows/run_min_dep_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
paths:
- 'pyproject.toml'
- '**.py'
- '.github/workflows/runtests.yml'
- '.github/workflows/run_min_dep_tests.yml'

env:
# used to manually trigger cache reset. Just increment if needed.
Expand All @@ -29,10 +29,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

python-version: ['3.12']
python-version: ['3.12', '3.13']

# only run if CI isn't turned off
if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci')
Expand All @@ -50,7 +48,6 @@ jobs:
run: |
git fetch --tags --force # Retrieve annotated tags.

# Have to use conda to install hdf5 so mac (I guess m1/2) runners work.
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '2.0.2-1' # versions: https://github.com/mamba-org/micromamba-releases
Expand All @@ -64,35 +61,29 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}

# Not sure why this is needed but it appears to be the case
# Not sure why this is needed but it appears to be the case.
# Also installs pytables so hdf5 gets installed on windows
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore

- name: print python version
shell: bash -el {0}
run: |
python --version

- name: install hdf5
if: matrix.os=='macos-latest'
shell: bash -l {0}
run: |
micromamba install pytables

- name: install dascore
shell: bash -l {0}
run: |
python -m pip install -e .[test]
# Then switch over to uv. We can use this exclusively once we drop pytables.
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: set data cache path
shell: bash -l {0}
run: |
export PATH="$pythonLocation:$PATH"
echo "DATA_CACHE_PATH=$(python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV
echo "DATA_CACHE_PATH=$(uv run --extra test python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV

- name: cache test data
uses: actions/cache@v3
Expand All @@ -103,9 +94,9 @@ jobs:

- name: run test suite
shell: bash -l {0}
run: ./.github/test_code.sh
run: uv run --extra test --python ${{ matrix.python-version }} pytest -s --cov dascore --cov-append --cov-report=xml

# Runs examples in docstrings
- name: test docstrings
shell: bash -l {0}
run: ./.github/test_code.sh doctest
run: uv run --extra test --python ${{ matrix.python-version }} pytest dascore --doctest-modules
2 changes: 1 addition & 1 deletion .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

env:
# used to manually trigger cache reset. Just increment if needed.
CACHE_NUMBER: 2
CACHE_NUMBER: 1

# Cancel previous runs when this one starts.
concurrency:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ docs/**/*.ipynb
# misc
scratch/**
.ruff_cache
uv.lock

docs/index_files
docs/index.quarto_ipynb
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ extras = [
"findiff",
"obspy",
"numba",
"segyio",
"segyio",
]

docs = [
Expand Down
4 changes: 3 additions & 1 deletion tests/test_utils/test_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def testfun1():
assert "Parameters" in testfun1.__doc__
line = next(x for x in testfun1.__doc__.split("\n") if "Parameters" in x)
base_spaces = line.split("Parameters")[0]
assert len(base_spaces) == 12
# py3.13+ automatically strips white space from docstrings so 12
# and 0 are valid lengths.
assert len(base_spaces) in {12, 0}

def test_list_indent(self):
"""Ensure lists are indented equally."""
Expand Down
Loading