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

Bump actions/checkout from 3 to 4 #4

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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: 16 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
exclude =
.git,
__pycache__,
env,
venv,
build,
dist
docstring-convention = numpy
max-line-length = 100
max_complexity = 15
max_function_length = 100
ignore = D100, D102, D103, D104, W503
# for compatibility with black
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
extend-ignore = E203
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Documentation
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: weekly
33 changes: 33 additions & 0 deletions .github/workflows/system_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: system test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: [main]
pull_request:
branches: ['*']

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dev
run: |
python -m pip install --upgrade pip
pip install .[dev]
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: [main]
pull_request:
branches: ['*']

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Run tests and coverage
run: make coverage
- name: Code coverage
uses: codecov/codecov-action@v3
with:
file: coverage.xml
flags: ${{ matrix.os }}-${{ matrix.python-version }}
name: codecov
fail_ci_if_error: false
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pt
archive
72 changes: 72 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks # Detect common mistake of using single backticks when writing rst
- id: rst-inline-touching-normal # Detect mistake of inline code touching normal text in rst

- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/ikamensh/flynt/
rev: 1.0.0
hooks:
- id: flynt

- repo: https://github.com/asottile/reorder-python-imports
rev: v3.10.0
hooks:
- id: reorder-python-imports
args: [--py38-plus, --add-import, from __future__ import annotations]

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.3.0
# hooks:
# - id: mypy
# additional_dependencies: [types-all]
# files: bidspm
# args: [--config-file, setup.cfg]

- repo: https://github.com/MarcoGorelli/auto-walrus
rev: v0.2.2
hooks:
- id: auto-walrus

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--mapping, '2', --sequence, '2', --offset, '0']

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
args: [--toml, pyproject.toml]
additional_dependencies: [tomli]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
args: [--config, pyproject.toml]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args: [--config, .flake8]
additional_dependencies: [flake8-docstrings]
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
coverage erase
coverage run -m pytest
coverage report
coverage html
coverage xml
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion EquationTokenizer.py → NumGI/EquationTokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,4 @@ def defaultTokenizer():

dict_size = len(tokenize_dict)

return tokenize_dict, decode_dict, tokenize, decode
return tokenize_dict, decode_dict, tokenize, decode
48 changes: 48 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "NumGI"
description = "Differential equation solver."
readme = "README.md"
requires-python = ">=3.8"
license = { file = "LICENSE.txt" }
authors = [{ name = "Arnaud Bergeron", email = "[email protected]" }]
dynamic = ["version"]
dependencies = ["sympy", "torch", "NumGI", "Numba"]

[project.optional-dependencies]
doc = [
"sphinx",
"sphinx-argparse",
"sphinx-copybutton",
"sphinx_rtd_theme",
"myst-parser",
"rstcheck",
]



[tool.hatch.build.targets.wheel]
packages = ["NumGI"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "NumGI/_version.py"

[tool.pytest.ini_options]
addopts = "-ra -vv"

[tool.coverage.run]
branch = true
source = ["NumGI/"]


[tool.codespell]
skip = "./.git,.mypy_cache,env,venv,tests,*bval,*bvec"

[tool.black]
line-length = 100