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
52 changes: 18 additions & 34 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,55 @@
name: testing

on:
push:
branches: [main, develop]
branches: [develop]
pull_request:
branches: [main, develop]

branches: [develop]
env:
PYTHON_VERSION: "3.12"
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

# https://github.com/actions/cache/blob/main/examples.md#python---pip
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-

- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]

uv sync --extra testing
- name: Test with pytest
run: |
python -m pytest -v --cov=spinspg --cov-report=xml tests/

uv run pytest -v --cov=spinspg --cov-report=xml tests/
- name: Upload coverage reports to Codecov
if: matrix.python-version == '3.10'
if: matrix.python-version == ${{ env.PYTHON_VERSION }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: actions/setup-python@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"

enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
sudo apt-get install -y pandoc

- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .[dev,docs]

uv sync --extra docs
- name: Build
run: |
sphinx-build docs docs_build
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ target/
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
14 changes: 9 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.6.12
hooks:
- id: uv-lock
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -10,20 +12,22 @@ repos:
- id: check-json
- id: debug-statements
- id: end-of-file-fixer
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.34.0
hooks:
- id: check-github-workflows
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.5
hooks:
- id: ruff-format
- id: ruff
args: [ "--fix", "--show-fixes"]
types_or: [python, pyi]
# type annotation
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
hooks:
- id: mypy
exclude: ^docs/
# Notebook
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
Expand Down
26 changes: 12 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description = "Python package for detecting spin space group on top of spglib"
authors = [
{name = "Kohei Shinohara", email = "kshinohara0508@gmail.com"},
]
requires-python = ">=3.9.0"
requires-python = ">=3.10.0"
license = {file = "LICENSE"}
classifiers = [
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand All @@ -22,10 +22,10 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
]
Expand All @@ -45,14 +45,10 @@ homepage = "https://github.com/spglib/spinspg"
repository = "https://github.com/spglib/spinspg"

[project.optional-dependencies]
dev = [
"spgrep-modulation>=0.2.5",
testing = [
"pytest",
"pytest-cov",
"pre-commit",
"black",
"mypy",
"toml",
]
docs = [
"importlib-metadata",
Expand All @@ -63,6 +59,15 @@ docs = [
"linkify-it-py",
"enum-tools[sphinx]",
]
dev = [
"spinspg[testing]",
"spinspg[docs]",
"spgrep-modulation>=0.2.5",
"toml",
]

[dependency-groups]
dev = [ "spinspg[dev]" ]

###############################################################################
# Setuptools
Expand All @@ -71,13 +76,6 @@ docs = [
[tool.setuptools]
zip-safe = false

# packages = find
# package-dir = {"" = "src"}
#
# [tool.setuptools.packages.find]
# where = ["src"]
# include = ["spinspg"]

###############################################################################
# Other tools
###############################################################################
Expand Down
6 changes: 4 additions & 2 deletions src/spinspg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

from __future__ import annotations

from typing import Any
from typing import (
Any,
TypeAlias, # for Python<3.10
)

import numpy as np
from numpy.typing import NDArray
from typing_extensions import TypeAlias # for Python<3.10

NDArrayInt: TypeAlias = NDArray[np.int_]
NDArrayFloat: TypeAlias = NDArray[np.float64]
Expand Down
Loading