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

CI PR #5: Complete the transition from pyre to pyright #147

Open
wants to merge 13 commits into
base: master
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
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: '3.6'
os: ubuntu-20.04
- python-version: '3.10'
os: ubuntu-22.04
- python-version: '3.11'
Expand Down
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ repos:
- toml
- repo: local
hooks:
- id: run-pyre
name: run-pyre (expect this to take 30 seconds)
entry: python pyre_runner.py
types: [python]
language: python
log_file: ".git/pre-commit-pyre.log"
additional_dependencies: [pyre-check,mock]
- id: pytype
name: pytype (may take up to two minutes)
entry: sh -c "pytype >/dev/tty"
Expand Down
6 changes: 4 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ disable=W0142,W0703,C0111,R0201,W0603,W0613,W0212,W0141,
len-as-condition,
no-else-return,
raise-missing-from,
too-many-positional-arguments,
too-many-branches,
too-many-nested-blocks,
too-many-statements,
Expand Down Expand Up @@ -222,8 +223,9 @@ defining-attr-methods=__init__,__new__,setUp

[DESIGN]

# Maximum number of arguments for function / method
max-args=100
# Maximum number of arguments for function / method.
# defaults to: max-args=5
max-args=10

# Argument names that match this expression will be ignored. Default to name
# with leading underscore
Expand Down
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ This project uses `tox` to run the tests for different python versions. Intro:
> A comprehensive beginner's introduction to `tox`":_
> https://www.seanh.cc/2018/09/01/tox-tutorial/

`tox` runs `pytest`, `pylint` and static analysis using `mypy`, `pyre`, `pytype`, and `pyright`.
`tox` runs `pytest`, `pylint` and static analysis using `mypy`, `pytype`, and `pyright`.
Links:

- https://mypy.readthedocs.io/en/stable/
- https://microsoft.github.io/pyright/
- https://google.github.io/pytype/
- https://pyre-check.org/

With `tox`, developers can run the full test suite for Python 2.7 and 3.x.
The same test suite is used in GitHub CI:
Expand All @@ -78,7 +77,7 @@ Using pip-tools, you can extract the requirements and extras from `pyptoject.tom

```bash
PYTHON=python3.10
EXTRAS=.,test,mypy,pyre,pytype,tox
EXTRAS=.,test,mypy,pytype,tox
PFLAGS="--no-warn-conflicts"
$PYTHON -m pip install pip-tools==7.3.0
$PYTHON -m piptools compile --extra=$EXTRAS -o - pyproject.toml |
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The Continuous Integration Tests feature:
- Checking of the combined coverage against the diff to master: Fails if changes are not covered!
- Pylint report in the GitHub Action Summary page, with Warning and Error annotatios, even in the code review.
- Check that changes don't generate pylint warnings (if warning classes which are enabled in .pylintrc)
- Static analysis using `mypy`, `pyre` and `pytype`
- Static analysis using `mypy`, `pylint`, `pyright` and `pytype`

This enforces that any change (besides whitespace):

Expand Down Expand Up @@ -72,7 +72,6 @@ For the installation of the general development dependencies, visit [INSTALL.md]
- Test with `python2.7 -m pytest`
- Run `mypy` (without any arguments - The configuration is in `pyproject.toml`)
- Run `./pytype_runner.py`
- Run `./pyre_runner.py`
- Run `tox -e py36-lint` and fix any `Pylint` warnings
- Run `tox -e py310-covcombine-check` and fix any missing diff-coverage.
- Run `tox` for the full CI test suite
Expand All @@ -86,7 +85,7 @@ The list of `virtualenvs` configured in tox can be shown using this command: `to
$ tox -av
default environments:
py36-lint -> Run in a py36 virtualenv: Run pylint and fail on warnings remaining on lines in the diff to master
py311-pyre -> Run in a py311 virtualenv: Run pyre for static analyis, only passes using: tox -e py311-pyre
py311-pyright -> Run in a py311 virtualenv: Run pyright for static analyis
py38-pytype -> Run in a py38 virtualenv: Run pytype for static analyis, intro: https://youtu.be/abvW0mOrDiY
py310-covcombine-check -> Run in a py310 virtualenv: Generate combined coverage reports with py27-test coverage merged Run mypy for static analyis

Expand All @@ -100,7 +99,7 @@ test -> Run in a python virtualenv: Run pytest in this environ

If you have only one version of Python3, that works too. Use: `tox -e py<ver>-test`

## Static analysis using mypy, pyre, pyright and pytype
## Static analysis using mypy, pylint, pyright and pytype

The preconditions for using static analysis with `mypy` (which passes now but has
only a few type comments) and `pyright` are present now and `mypy` is enabled in `tox`
Expand Down
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ mypy = [
"types-six",
"types-toml",
]
# pyre introduced two false-postives recently, pin it to prevent further surprises:
pyre = [
"pyre-check == 0.9.21",
"pyre-extensions == 0.0.30",
]
pytype = [
"pandas",
"pytype",
Expand Down Expand Up @@ -198,7 +193,7 @@ exclude = [
extraPaths = ["stubs"]
include = ["xcp", "tests"]
pythonPlatform = "Linux"
pythonVersion = "3.6"
pythonVersion = "3.11"
reportFunctionMemberAccess = true
reportGeneralTypeIssues = "warning"
reportOptionalMemberAccess = "warning"
Expand Down
62 changes: 0 additions & 62 deletions pyre_runner.py

This file was deleted.

3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
# These are the most of the needed pytest plugins, unfortunately this list does
# not support ;python_version<=3.0 or ;python_version>3.0. Therefore, it can
# only list plugins available for all tested python versions (2.7, 3.6 ... 3.11):
# pytest-localftpserver is also used, but its installation is not checked
# to to its installation not being detected on Ubuntu 24.04:
required_plugins =
pytest_httpserver
pytest-forked
pytest-localftpserver
pytest-pythonpath
pytest-subprocess
pytest-timeout
Expand Down
Empty file removed stubs/pyfakefs/__init__.pyi
Empty file.
151 changes: 0 additions & 151 deletions stubs/pyfakefs/fake_filesystem.pyi

This file was deleted.

20 changes: 0 additions & 20 deletions stubs/pyfakefs/fake_filesystem_unittest.pyi

This file was deleted.

8 changes: 0 additions & 8 deletions stubs/pytest.pyi

This file was deleted.

3 changes: 0 additions & 3 deletions stubs/werkzeug/wrappers.pyi

This file was deleted.

4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
This module is run automatically by pytest to define and enable fixtures.
"""

# pyre-ignore-all-errors[21]
import warnings

import pytest # pyre does not find the module when run by tox -e py311-pyre
import pytest


@pytest.fixture(autouse=True)
def set_warnings():
Expand Down
Loading
Loading