From f8bce190ed6603245a2a48bc9fc27c242655da29 Mon Sep 17 00:00:00 2001 From: Anselm Hahn Date: Tue, 24 Sep 2024 09:18:14 +0200 Subject: [PATCH 1/2] chore: :recycle: Update RIXSConverter class documentation and argument descriptions Update the documentation and argument descriptions in the RIXSConverter class to provide clearer explanations and improve readability. This commit also renames some argument labels for consistency and adds default values for certain arguments. The changes aim to enhance the understanding and usability of the RIXSConverter class for converting raw pickle data into JSON, TOML, or numpy formats for RIXS visualization. --- spectrafit/plugins/rixs_converter.py | 36 +++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/spectrafit/plugins/rixs_converter.py b/spectrafit/plugins/rixs_converter.py index 7c1fa6a3a..8cb91072b 100644 --- a/spectrafit/plugins/rixs_converter.py +++ b/spectrafit/plugins/rixs_converter.py @@ -23,30 +23,28 @@ class RIXSConverter(Converter): - """Transform the raw pkl data into a JSON, TOML, or numpy file for RIXS.""" + """Convert raw pickle data into JSON, TOML, or numpy formats.""" def get_args(self) -> Dict[str, Any]: - """Get the arguments from the command line. + """Retrieve command-line arguments. Returns: - Dict[str, Any]: Return the input file arguments as a dictionary without - additional information beyond the command line arguments. + Dict[str, Any]: Dictionary of input file arguments. """ parser = argparse.ArgumentParser( - description="Converter for 'SpectraFit' from pkl files to a JSON, TOML, " - "or numpy file for RIXS-Visualizer.", - usage="%(prog)s [options] infile", + description="Convert 'SpectraFit' pickle files to JSON, " + "TOML, or numpy formats for RIXS-Visualizer.", + usage="%(prog)s [options] input_file", ) parser.add_argument( "infile", type=Path, - help="Filename of the pkl file to convert to JSON, TOML, or numpy.", + help="Path to the pickle file to be converted.", ) parser.add_argument( "-f", "--file-format", - help="File format for the optional encoding of the pickle file." - " Default is 'latin1'.", + help="Encoding format of the pickle file (default: 'latin1').", type=str, default="latin1", choices=choices_fformat, @@ -54,33 +52,33 @@ def get_args(self) -> Dict[str, Any]: parser.add_argument( "-e", "--export-format", - help="File extension for the export.", + help="Desired export file format (default: 'json').", type=str, default="json", choices=choices_export, ) parser.add_argument( "-ie", - "--incident_energy", - help="Name of the incident energy", + "--incident-energy", + help="Label for the incident energy.", type=str, ) parser.add_argument( "-ee", - "--emission_energy", - help="Name of the emitted energy", + "--emission-energy", + help="Label for the emitted energy.", type=str, ) parser.add_argument( "-rm", - "--rixs_map", - help="Name of the RIXS map", + "--rixs-map", + help="Label for the RIXS map.", + type=str, ) parser.add_argument( "-m", "--mode", - help="Mode of the RIXS map post-processing, e.g. 'sum' or 'max'." - "Default is 'sum'.", + help="Post-processing mode for the RIXS map (default: 'sum').", type=str, default="sum", choices=choices_mode, From f156f426dbd1ab9c84e180f2b1b8cd73667ac7ca Mon Sep 17 00:00:00 2001 From: Anselm Hahn Date: Tue, 24 Sep 2024 12:04:39 +0200 Subject: [PATCH 2/2] build: :lock: Warning for the end of support for `Python 3.8` is approaching Fixes #1607 --- spectrafit/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spectrafit/__init__.py b/spectrafit/__init__.py index e7d82ad34..d74647472 100644 --- a/spectrafit/__init__.py +++ b/spectrafit/__init__.py @@ -3,6 +3,25 @@ !!! info "About Versioning" SpectraFit uses [Semantic Versioning](https://semver.org/). + +!!! warning "About Python Versions" + + Currently, SpectraFit only supports Python 3.8 and above. Soon, Python 3.8 + will be deprecated in favor of Python 3.9 and above, see also + [Release Schedule](https://devguide.python.org/versions/#end-of-life-branches). """ +import sys +import warnings + + +if sys.version_info[:2] == (3, 8): + warnings.warn( + "Support for Python 3.8 is approaching its end-of-life. " + "Please consider upgrading to Python 3.9 or newer. " + "For more details, see: " + "https://devguide.python.org/versions/#end-of-life-branches.", + DeprecationWarning, + ) + __version__ = "1.0.4"