mauricioAyllon / PyMCNP

Python tools for MCNP
Other
4 stars 0 forks source link

'Self' type: using 3.11 feature in source code that should work with 3.10 #1

Closed arunpersaud closed 1 week ago

arunpersaud commented 3 weeks ago

In

https://github.com/mauricioAyllon/PyMCNP/tree/master/src/pymcnp/files/inp#L9

we import Self from typing, but I think this is a 3.11 feature. In pyproject.toml we say we support >=3.10 though.

BitterB0NG0 commented 2 weeks ago

You're right! The Self type hint is supported by Python 3.11+, so we can remove support for Python 3.10 or remove the type hints. Since PyMCNP was developed in Python 3.11, I'd suggest keeping the type hints, but either solution should work. Any preferences?

arunpersaud commented 2 weeks ago

Since this is a package to support MCNP, I think we should support as many python versions as possible. Since we use numpy for many things, I normally go with what numpy supports, which I think at the moment is >=3.10 (https://numpy.org/neps/nep-0029-deprecation_policy.html). For other projects I then set up pyupgrade for that version, but perhaps we should switch to ruff for this one?

BitterB0NG0 commented 1 week ago

That sounds good! I've updated the source code to remove Self type hints and added that we support Python versions >= 3.10 to the documentation.