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

Increase Python requirement to 3.8 #278

Closed
ajjackson opened this issue Jun 19, 2023 · 3 comments · Fixed by #284
Closed

Increase Python requirement to 3.8 #278

ajjackson opened this issue Jun 19, 2023 · 3 comments · Fixed by #284

Comments

@ajjackson
Copy link
Collaborator

  • Official end-of-life for Python 3.7 is June 27 2023
  • Mantid is now built on at least Python 3.8 so this will not cause problems there
  • We have started spotting places in the code that it would be nice to use the assignment expressions (aka "the walrus operator")
  • Some other Python 3.8+ features to consider using
    • positional-only parameters (probably not relevant, but could be used for more robust passing of **kwargs to matplotlib etc)
    • @lru_cache no longer requires an argument to decorate a function
    • @functools.cached_property looks handy
    • @functools.singledispatchmethod provides a cleaner handling of type-dispatched methods; this could be used to clean up e.g. the Spectrum objects that have a lot of type-dispatching.
    • math.dist() calculates Euclidean distance. Mostly we would use np.linalg.norm for this but it might be the better option if the data isn't already in numpy arrays.
    • math.prod - finally something like a lisp (* ...) for multiplication of an arbitrary number of arguments 😁 .
    • multiprocessing.shared_memory module (not that we should stop using C/OpenMP for "hot" parts of the code!)
      • This could be very useful for enumerating 2-phonon incoherent scattering combinations; currently Abins does this in serial
    • typing.TypedDict provides a proper way to type-hint heterogeneous dictionaries. Of course, a lot of those could be NamedTuple or dataclass, but for existing or JSON-imported dictionaries this is good.
    • typing.Literal to define a specific set of allowed values. We could be using this for e.g. 'gauss', 'lorentz' broadening options.
@sf1919
Copy link

sf1919 commented Jul 11, 2023

Mantid is moving to Python 3.10 at the moment ready for v6.8 release in October.

@ajjackson
Copy link
Collaborator Author

ajjackson commented Jul 19, 2023

There was an automated recommendation to bump scipy to 1.10 for security purposes. As this version requires Python 3.8, we can't do that until 3.7 is dropped. We might as well do those things simultaneously; @sf1919 will all Mantid builds be on Scipy >= 1.10?

We also have this dependabot warning about old versions of Numpy, but those versions are also incompatible with Scipy 1.10: https://github.com/pace-neutrons/Euphonic/security/dependabot/11

@ajjackson
Copy link
Collaborator Author

Numpy 1.19.5 is the minimum version for use with Scipy 1.10, so this should be used for the minimum requirements testing

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

Successfully merging a pull request may close this issue.

2 participants