Skip to content
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
105 changes: 73 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,60 @@ jobs:
steps:
- checkout
- run:
name: Install dependencies
name: Install Git
command: |
apt-get update && apt-get install -y git
- run:
name: Install uv
command: |
pip install uv
uv venv --python 3.10
- restore_cache:
keys:
- uv-cache-pytest-{{ checksum "uv.lock" }}
- uv-cache-pytest-
- run:
name: Run pytest
no_output_timeout: 20m
command: |
source .venv/bin/activate
uv pip install -e '.[dev,aws,spark]'
uv sync --group dev --group aws --group spark
export GIT_PYTHON_REFRESH=quiet
pytest -k "not test_autonlinear_longer_horizon"
uv run pytest -k "not test_autonlinear_longer_horizon" --no-cov
- save_cache:
key: uv-cache-pytest-{{ checksum "uv.lock" }}
paths:
- ~/.cache/uv
- .venv
test-model-performance:
resource_class: xlarge
docker:
- image: python:3.10-slim
steps:
- checkout
- run:
name: Install dependencies
name: Install Git
command: |
apt-get update && apt-get install -y git
- run:
name: Install uv
command: |
pip install uv
uv venv --python 3.10
- restore_cache:
keys:
- uv-cache-perf-{{ checksum "uv.lock" }}
- uv-cache-perf-
- run:
name: Run model performance tests
command: |
source .venv/bin/activate
uv pip install -e '.[dev,aws,spark]'
cd ./action_files/test_models/
uv pip install -r requirements.txt
python -m src.models
python -m src.evaluation
cd ../../
uv sync --group dev --group aws --group spark
uv pip install -r ./action_files/test_models/requirements.txt
export PYTHONPATH="${PYTHONPATH}:./action_files/test_models"
uv run python -m src.models
uv run python -m src.evaluation
- save_cache:
key: uv-cache-perf-{{ checksum "uv.lock" }}
paths:
- ~/.cache/uv
- .venv
- store_artifacts:
path: ./action_files/test_models/data/evaluation.csv
destination: evaluation.csv
Expand All @@ -50,20 +71,30 @@ jobs:
steps:
- checkout
- run:
name: Install dependencies
name: Install Git
command: |
apt-get update && apt-get install -y git
- run:
name: Install uv
command: |
pip install uv
uv venv --python 3.10
- restore_cache:
keys:
- uv-cache-perf-{{ checksum "uv.lock" }}
- uv-cache-perf-
- run:
name: Run model performance tests
command: |
source .venv/bin/activate
uv pip install -e '.[dev,aws,spark]'
cd ./action_files/test_models/
uv pip install -r requirements.txt
python -m src.models2
python -m src.evaluation2
cd ../../
uv sync --group dev --group aws --group spark
uv pip install -r ./action_files/test_models/requirements.txt
export PYTHONPATH="${PYTHONPATH}:./action_files/test_models"
uv run python -m src.models2
uv run python -m src.evaluation2
- save_cache:
key: uv-cache-perf-{{ checksum "uv.lock" }}
paths:
- ~/.cache/uv
- .venv
- store_artifacts:
path: ./action_files/test_models/data/evaluation.csv
destination: evaluation.csv
Expand All @@ -74,20 +105,30 @@ jobs:
steps:
- checkout
- run:
name: Install dependencies
name: Install Git
command: |
apt-get update && apt-get install -y git
- run:
name: Install uv
command: |
pip install uv
uv venv --python 3.10
- restore_cache:
keys:
- uv-cache-perf-{{ checksum "uv.lock" }}
- uv-cache-perf-
- run:
name: Run model performance tests
command: |
source .venv/bin/activate
uv pip install -e '.[dev,aws,spark]'
cd ./action_files/test_models/
uv pip install -r requirements.txt
python -m src.multivariate_models
python -m src.multivariate_evaluation
cd ../../
uv sync --group dev --group aws --group spark
uv pip install -r ./action_files/test_models/requirements.txt
export PYTHONPATH="${PYTHONPATH}:./action_files/test_models"
uv run python -m src.multivariate_models
uv run python -m src.multivariate_evaluation
- save_cache:
key: uv-cache-perf-{{ checksum "uv.lock" }}
paths:
- ~/.cache/uv
- .venv
- store_artifacts:
path: ./action_files/test_models/data/multi_evaluation.csv
destination: multi_evaluation.csv
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,22 @@ jobs:
with:
python-version: '3.10'

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: pip install uv pytest && uv pip install --system '.[dev,aws,spark,docs]'
run: uv sync --group dev --group aws --group spark

