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
16 changes: 6 additions & 10 deletions .github/workflows/Docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
python-version: 3.x

- name: Install
run: |
pip install -r docs/requirements.yml
pip install -e .
python-version: "3.12"
enable-cache: true

- name: Build Docs
run: mkdocs build
run: make docs

# Only deploy if main, otherwise just build for testing
- name: Deploy
if: endsWith(github.ref, '/main')
run: mkdocs gh-deploy --force
run: uv run --with ".[docs]" mkdocs gh-deploy --force
59 changes: 9 additions & 50 deletions .github/workflows/Linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,71 +9,30 @@ on:
jobs:
mypy:
name: MyPy
strategy:
fail-fast: false
matrix:
python-version: [3.12]
environment: ["min-deps"]

runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
channel-priority: true
activate-environment: test
environment-file: devtools/conda-envs/${{ matrix.environment }}-environment.yaml

- name: Environment Information
run: |
conda info
conda list
conda config --show-sources
conda config --show

- name: Install
run: python -m pip install . --no-deps
python-version: "3.12"
enable-cache: true

- name: MyPy
run: mypy opt_einsum
run: make mypy

ruff:
name: Ruff
strategy:
fail-fast: false
matrix:
python-version: [3.12]
environment: ["min-deps"]

runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
channel-priority: true
activate-environment: test
environment-file: devtools/conda-envs/${{ matrix.environment }}-environment.yaml

- name: Environment Information
run: |
conda info
conda list
conda config --show-sources
conda config --show
python-version: "3.12"
enable-cache: true

- name: Lint
run: |
set -e
make fmt-check
run: make format-check
59 changes: 22 additions & 37 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,46 @@ on:
branches: main

jobs:
miniconda-setup:
name: Env
tests:
name: ${{ matrix.extras }}${{ matrix.python-extras && format('+{0}', matrix.python-extras) || '' }} / py${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
include:
- python-version: 3.8
environment: "min-deps"
- python-version: 3.12
environment: "min-deps"
- python-version: 3.9
environment: "min-ver"
- python-version: 3.11
environment: "full"
- python-version: 3.12
environment: "torch-only"
- python-version: "3.12"
extras: "test,lint"
- python-version: "3.14"
extras: "test,lint"
- python-version: "3.12"
extras: "test,lint,numpy"
- python-version: "3.12"
extras: "test,lint,numpy,dask"
- python-version: "3.13"
extras: "test,lint,numpy,dask,jax,sparse"
- python-version: "3.13"
extras: "test,lint,torch"
# - python-version: "3.12"
# extras: "test,lint"
# python-extras: "tensorflow"

runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}

steps:
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v3
- uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
channel-priority: true
activate-environment: test
environment-file: devtools/conda-envs/${{ matrix.environment }}-environment.yaml

- name: Environment Information
run: |
conda info
conda list
conda config --show-sources
conda config --show

- name: Check no NumPy for torch-only environment
if: matrix.environment == 'torch-only'
run: |
python devtools/ci_scripts/check_no_numpy.py
enable-cache: true

- name: Install
run: |
python -m pip install . --no-deps
run: uv pip install -e ".[${{ matrix.extras }}]" ${{ matrix.python-extras }}

- name: Test
run: |
pytest -v --cov=opt_einsum opt_einsum/ --cov-report=xml
run: uv run --no-sync pytest -v --cov=opt_einsum/ --cov-report=xml

- name: Coverage
run: |
coverage report
run: uv run --no-sync coverage report

- uses: codecov/codecov-action@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Hatch replaces this file
opt_einsum/_version.py

# UV Lockfile
uv.lock

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
31 changes: 11 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
.DEFAULT_GOAL := all

.PHONY: install
install:
pip install -e .
.PHONY: format
format:
uv run --with ".[lint]" ruff check opt_einsum --fix
uv run --with ".[lint]" ruff format opt_einsum

.PHONY: fmt
fmt:
ruff check opt_einsum --fix
ruff format opt_einsum

.PHONY: fmt-unsafe
fmt-unsafe:
ruff check opt_einsum --fix --unsafe-fixes
ruff format opt_einsum

.PHONY: fmt-check
fmt-check:
ruff check opt_einsum
ruff format --check opt_einsum
.PHONY: format-check
format-check:
uv run --with ".[lint]" ruff check opt_einsum
uv run --with ".[lint]" ruff format --check opt_einsum

.PHONY: mypy
mypy:
mypy opt_einsum
uv run --with ".[test,lint]" mypy opt_einsum

.PHONY: test
test:
pytest -v --cov=opt_einsum/
uv run --with ".[test]" pytest -v --cov=opt_einsum/ --cov-report=xml

.PHONY: docs
docs:
mkdocs build
uv run --with ".[docs]" mkdocs build
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,26 @@ Please see the [documentation](https://dgasmith.github.io/opt_einsum/index) for

## Installation

`opt_einsum` can either be installed via `pip install opt_einsum` or from conda `conda install opt_einsum -c conda-forge`.
`opt_einsum` can be installed via pip:

```bash
pip install opt_einsum
```

or with [uv](https://github.com/astral-sh/uv):

```bash
uv pip install opt_einsum
```

It is also available on conda-forge: `conda install opt_einsum -c conda-forge`.

For development, clone the repository and install with optional extras:

```bash
uv pip install -e ".[dev]"
```

See the installation [documentation](https://dgasmith.github.io/opt_einsum/getting_started/install) for further methods.

## Citation
Expand Down
5 changes: 0 additions & 5 deletions devtools/ci_scripts/check_no_numpy.py

This file was deleted.

22 changes: 0 additions & 22 deletions devtools/conda-envs/full-environment.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions devtools/conda-envs/min-deps-environment.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions devtools/conda-envs/min-ver-environment.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions devtools/conda-envs/torch-only-environment.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions docs/requirements.yml

This file was deleted.

Loading
Loading