sandialabs / pyttb

Python Tensor Toolbox
https://pyttb.readthedocs.io
BSD 2-Clause "Simplified" License
25 stars 13 forks source link

Need typing_extensions as dependency #309

Closed ghbrown closed 1 month ago

ghbrown commented 3 months ago

typing_extensions is used in ktensor.py, so it needs to be a standard dependency of pyttb. A minimal virtual environment with just pyttb fails to import pyttb because of this.

I haven't been following Python typing closely, so perhaps this is now a feature of built-in typing modules, but either way this should be addressed.

ntjohnson1 commented 3 months ago

typing_extensions is a back port for typing support to older versions of python (I believe <3.10). I'm not sure if this is a hole in our testing (we run most of our tests using the dev dependencies) or we were indirectly including it before through one of our dependencies and that changed. The fix is straightforward, but can you clarify if your repro looks different than:

# Create clean venv
pip install .
python -m "import pyttb"
ghbrown commented 3 months ago

I see, thanks for the background. Yes, my reproducer is as described, but python -c "import pyttb" instead.

ntjohnson1 commented 3 months ago

It made sense to me to add this onto my numpy 2.0 support branch since that's another config that is broken right now. Also since we're a bit behind in actually merging some fixes at the moment I figured it might be better than adding another PR.

The fix is to remove the typing_extensions entirely since we don't REALLY need it. I also added a superficial check to capture something similar in the future.

ntjohnson1 commented 3 months ago

Thanks again for finding and fixing things!

ntjohnson1 commented 1 month ago

Resolved in #307