From 3e5d23c39d50254c3242aea28e5a2a55be309f76 Mon Sep 17 00:00:00 2001 From: Marco Passoni Date: Sun, 7 Jan 2024 20:28:17 +0100 Subject: [PATCH] Reworked version definition. Removed import from __future__ and thus compatibility with python 3.10 --- A_FMM/__init__.py | 10 +--------- A_FMM/_version.py | 8 ++++++++ A_FMM/stack.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 A_FMM/_version.py diff --git a/A_FMM/__init__.py b/A_FMM/__init__.py index acc2150..4431ad2 100644 --- a/A_FMM/__init__.py +++ b/A_FMM/__init__.py @@ -12,13 +12,5 @@ from A_FMM.stack import Stack import A_FMM.inputs as inputs -try: - from ._version import __version__ -except ModuleNotFoundError: - from hatch_vcs.version_source import VCSVersionSource - import toml - basedir = os.path.split(os.path.dirname(__file__))[0] - config = toml.load(os.path.join(basedir, "pyproject.toml")) - vcs_version = VCSVersionSource(basedir, config["tool"]["hatch"]["version"]) - __version__ = vcs_version.get_version_data()["version"] +from ._version import __version__ diff --git a/A_FMM/_version.py b/A_FMM/_version.py new file mode 100644 index 0000000..6b8c3b6 --- /dev/null +++ b/A_FMM/_version.py @@ -0,0 +1,8 @@ +from pathlib import Path +from hatch_vcs.version_source import VCSVersionSource +import toml + +basedir = Path(__file__).parent.parent +config = toml.load(basedir/"pyproject.toml") +vcs_version = VCSVersionSource(basedir, config["tool"]["hatch"]["version"]) +__version__ = vcs_version.get_version_data()["version"] diff --git a/A_FMM/stack.py b/A_FMM/stack.py index 3797d38..dcb0b94 100644 --- a/A_FMM/stack.py +++ b/A_FMM/stack.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from typing import Self import numpy as np @@ -448,7 +448,7 @@ def double(self) -> None: except AttributeError: raise RuntimeError("structure not solved yet") - def join(self, st2: Stack) -> None: + def join(self, st2: Self) -> None: """Join the scattering matrix of the structure with the one of a second structure When doing this, the lenght of the first al last layeror each stack are ignored (set to 0). diff --git a/pyproject.toml b/pyproject.toml index a0feaaf..c7d4e26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Physics", ] dependencies = [