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

Test against Python 3.11 and 3.12 #43

Merged
merged 5 commits into from
Mar 21, 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
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.9", "3.10"]
python-version: ["3.10", "3.11", "3.12"]
defaults:
run:
shell: bash -l {0}
Expand Down Expand Up @@ -121,18 +121,18 @@ jobs:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: 3.10
- name: Install dependencies
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
environment-file: envs/testing.yml
python-version: 3.9
python-version: 3.10
activate-environment: testing-env
auto-activate-base: false
auto-update-conda: false
Expand Down
3 changes: 2 additions & 1 deletion envs/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dependencies:
- nbmake
- openmatrix
- zarr
- larch>=5.7.1
- pip:
- larch6
5 changes: 4 additions & 1 deletion sharrow/nested_logit.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ def construct_nesting_tree(alternatives, nesting_settings):
-------
NestingTree
"""
from larch.model.tree import NestingTree
try:
from larch.model.tree import NestingTree
except ImportError:
raise ImportError("larch is required to construct nesting trees") from None

if not isinstance(alternatives, Mapping):
alt_names = list(alternatives)
Expand Down
5 changes: 4 additions & 1 deletion sharrow/omx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ def split_omx(source_file, dest_directory, global_lookups=False, n_chunks=None):
global_lookups : bool

"""
from larch import OMX
try:
from larch import OMX
except ImportError:
raise ImportError("larch is required to split OMX files") from None

source = OMX(source_file, mode="r")
os.makedirs(dest_directory, exist_ok=True)
Expand Down
6 changes: 5 additions & 1 deletion sharrow/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pandas as pd
import xarray as xr
from larch import OMX

from sharrow.dataset import Dataset

Expand All @@ -21,6 +20,11 @@ def omx_to_zarr(
time_periods=None,
time_period_sep="__",
):
try:
from larch import OMX
except ImportError:
raise ImportError("larch is required to read OMX files") from None

bucket = {}

r1 = r2 = None
Expand Down