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

photonlibpy usage is not type checkable #1210

Closed
auscompgeek opened this issue Feb 2, 2024 · 4 comments · Fixed by #1598
Closed

photonlibpy usage is not type checkable #1210

auscompgeek opened this issue Feb 2, 2024 · 4 comments · Fixed by #1598
Labels
bug Something isn't working

Comments

@auscompgeek
Copy link
Contributor

auscompgeek commented Feb 2, 2024

Describe the bug

It isn't possible to type check code that imports photonlibpy.

To Reproduce

echo "from photonlibpy.photonCamera import PhotonCamera" > test.py
python -m mypy test.py

Screenshots / Videos

test.py:1: error: Skipping analyzing "photonlibpy.photonCamera": module is installed, but missing library stubs or py.typed marker  [import-untyped]
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Platform:

  • PhotonVision Version: 2024.2.0

Additional context

This is probably blocked by #1145.

@auscompgeek auscompgeek added the bug Something isn't working label Feb 2, 2024
@LucienMorey
Copy link
Contributor

fyi, I think this is no longer an issue since #1570. It finished off the last of the type checking things and there is now active ci checking it on each pr. At the very least the steps to reproduce now show:

echo "from photonlibpy.photonCamera import PhotonCamera" > test.py
python -m mypy test.py
Success: no issues found in 1 source file

@auscompgeek
Copy link
Contributor Author

I'm still able to reproduce:

> ls
test.py
> cat test.py
from photonlibpy.photonCamera import PhotonCamera
> python -m mypy test.py
test.py:1: error: Skipping analyzing "photonlibpy.photonCamera": module is installed, but missing library stubs or py.typed marker  [import-untyped]
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
> python -m pip list
Package           Version
----------------- ----------
mypy              1.13.0
mypy-extensions   1.0.0
numpy             2.1.3
opencv-python     4.10.0.84
photonlibpy       2025.0.0b4
pip               24.2
pyntcore          2025.0.0b1
robotpy-apriltag  2025.0.0b1
robotpy-cli       2024.0.0
robotpy-cscore    2025.0.0b1
robotpy-hal       2025.0.0b1
robotpy-wpimath   2025.0.0b1
robotpy-wpinet    2025.0.0b1
robotpy-wpiutil   2025.0.0b1
typing_extensions 4.12.2
wpilib            2025.0.0b1

@LucienMorey
Copy link
Contributor

I'm still able to reproduce:

> ls
test.py
> cat test.py
from photonlibpy.photonCamera import PhotonCamera
> python -m mypy test.py
test.py:1: error: Skipping analyzing "photonlibpy.photonCamera": module is installed, but missing library stubs or py.typed marker  [import-untyped]
test.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
> python -m pip list
Package           Version
----------------- ----------
mypy              1.13.0
mypy-extensions   1.0.0
numpy             2.1.3
opencv-python     4.10.0.84
photonlibpy       2025.0.0b4
pip               24.2
pyntcore          2025.0.0b1
robotpy-apriltag  2025.0.0b1
robotpy-cli       2024.0.0
robotpy-cscore    2025.0.0b1
robotpy-hal       2025.0.0b1
robotpy-wpimath   2025.0.0b1
robotpy-wpinet    2025.0.0b1
robotpy-wpiutil   2025.0.0b1
typing_extensions 4.12.2
wpilib            2025.0.0b1

Yep I was running everything with the internal build and test scripts but didn't test with the package from pypi... I will need to look at that next

github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2024
I think this is the correct way to do this based on my understanding of
the guide to making a [pep561 compliant
package](https://mypy.readthedocs.io/en/stable/installed_packages.html#creating-pep-561-compatible-packages)
and this example in
[black](https://github.com/psf/black/pull/1395/files). Given that I get
all the type-checking info from a local installation, I don't know if
this is testable until it's published on Pypi.

resolves #1210
@LucienMorey
Copy link
Contributor

I just tried to run this check with 2025.0.0b5 being stamped, and everything was good. @auscompgeek are things good for you as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants