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

Add pyright ci annotations #36510

Merged
merged 6 commits into from
Oct 31, 2023
Merged
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
33 changes: 21 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,30 @@ jobs:
MAKE: make -j2 --output-sync=recurse
SAGE_NUM_THREADS: 2

- name: Set up node to install pyright
- name: Static code check with pyright
if: always() && steps.worktree.outcome == 'success'
uses: actions/setup-node@v3
uses: jakebailey/pyright-action@v1
with:
node-version: '12'

- name: Install pyright
if: always() && steps.worktree.outcome == 'success'
# Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239
run: npm install -g [email protected]

- name: Static code check with pyright
version: 1.1.332
# Many warnings issued by pyright are not yet helpful because there is not yet enough type information.
no-comments: true
working-directory: ./worktree-image
env:
# To avoid out of memory errors
NODE_OPTIONS: --max-old-space-size=8192

- name: Static code check with pyright (annotated)
if: always() && steps.worktree.outcome == 'success'
run: pyright
working-directory: ./worktree-image
uses: jakebailey/pyright-action@v1
with:
version: 1.1.332
# Issue errors
no-comments: false
level: error
working-directory: ./worktree-image
env:
# To avoid out of memory errors
NODE_OPTIONS: --max-old-space-size=8192

- name: Clean (fallback to non-incremental)
id: clean
Expand Down
5 changes: 4 additions & 1 deletion src/doc/en/developer/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ Pyright

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

- Manual: Run ``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::

NODE_OPTIONS="--max-old-space-size=8192" pyright

- VS Code: Install the `Pylance <https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance>`__ extension.

Expand Down
2 changes: 1 addition & 1 deletion src/sage/functions/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ def _evalf_(self, poly, index, parent=None, algorithm=None):
sage: complex_root_of(x^8 - 1, 7).n(20) # needs sage.symbolic
0.70711 + 0.70711*I
"""
from sympy.core.evalf import prec_to_dps
from mpmath.libmp import prec_to_dps
from sympy.polys import CRootOf, Poly
try:
prec = parent.precision()
Expand Down