diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 6b24a6b..0000000 --- a/.flake8 +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 88 -ignore = E203 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cd71bd2..6d58896 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,7 +32,7 @@ jobs: - name: Install project run: | python -m pip install --upgrade pip - pip install '.[dev,examples]' + pip install '.[dev]' - name: Lint - run: pre-commit run --all-files + run: ruff check diff --git a/.github/workflows/typing.yml b/.github/workflows/typing.yml new file mode 100644 index 0000000..01bf1d4 --- /dev/null +++ b/.github/workflows/typing.yml @@ -0,0 +1,40 @@ +name: Typing + +on: + push: + branches: [ main ] + + pull_request: + branches: [ main ] + + # Allow job to be triggered manually. + workflow_dispatch: + +# Cancel in-progress jobs when pushing to the same branch. +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + +jobs: + typing: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + architecture: x64 + cache: pip + + - name: Install project + run: | + python -m pip install --upgrade pip + pip install '.[dev]' + + - name: Typing + run: | + mypy src --ignore-missing-imports + mypy tests --ignore-missing-imports \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index a14449a..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,18 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - args: ["--maxkb=1000"] - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 - hooks: - - id: mypy - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.9 - hooks: - - id: ruff - - id: ruff-format diff --git a/README.md b/README.md index b398e0c..1157948 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,25 @@ To run the unit tests: pytest ``` +To format the code: + +```shell +ruff format +``` + +To lint the code: + +```shell +ruff check +``` + +To check typing: + +```shell +mypy src --ignore-missing-imports +mypy tests --ignore-missing-imports +``` + ## Release To cut a new release of **pyisd** (assuming you have the appropriate permissions): diff --git a/pyproject.toml b/pyproject.toml index 9a250fc..3fb7dd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ dependencies = ["click~=8.0", "pandas~=1.3"] isd = "isd.cli:main" [project.optional-dependencies] -dev = ["mypy~=1.2", "pre-commit~=3.2", "pytest~=7.4", "ruff~=0.1.9"] +dev = ["mypy~=1.2", "pytest~=7.4", "ruff~=0.1.9"] examples = ["tqdm~=4.66"] docs = ["sphinx~=7.2"]