Skip to content

Commit

Permalink
use ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasibalic committed Dec 26, 2024
1 parent 947b469 commit 2ea2f8e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
36 changes: 17 additions & 19 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,43 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest black "black[jupyter]"
pip install build
- name: Check
uv venv
uv pip install . --extra dev
- name: Lint and format check
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --version
flake8 . --count --show-source --statistics
black --version
black -l 80 . --check
python -m compileall -f arc/*.py
uvx ruff check
uv run python -m compileall -f arc/*.py
- name: Typing check
run: |
uv run mypy .
function_test:
name: Basic test suite
runs-on: ubuntu-latest
needs: [format_test]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
python-version: 3.12
python-version: ${{ matrix.python-version }}
- name: Setup ARC
run: |
pip install .
pip install pytest coverage
pytest --version
uv venv
uv pip install . --extra dev
- name: Run tests
run:
coverage run -m pytest -s -v
uv run coverage run -m pytest -s -v
- name: Coverage report
run:
coverage report -m
uv run coverage report -m

build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand Down
13 changes: 8 additions & 5 deletions doc/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,15 @@ Finally, this is the naming convention. of the original package. For consistency
Code format
-----------

Please run ``black`` in the repository folder fixing line length to 80 characters::
Please run install `uv` and run linter::

black -l 80 .
pip install uv
uvx ruff format
uvx ruff check

And then run linter
and resolve any errors that appear there before submitting code.

flake8 .
Optionally also check typing::

and resolve any erros that appear there before submitting code.
uv pip install mypy
uv run mypy .
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ Repository = "https://github.com/nikolasibalic/ARC-Alkali-Rydberg-Calculator"
Documentation = "https://arc-alkali-rydberg-calculator.readthedocs.io/en/latest/"
Download = "https://github.com/nikolasibalic/ARC-Alkali-Rydberg-Calculator/archive/refs/tags/v3.6.0.tar.gz"

[dependency-groups]
dev = [
"mypy>=1.14.0",
]

[tool.cibuildwheel]
skip = ["*-win32", "*-manylinux_i686", "*-musllinux_i686" ,"pp*"]

[tool.mypy]
disable_error_code = ["import-untyped"]
disable_error_code = ["import-untyped", "import-not-found"]

[tool.ruff]
# Exclude a variety of commonly ignored directories.
Expand Down

0 comments on commit 2ea2f8e

Please sign in to comment.