# setup quarto for rendering example/tutorial nbs
- uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.4.515

- name: Build Docs
run: make all_docs
run: uv run make all_docs

- name: Deploy (Push to main or Pull Request from same repo)
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging')
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ jobs:
with:
python-version: "3.10"

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: pip install black "fastcore<1.8.0" nbdev==2.3.25 pre-commit
run: uv sync --group dev

- name: Run pre-commit
run: pre-commit run --files neuralforecast/*
run: uv run pre-commit run --files neuralforecast/*
12 changes: 9 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: pip install uv pytest && uv pip install --system ".[dev]" --torch-backend cpu
run: uv sync --group dev --group aws --group spark

- name: Override torch and numpy version on MacOS due to compatibility issues with MPS in github runners on newer MacOS versions
if: matrix.os == 'macos-13' || matrix.os == 'macos-14-xlarge'
Expand All @@ -43,8 +49,8 @@ jobs:
env:
PYTORCH_ENABLE_MPS_FALLBACK: 1
PYTORCH_MPS_HIGH_WATERMARK_RATIO: 0.0
run: pytest --ignore tests/test_common --ignore tests/test_models --ignore tests/test_core.py --no-cov
run: uv run pytest --ignore tests/test_common --ignore tests/test_models --ignore tests/test_core.py --no-cov

- name: Run pytest (ubuntu and windows)
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest')
run: pytest
run: uv run pytest
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ source .venv/bin/activate
.\.venv\Scripts\activate
```

Now, install the library. Make sure to specify the desired [PyTorch backend](https://docs.astral.sh/uv/reference/cli/#uv-pip-install--torch-backend):
Now, install the library. Make sure to specify the desired [PyTorch backend](https://docs.astral.sh/uv/reference/cli/#uv-sync--torch-backend):

```bash
uv pip install -e ".[dev]" --torch-backend auto # uv will decide the optimal backend automatically
uv pip install -e ".[dev]" --torch-backend cpu # for cpu backend
uv pip install -e ".[dev]" --torch-backend cu118 # for CUDA 11.8 PyTorch backend
uv sync --group dev --torch-backend auto # uv will decide the optimal backend automatically
uv sync --group dev --torch-backend cpu # for cpu backend
uv sync --group dev --torch-backend cu118 # for CUDA 11.8 PyTorch backend
```

You can install other optional dependencies:

```sh
uv pip install -e ".[dev,aws,spark]"
uv sync --group dev --group aws --group spark
```

#### Install pre-commit hooks
Expand Down Expand Up @@ -185,7 +185,7 @@ For additional instructions, see the [Mintlify installation guide](https://mintl
**Install documentation dependencies:**

```sh
uv pip install -e ".[dev,aws,spark,docs]"
uv sync --group dev --group aws --group spark
```

**Generate documentation:**
Expand Down
23 changes: 18 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"utilsforecast>=0.2.3",
]

[project.optional-dependencies]
[dependency-groups]
spark = ["fugue", "pyspark>=3.5"]
aws = ["fsspec[s3]"]
dev = [
Expand All @@ -56,10 +56,8 @@ dev = [
"xlstm",
"pytest",
"pytest-cov",
"pip-licenses"
]
docs = [
"mkdocstrings-parser@git+https://github.com/Nixtla/mkdocstrings-parser.git"
"pip-licenses",
"mkdocstrings-parser @ git+https://github.com/Nixtla/mkdocstrings-parser"
]

[project.urls]
Expand Down Expand Up @@ -92,3 +90,18 @@ addopts = [
"--cov-report=html",
"--cov-fail-under=80",
]

[tool.coverage.run]
source = ["neuralforecast"]
omit = [
"*/tmp/ray/*",
"*/_ray_pkg_*/*",
"*/runtime_resources/*",
]

[tool.coverage.report]
omit = [
"*/tmp/ray/*",
"*/_ray_pkg_*/*",
"*/runtime_resources/*",
]
Loading