Skip to content
Closed
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/publish_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ jobs:
env:
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.10"
cache: "pip"
- run: pip install -e '.[dev]'
- run: python -m build
- run: twine upload
-u __token__
-p ${{ secrets.PYPI_API_TOKEN }}
dist/*
enable-cache: true
python-version-file: "pyproject.toml"
- run: uv build
- run: uv publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }}
155 changes: 80 additions & 75 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,78 +1,83 @@
name: Tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: ruff on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -e '.[dev]'
- run: ruff check .
mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: mypy on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -e '.[dev]'
- run: mypy .
ruff-format:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: ruff-format on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -e '.[dev]'
- run: ruff format --check .
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: pytest on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -e '.[dev]'
- run: pytest --cov=src --cov-report term-missing
doctest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: doctest on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -e '.[dev]'
- run: make -C docs doctest
ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: ruff on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run ruff check .

mypy:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: mypy on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run mypy .

ruff-format:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: ruff-format on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run ruff format --check .

pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: pytest on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run pytest

doctest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
name: doctest on ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- run: uv sync --all-extras --dev
- run: uv run make -C docs doctest
24 changes: 13 additions & 11 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/source/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- dev
build:
os: ubuntu-24.04
tools:
python: "3.13"
jobs:
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --extra dev
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ How to get started
------------------

We suggest you give a read to the ``dynsight.trajectory`` module documentation,
which offers a compact and easy way of using most of the ``dynsight`` tools.
which offers a compact and easy way of using most of the ``dynsight`` tools.
Also, the documentation offers some copiable Recipes and Examples for the most
common analyses.

Expand All @@ -60,14 +60,17 @@ Developer Setup
---------------

#. Install `just`_.
#. Install `uv <https://docs.astral.sh>`_
#. In a new virtual environment run::

$ just dev
$ just setup


#. Run code checks::

$ just check


.. _`just`: https://github.com/casey/just

Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_static/recipes/info_gain.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def info_gain_with_onion(
tmp_entr.append(
dynsight.analysis.compute_shannon(
selected_points,
data_range,
data_range, # type: ignore[arg-type]
n_bins=n_bins,
)
)
Expand Down
5 changes: 3 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ How to get started
------------------

We suggest you give a read to the ``dynsight.trajectory`` module documentation,
which offers a compact and easy way of using most of the ``dynsight`` tools.
which offers a compact and easy way of using most of the ``dynsight`` tools.
Also, the documentation offers some copiable Recipes and Examples for the most
common analyses.

Expand All @@ -98,9 +98,10 @@ Developer Setup
---------------

#. Install `just`_.
#. Install `uv <https://docs.astral.sh>`_
#. In a new virtual environment run::

$ just dev
$ just setup


#. Run code checks::
Expand Down
32 changes: 16 additions & 16 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
default:
@just --list

# Build docs.
docs:
rm -rf docs/build docs/source/_autosummary
make -C docs html
echo Docs are in $PWD/docs/build/html/index.html

# Do a dev install.
dev:
pip install -e '.[dev]'
setup:
uv sync --all-extras --dev

# Run code checks.
check:
Expand All @@ -20,27 +14,33 @@ check:
trap error=1 ERR

echo
(set -x; ruff check . )
( set -x; uv run ruff check . )

echo
( set -x; ruff format --check . )
( set -x; uv run ruff format --check . )

echo
( set -x; mypy . )
( set -x; uv run mypy . )

echo
( set -x; pytest --cov=src --cov-report term-missing )
( set -x; uv run pytest --cov=src --cov-report term-missing )

echo
( set -x; make -C docs doctest )
( set -x; uv run make -C docs doctest )

test $error = 0

# Auto-fix code issues.
fix:
ruff format .
ruff check --fix .
uv run ruff format .
uv run ruff check --fix .

# Build a release.
build:
python -m build
uv build

# Build docs.
docs:
rm -rf docs/source/_autosummary
uv run make -C docs html
echo Docs are in $PWD/docs/build/html/index.html
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ maintainers = [
]

dependencies = [
"numpy",
"numpy<2",
"dscribe",
"tropea-clustering",
"MDAnalysis",
Expand All @@ -22,7 +22,7 @@ dependencies = [
]

# Set by cpctools.
requires-python = ">=3.8"
requires-python = ">=3.9"
dynamic = ["version"]
readme = "README.rst"
description = "Simplifies analysis of simulation and experimental trajectories."
Expand Down
7 changes: 6 additions & 1 deletion src/dynsight/_internal/utilities/utilities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from collections.abc import Mapping, Sequence

from pathlib import Path
from typing import Callable, Literal, Mapping, Sequence
from typing import Callable, Literal

import numpy as np
import numpy.typing as npt
Expand Down
Loading