Skip to content

Conversation

maresb
Copy link
Contributor

@maresb maresb commented Aug 29, 2025

Description

pytest-sphinx is now available from conda-forge, so we should install it from there to simplify our environment specifications and installation process.

Updating the dependencies busts the micromamba cache on our CI. As noted in #1598, for such a fresh install, mypy was broken on main. This also fixes type errors in 8 files.

Afterwards, we are able to remove pytensor/compile/sharedvalue.py from mypy-failing.txt.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pytensor--1599.org.readthedocs.build/en/1599/

@maresb maresb marked this pull request as draft August 29, 2025 11:03
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.71%. Comparing base (7092f55) to head (1acb289).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1599   +/-   ##
=======================================
  Coverage   81.71%   81.71%           
=======================================
  Files         230      230           
  Lines       52924    52925    +1     
  Branches     9402     9402           
=======================================
+ Hits        43248    43249    +1     
  Misses       7244     7244           
  Partials     2432     2432           
Files with missing lines Coverage Δ
pytensor/link/jax/linker.py 96.22% <100.00%> (+0.07%) ⬆️
pytensor/link/numba/dispatch/vectorize_codegen.py 91.15% <100.00%> (ø)
pytensor/npy_2_compat.py 100.00% <100.00%> (ø)
pytensor/scan/utils.py 87.56% <100.00%> (ø)
pytensor/tensor/einsum.py 97.10% <100.00%> (ø)
pytensor/tensor/random/rewriting/numba.py 100.00% <100.00%> (ø)
pytensor/tensor/rewriting/blockwise.py 96.24% <100.00%> (ø)
pytensor/tensor/rewriting/numba.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maresb maresb force-pushed the mypy-broken-main branch 2 times, most recently from 62a7dd0 to 50db190 Compare August 29, 2025 12:32
@maresb maresb marked this pull request as ready for review August 29, 2025 12:38
@maresb maresb changed the title Empty commit to test mypy Fix mypy errors Aug 29, 2025
@maresb maresb changed the title Fix mypy errors Install pytest-sphinx from conda-forge and fix mypy errors Aug 29, 2025
@maresb maresb requested review from Copilot and ricardoV94 August 29, 2025 13:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR simplifies the pytest-sphinx installation by moving it from pip to conda-forge, and resolves mypy type checking errors across multiple files. The changes enable removing pytensor/compile/sharedvalue.py from the mypy exclusion list.

  • Install pytest-sphinx from conda-forge instead of pip
  • Fix mypy type annotation and casting errors in 8 files
  • Remove pytensor/compile/sharedvalue.py from mypy-failing.txt

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/mypy-failing.txt Removes pytensor/compile/sharedvalue.py from mypy exclusion list
pytensor/tensor/rewriting/numba.py Removes type ignore comments for proper type annotations
pytensor/tensor/rewriting/blockwise.py Removes type ignore comment for Blockwise type annotation
pytensor/tensor/random/rewriting/numba.py Removes type ignore comments for RandomVariable and ShapeFeature
pytensor/tensor/einsum.py Adds proper type annotations and casting for einsum path handling
pytensor/scan/utils.py Adds explicit type casting for Variable return type
pytensor/npy_2_compat.py Adds type ignore comment for NumPy 2 compatibility
pytensor/link/numba/dispatch/vectorize_codegen.py Replaces type ignore with pyright ignore comments
pytensor/link/jax/linker.py Moves scalar_shape_inputs type annotation to class level
environment.yml Moves pytest-sphinx from pip to conda-forge dependencies
environment-osx-arm64.yml Moves pytest-sphinx from pip to conda-forge dependencies
.github/workflows/test.yml Adds pytest-sphinx to micromamba install commands

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Nice

@ricardoV94 ricardoV94 merged commit e127e36 into pymc-devs:main Aug 31, 2025
64 checks passed
@maresb maresb deleted the mypy-broken-main branch August 31, 2025 19:42
@maresb
Copy link
Contributor Author

maresb commented Aug 31, 2025

Thanks @ricardoV94!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants