Skip to content

Commit

Permalink
Add mypy to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Mar 18, 2024
1 parent eb73969 commit 9ef775f
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 361 deletions.
9 changes: 9 additions & 0 deletions .github/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ then
exit 1
fi

# Run `mypy` for python type checking
if ! poetry run mypy .
then
echo ""
echo "There are some python code style issues."
echo "Run `ruff format` first."
exit 1
fi

# Run `ruff` python linting
if ! poetry run ruff check
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
jobs:
check:
runs-on: ubuntu-latest
name: check python
name: check python (3.10)
steps:
- name: Do nothing
run: echo "This is a dummy step to return a valid status check"
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: poetry install

- name: Type check with mypy
run: poetry run mypy guppylang
run: poetry run mypy .

- name: Check formatting with ruff
run: poetry run ruff format --check
Expand Down
418 changes: 71 additions & 347 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ package-mode = false
python = "^3.10"

[tool.poetry.group.dev.dependencies]
pytket = "*"
pytest = "^7.1.2"
pytest = "^8.1.1"
pytest-cov = "^4.1.0"
ruff = "^0.1.3"
mypy = "^1.9.0"
ruff = "^0.3.3"

[tool.poetry.group.quantinuum-hugr.dependencies]
quantinuum-hugr = { path = "quantinuum-hugr-py", develop = true }
Expand Down
6 changes: 3 additions & 3 deletions quantinuum-hugr-py/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
quantinuum-hugr
quantinuum_hugr
===============

[![build_status][]](https://github.com/CQCL/hugr/actions)
Expand All @@ -22,10 +22,10 @@ The HUGR specification is [here](https://github.com/CQCL/hugr/blob/main/specific

## Install

`quantinuum-hugr` can be installed via `pip`. Requires Python >= 3.10.
`quantinuum_hugr` can be installed via `pip`. Requires Python >= 3.10.

```sh
pip install quantinuum-hugr
pip install quantinuum_hugr
```

## Usage
Expand Down
6 changes: 0 additions & 6 deletions quantinuum-hugr-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ repository = "https://github.com/CQCL/hugr"
[tool.poetry.dependencies]
python = ">=3.10"

[tool.poetry.group.dev.dependencies]
pytket = "*"
pytest = "^7.1.2"
pytest-cov = "^4.1.0"
ruff = "^0.1.3"

[tool.pytest.ini_options]
# Lark throws deprecation warnings for `src_parse` and `src_constants`.
filterwarnings = "ignore::DeprecationWarning:lark.*"

0 comments on commit 9ef775f

Please sign in to comment.