-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate formatter and linter to ruff #72
Migrate formatter and linter to ruff to be more compatible with aiida-core 2.6 version and simplify development as ruff can fix most linter errors.
- Loading branch information
Showing
57 changed files
with
1,365 additions
and
1,594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
name: cd | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+* | ||
|
||
jobs: | ||
|
||
validate-release-tag: | ||
validate-release-tag: | ||
|
||
if: github.repository == 'aiidateam/aiida-restapi' | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'aiidateam/aiida-restapi' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Validate the tag version against the package version | ||
run: python .github/workflows/validate_release_tag.py $GITHUB_REF | ||
- name: Validate the tag version against the package version | ||
run: python .github/workflows/validate_release_tag.py $GITHUB_REF | ||
|
||
publish: | ||
publish: | ||
|
||
name: Publish to PyPI | ||
needs: [validate-release-tag] | ||
runs-on: ubuntu-latest | ||
name: Publish to PyPI | ||
needs: [validate-release-tag] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install flit | ||
run: pip install flit~=3.4 | ||
- name: Install flit | ||
run: pip install flit~=3.4 | ||
|
||
- name: Build and publish | ||
run: flit publish | ||
env: | ||
FLIT_USERNAME: __token__ | ||
FLIT_PASSWORD: ${{ secrets.pypi_token }} | ||
- name: Build and publish | ||
run: flit publish | ||
env: | ||
FLIT_USERNAME: __token__ | ||
FLIT_PASSWORD: ${{ secrets.pypi_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,73 +4,73 @@ on: [push, pull_request] | |
|
||
jobs: | ||
|
||
pre-commit: | ||
pre-commit: | ||
|
||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- uses: pre-commit/[email protected] | ||
- uses: pre-commit/[email protected] | ||
|
||
tests: | ||
tests: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11'] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
python-version: ['3.9', '3.10', '3.11'] | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_DB: test_db | ||
POSTGRES_PASSWORD: '' | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
rabbitmq: | ||
image: rabbitmq:latest | ||
ports: | ||
- 5672:5672 | ||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_DB: test_db | ||
POSTGRES_PASSWORD: '' | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
rabbitmq: | ||
image: rabbitmq:latest | ||
ports: | ||
- 5672:5672 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e .[testing,auth] | ||
- name: Install Python dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e .[testing,auth] | ||
- name: Run test suite | ||
env: | ||
- name: Run test suite | ||
env: | ||
# show timings of tests | ||
PYTEST_ADDOPTS: "--durations=0" | ||
AIIDA_WARN_v3: true | ||
run: pytest --cov aiida_restapi --cov-report=xml | ||
PYTEST_ADDOPTS: --durations=0 | ||
AIIDA_WARN_v3: true | ||
run: pytest --cov aiida_restapi --cov-report=xml | ||
|
||
- name: Upload to Codecov | ||
if: matrix.python-version == 3.8 | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
name: pytests | ||
flags: pytests | ||
file: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true | ||
- name: Upload to Codecov | ||
if: matrix.python-version == 3.8 | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
name: pytests | ||
flags: pytests | ||
file: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,73 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: fix-encoding-pragma | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- id: check-json | ||
- id: check-yaml | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: double-quote-string-fixer | ||
- id: end-of-file-fixer | ||
exclude: &exclude_pre_commit_hooks > | ||
(?x)^( | ||
tests/.*(?<!\.py)$| | ||
docs/source/.+\.aiida/repo/.+| | ||
CHANGELOG.md| | ||
)$ | ||
- id: fix-encoding-pragma | ||
args: [--remove] | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
- id: trailing-whitespace | ||
exclude: *exclude_pre_commit_hooks | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: '5.12.0' | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.10.0 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: | ||
- pydantic~=2.0 | ||
- types-python-dateutil | ||
- types-docutils | ||
exclude: > | ||
(?x)^( | ||
docs/.*| | ||
examples/.*| | ||
tests/.*| | ||
conftest.py | ||
)$ | ||
- repo: https://github.com/psf/black | ||
rev: '22.10.0' | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.28.6 | ||
hooks: | ||
- id: check-github-workflows | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.10.0 | ||
hooks: | ||
- id: mypy | ||
additional_dependencies: | ||
- pydantic~=2.0 | ||
- types-python-dateutil | ||
- types-docutils | ||
exclude: > | ||
(?x)^( | ||
docs/.*| | ||
examples/.*| | ||
tests/.*| | ||
conftest.py | ||
)$ | ||
- repo: https://github.com/ikamensh/flynt/ | ||
rev: 1.0.1 | ||
hooks: | ||
- id: flynt | ||
args: [--line-length=120, --fail-on-change] | ||
|
||
- repo: https://github.com/PyCQA/pylint | ||
rev: v3.2.2 | ||
hooks: | ||
- id: pylint | ||
additional_dependencies: | ||
- aiida-core~=2.0 | ||
- fastapi~=0.115.5 | ||
- uvicorn[standard]~=0.19.0 | ||
- pydantic~=2.0 | ||
- graphene~=3.0 | ||
- lark | ||
- python-dateutil~=2.0 | ||
- python-jose | ||
- python-multipart | ||
- passlib | ||
- pytest~=3.6,<5.0.0 | ||
- sphinx<4 | ||
exclude: > | ||
(?x)^( | ||
docs/.*| | ||
)$ | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.5.0 | ||
hooks: | ||
- id: ruff-format | ||
exclude: &exclude_ruff > | ||
(?x)^( | ||
docs/source/topics/processes/include/snippets/functions/parse_docstring_expose_ipython.py| | ||
docs/source/topics/processes/include/snippets/functions/signature_plain_python_call_illegal.py| | ||
)$ | ||
- id: ruff | ||
exclude: *exclude_ruff | ||
args: [--fix, --exit-non-zero-on-fix, --show-fixes] | ||
|
||
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks | ||
rev: v2.13.0 | ||
hooks: | ||
- id: pretty-format-toml | ||
args: [--autofix] | ||
- id: pretty-format-yaml | ||
args: [--autofix] | ||
exclude: >- | ||
(?x)^( | ||
tests/.*| | ||
environment.yml| | ||
)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
"""AiiDA REST API for data queries and workflow managment.""" | ||
|
||
__version__ = "0.1.0a1" | ||
__version__ = '0.1.0a1' | ||
|
||
from .main import app | ||
from .main import app # noqa: F401 |
Oops, something went wrong.