Skip to content

typing-extensions dependency #523

@hanson-hschang

Description

@hanson-hschang

Describe the bug

The package fails to import due to a missing dependency. Specifically, elastica.rod.cosserat_rod attempts to import Self from typing_extensions, but typing_extensions is not automatically installed as a dependency when installing PyElastica.

To Reproduce

I installed a package that depends on PyElastica (and thus installed PyElastica). When attempting to run a basic import script, it crashes.

Script:

# run.py
import elastica as ea

Error:

Traceback (most recent call last):
  File "/Users/hschang/Desktop/RigidBodyRobotics/examples/rotation_energy_test/run.py", line 5, in <module>
    import elastica as ea
  File "/Users/hschang/Desktop/RigidBodyRobotics/.venv/lib/python3.12/site-packages/elastica/__init__.py", line 11, in <module>
    from elastica.rod.cosserat_rod import CosseratRod
  File "/Users/hschang/Desktop/RigidBodyRobotics/.venv/lib/python3.12/site-packages/elastica/rod/cosserat_rod.py", line 3, in <module>
    from typing_extensions import Self
ModuleNotFoundError: No module named 'typing_extensions'

Environment

Expected behavior

import elastica should execute successfully without requiring the user to manually install internal dependencies. The typing_extensions library should be listed in the install_requires of the package configuration.

Additional context

I was able to resolve this locally by manually installing the missing module:

uv add typing-extensions
# OR
pip install typing-extensions

This suggests that typing-extensions is missing from the package's dependencies list in pyproject.toml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions