From 51a26d1972e61bbfa594884b41f16b3ebe7d8deb Mon Sep 17 00:00:00 2001 From: David Wallace Date: Sun, 26 Jan 2025 22:21:55 +0100 Subject: [PATCH] chore: upgrade to py 3.12 Signed-off-by: David Wallace --- README.md | 4 ++-- src/raman_fitting/__init__.py | 29 ++++++++++------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1462471..692f6fd 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ https://github.com/MyPyDavid/raman-fitting/wiki A release is now available on PyPI, installation can be done with these commands in a terminal. ``` bash # Setting up and activating a virtual environment -python -m venv env # python 3.11 is recommended +python -m venv env # python 3.12 is recommended source env/bin/activate # Installation from PyPI @@ -110,7 +110,7 @@ The current version is v0.8.0 ### Dependencies -- python >= 3.11 +- python >= 3.12 - lmfit >= 1.2.0 - pandas >= 2.0.0 - scipy >= 1.10.1 diff --git a/src/raman_fitting/__init__.py b/src/raman_fitting/__init__.py index 4589819..426fdb4 100644 --- a/src/raman_fitting/__init__.py +++ b/src/raman_fitting/__init__.py @@ -6,6 +6,7 @@ __package_name__ = __current_package_name__ import importlib.util +import sys try: from ._version import __version__ @@ -24,30 +25,20 @@ except Exception: __version__ = "catch_exception_version" -import sys -import warnings - -# This code is written for Python 3.11 and higher -if sys.version_info.major < 3 and sys.version_info.minor < 11: - raise RuntimeError(f"{__package_name__} requires Python 3.11 or higher.") -# Let users know if they're missing any hard dependencies -hard_dependencies = ("numpy", "pandas", "scipy", "matplotlib", "lmfit", "pydantic") -soft_dependencies = {} -missing_dependencies = [] +# This code is written for Python 3.12 and higher +if sys.version_info.major < 3 and sys.version_info.minor < 12: + raise RuntimeError(f"{__package_name__} requires Python 3.12 or higher.") +# Let users know if they're missing any dependencies +dependencies: set = {"numpy", "pandas", "scipy", "matplotlib", "lmfit", "pydantic"} +missing_dependencies = set() -for dependency in hard_dependencies: +for dependency in dependencies: if not importlib.util.find_spec(dependency): - missing_dependencies.append(dependency) + missing_dependencies.add(dependency) if missing_dependencies: raise ImportError(f"Missing required dependencies {missing_dependencies}") -for dependency in soft_dependencies: - if not importlib.util.find_spec(dependency): - warnings.warn( - f"Missing important package {dependency}. {soft_dependencies[dependency]}" - ) - -del hard_dependencies, soft_dependencies, dependency, missing_dependencies +del dependencies, dependency, missing_dependencies