Skip to content
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ jobs:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

- name: Add venv to PATH for pyright
if: always() && steps.worktree.outcome == 'success'
# https://github.com/jakebailey/pyright-action#use-with-a-virtualenv
run: echo "$PWD/venv/bin" >> $GITHUB_PATH
working-directory: ./worktree-image

- name: Static code check with pyright
if: (success() || failure()) && steps.worktree.outcome == 'success'
uses: jakebailey/pyright-action@v1
Expand Down
10 changes: 3 additions & 7 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
"include": [
"src/sage"
],
"executionEnvironments": [
{
"root": "src"
}
],
"stubPath": "src/typings",
"pythonVersion": "3.9",
"exclude": ["venv"],
"venvPath": "./venv/",
"venv": "./",

"reportGeneralTypeIssues": "warning",
"reportUnboundVariable": "warning",
Expand All @@ -22,4 +16,6 @@
"reportUndefinedVariable": "warning",
"reportOptionalOperand": "warning",
"reportMissingImports": "warning",
// Suppress because it flags our standard pattern @staticmethod __classcall__(cls, ...)
"reportSelfClsParameterName": "none",
Copy link
Contributor

@tobiasdiez tobiasdiez Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem with this check? (I know you had a comment here before explaining it, but even then I didn't understand it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I lost the commit with the comment, I'll find it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is back and does not need further clarification

}
10 changes: 5 additions & 5 deletions src/doc/en/developer/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ available::
...
Testing files:
...
--tox [options] <files|dirs> -- general entry point for testing
and linting of the Sage library
-e <envlist> -- run specific test environments; default:
doctest,coverage,startuptime,pycodestyle-minimal,relint,codespell,rst
--tox [options] -- <files|dirs> -- general entry point for testing
and linting of the Sage library
-e <envlist> -- run specific test environments
(default: run all except full pycodestyle)
doctest -- run the Sage doctester
(same as "sage -t")
coverage -- give information about doctest coverage of files
Expand Down Expand Up @@ -383,7 +383,7 @@ Pyright

*Usage:*

- Tox: Run ``./sage -tox -e pyright path/to/the/file.py``
- Tox: Run ``./sage -tox -e pyright -- path/to/the/file.py``

- Manual: Run ``pyright path/to/the/file.py``. If you want to check the whole Sage library, you most likely run out of memory with the default settings.
You can use the following command to check the whole library::
Expand Down
27 changes: 14 additions & 13 deletions src/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,22 @@ commands =
[testenv:pyright]
description =
run the static typing checker pyright
deps = pyright
skip_install = True
deps =
pyright
-e {toxinidir}/../pkgs/sage-conf
-r {toxinidir}/requirements.txt
setenv =
{[sagedirect]setenv}
HOME={envdir}
# Fix version, see .github/workflows/build.yml
PYRIGHT_PYTHON_FORCE_VERSION=1.1.232
allowlist_externals = {[sagedirect]allowlist_externals}
## We run pyright from within the sage-env so that SAGE_LOCAL is available.
## pyright is already configured via SAGE_ROOT/pyrightconfig.json to use our venv.
##
## Running pyright on the whole Sage source tree takes very long
## and may run out of memory. When no files/directories are given, just run it
## on the packages that already have typing annotations.
PYRIGHT_PYTHON_FORCE_VERSION=1.1.332
PYRIGHT_PYTHON_GLOBAL_NODE=false
## Otherwise running pyright on the whole Sage source tree (= default)
## will take very long and may run out of memory.
NODE_OPTIONS=--max-old-space-size=8192
## We make the built wheels available
PIP_FIND_LINKS=file://{env:SAGE_SPKG_WHEELS:{env:SAGE_VENV:{toxinidir}/../venv}/var/lib/sage/wheels}

commands =
{env:SAGE} -sh -c 'pyright {posargs:{toxinidir}/sage/combinat {toxinidir}/sage/manifolds}'
pyright {posargs:}

[testenv:pycodestyle]
description =
Expand Down