From 4c70fe5ea96f836e98d4c7e79ff25ab6ccc076d3 Mon Sep 17 00:00:00 2001 From: DEBREUVE Eric <eric.debreuve@cnrs.fr> Date: Mon, 8 Apr 2024 11:30:47 +0200 Subject: [PATCH] updated setup and copyright (UCA->UniCA) --- MANIFEST.in | 1 + README-COPYRIGHT-utf8.txt | 6 +- README.rst | 50 +++++++--- logger_36/__init__.py | 2 +- logger_36/catalog/config/console_rich.py | 2 +- logger_36/catalog/handler/README.txt | 2 +- logger_36/catalog/handler/console.py | 2 +- logger_36/catalog/handler/console_rich.py | 3 +- logger_36/catalog/handler/file.py | 2 +- logger_36/catalog/handler/generic.py | 2 +- logger_36/catalog/logging/chronos.py | 2 +- logger_36/catalog/logging/gpu.py | 2 +- logger_36/catalog/logging/memory.py | 2 +- logger_36/catalog/logging/system.py | 2 +- logger_36/config/issue.py | 2 +- logger_36/config/memory.py | 2 +- logger_36/config/message.py | 2 +- logger_36/config/system.py | 2 +- logger_36/constant/generic.py | 2 +- logger_36/constant/handler.py | 2 +- logger_36/constant/issue.py | 2 +- logger_36/constant/logger.py | 2 +- logger_36/constant/memory.py | 2 +- logger_36/constant/message.py | 2 +- logger_36/constant/record.py | 2 +- logger_36/constant/system.py | 2 +- logger_36/instance.py | 2 +- logger_36/main.py | 2 +- logger_36/task/format/memory.py | 2 +- logger_36/task/format/message.py | 2 +- logger_36/task/format/rule.py | 2 +- logger_36/task/inspection.py | 2 +- logger_36/task/measure/chronos.py | 2 +- logger_36/task/measure/memory.py | 2 +- logger_36/task/storage.py | 2 +- logger_36/type/extension.py | 2 +- logger_36/type/issue.py | 2 +- logger_36/type/logger.py | 2 +- logger_36/version.py | 4 +- pyproject.toml | 1 - setup.py | 113 ++++++++++++---------- test/main.py | 2 +- 42 files changed, 137 insertions(+), 111 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 181223f..df73841 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include README-COPYRIGHT-utf8.txt include README-LICENCE-utf8.txt +include requirements.txt include documentation/wiki/description.asciidoc diff --git a/README-COPYRIGHT-utf8.txt b/README-COPYRIGHT-utf8.txt index dab15b7..ae2d68e 100644 --- a/README-COPYRIGHT-utf8.txt +++ b/README-COPYRIGHT-utf8.txt @@ -1,15 +1,15 @@ -Copyright CNRS/Inria/UCA +Copyright CNRS/Inria/UniCA Contributor(s): Eric Debreuve (since 2023) eric.debreuve@cnrs.fr This software is being developed by Eric Debreuve, a CNRS employee and member of team Morpheme. -Team Morpheme is a joint team between Inria, CNRS, and UCA. +Team Morpheme is a joint team between Inria, CNRS, and UniCA. It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory I3S, and Laboratory iBV. CNRS: https://www.cnrs.fr/index.php/en Inria: https://www.inria.fr/en/ -UCA: https://univ-cotedazur.eu/ +UniCA: https://univ-cotedazur.eu/ Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/ I3S: https://www.i3s.unice.fr/en/ iBV: http://ibv.unice.fr/ diff --git a/README.rst b/README.rst index 290c6a2..c325359 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ .. - Copyright CNRS/Inria/UCA + Copyright CNRS/Inria/UniCA Contributor(s): Eric Debreuve (since 2023) eric.debreuve@cnrs.fr @@ -31,7 +31,7 @@ knowledge of the CeCILL license and that you accept its terms. .. |PROJECT_NAME| replace:: logger-36 -.. |SHORT_DESCRIPTION| replace:: Simple logger using ``rich_`` +.. |SHORT_DESCRIPTION| replace:: Simple logger with a catalog of handlers .. |PYPI_NAME_LITERAL| replace:: ``logger-36`` .. |PYPI_PROJECT_URL| replace:: https://pypi.org/project/logger-36/ @@ -40,6 +40,9 @@ .. |DOCUMENTATION_URL| replace:: https://src.koda.cnrs.fr/eric.debreuve/logger-36/-/wikis/home .. _DOCUMENTATION_URL: https://src.koda.cnrs.fr/eric.debreuve/logger-36/-/wikis/home +.. |DEPENDENCIES_MANDATORY| replace:: None +.. |DEPENDENCIES_OPTIONAL| replace:: psutil, rich + =================================== @@ -48,6 +51,13 @@ +Documentation +============= + +The documentation is available at |DOCUMENTATION_URL|_. + + + Installation ============ @@ -55,31 +65,41 @@ This project is published on the `Python Package Index (PyPI) <https://pypi.org/>`_ at: |PYPI_PROJECT_URL|_. It should be installable from Python distribution platforms or Integrated Development Environments (IDEs). -Otherwise, it can be installed from a command console: +Otherwise, it can be installed from a command console using `pip <https://pip.pypa.io/>`_: -- For all users, after acquiring administrative rights: - - First installation: ``pip install`` |PYPI_NAME_LITERAL| - - Installation update: ``pip install --upgrade`` |PYPI_NAME_LITERAL| -- For the current user (no administrative rights required): - - First installation: ``pip install --user`` |PYPI_NAME_LITERAL| - - Installation update: ``pip install --user --upgrade`` |PYPI_NAME_LITERAL| ++--------------+-------------------------------------------------------+----------------------------------------------------------+ +| | For all users (after acquiring administrative rights) | For the current user (no administrative rights required) | ++==============+=======================================================+==========================================================+ +| Installation | ``pip install`` |PYPI_NAME_LITERAL| | ``pip install --user`` |PYPI_NAME_LITERAL| | ++--------------+-------------------------------------------------------+----------------------------------------------------------+ +| Update | ``pip install --upgrade`` |PYPI_NAME_LITERAL| | ``pip install --user --upgrade`` |PYPI_NAME_LITERAL| | ++--------------+-------------------------------------------------------+----------------------------------------------------------+ -Documentation -============= +Dependencies +============ -The documentation is available at |DOCUMENTATION_URL|_. +The development relies on several packages: + +- Mandatory: |DEPENDENCIES_MANDATORY| +- Optional: |DEPENDENCIES_OPTIONAL| + +The mandatory dependencies are installed automatically by `pip <https://pip.pypa.io/>`_, if they are not already, as part of the installation of |PROJECT_NAME|. +Python distribution platforms or Integrated Development Environments (IDEs) should also take care of this. +The optional dependencies, if any, must be installed independently by following the related instructions, for added functionalities of |PROJECT_NAME|. Acknowledgments =============== -The project is developed with `PyCharm Community <https://www.jetbrains.com/pycharm/>`_. +.. image:: https://img.shields.io/badge/code%20style-black-000000.svg + :target: https://github.com/psf/black +.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 + :target: https://pycqa.github.io/isort/ -The development relies on several open-source packages -(see ``install_requires`` in ``setup.py``, if present; otherwise ``import`` statements should be searched for). +The project is developed with `PyCharm Community <https://www.jetbrains.com/pycharm/>`_. The code is formatted by `Black <https://github.com/psf/black/>`_, *The Uncompromising Code Formatter*. diff --git a/logger_36/__init__.py b/logger_36/__init__.py index 4a8210d..0e4ccc0 100644 --- a/logger_36/__init__.py +++ b/logger_36/__init__.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/config/console_rich.py b/logger_36/catalog/config/console_rich.py index 0bec599..e53b23e 100644 --- a/logger_36/catalog/config/console_rich.py +++ b/logger_36/catalog/config/console_rich.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/handler/README.txt b/logger_36/catalog/handler/README.txt index a593fab..3fb8eb0 100644 --- a/logger_36/catalog/handler/README.txt +++ b/logger_36/catalog/handler/README.txt @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/handler/console.py b/logger_36/catalog/handler/console.py index e1c7449..8fa729a 100644 --- a/logger_36/catalog/handler/console.py +++ b/logger_36/catalog/handler/console.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/handler/console_rich.py b/logger_36/catalog/handler/console_rich.py index 2113997..f347a19 100644 --- a/logger_36/catalog/handler/console_rich.py +++ b/logger_36/catalog/handler/console_rich.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr @@ -58,7 +58,6 @@ from rich.markup import escape as EscapedForRich from rich.text import Text as text_t from rich.traceback import install as InstallTracebackHandler - _COMMON_TRACEBACK_ARGUMENTS = ("theme", "width") _EXCLUSIVE_TRACEBACK_ARGUMENTS = ( "extra_lines", diff --git a/logger_36/catalog/handler/file.py b/logger_36/catalog/handler/file.py index 069dc31..ea720e1 100644 --- a/logger_36/catalog/handler/file.py +++ b/logger_36/catalog/handler/file.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/handler/generic.py b/logger_36/catalog/handler/generic.py index 7a40cc2..99159a8 100644 --- a/logger_36/catalog/handler/generic.py +++ b/logger_36/catalog/handler/generic.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/logging/chronos.py b/logger_36/catalog/logging/chronos.py index 8feefbb..3ae5d56 100644 --- a/logger_36/catalog/logging/chronos.py +++ b/logger_36/catalog/logging/chronos.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/logging/gpu.py b/logger_36/catalog/logging/gpu.py index 8a7b9ec..408fb89 100644 --- a/logger_36/catalog/logging/gpu.py +++ b/logger_36/catalog/logging/gpu.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/logging/memory.py b/logger_36/catalog/logging/memory.py index 6a04a50..b96ec32 100644 --- a/logger_36/catalog/logging/memory.py +++ b/logger_36/catalog/logging/memory.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/catalog/logging/system.py b/logger_36/catalog/logging/system.py index 0aa3d0b..228a841 100644 --- a/logger_36/catalog/logging/system.py +++ b/logger_36/catalog/logging/system.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/config/issue.py b/logger_36/config/issue.py index f5854cd..eca202e 100644 --- a/logger_36/config/issue.py +++ b/logger_36/config/issue.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/config/memory.py b/logger_36/config/memory.py index 920b46a..e33e2ad 100644 --- a/logger_36/config/memory.py +++ b/logger_36/config/memory.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/config/message.py b/logger_36/config/message.py index beb5d46..d2f083c 100644 --- a/logger_36/config/message.py +++ b/logger_36/config/message.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/config/system.py b/logger_36/config/system.py index 4988033..64a8583 100644 --- a/logger_36/config/system.py +++ b/logger_36/config/system.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/generic.py b/logger_36/constant/generic.py index 544f139..e676842 100644 --- a/logger_36/constant/generic.py +++ b/logger_36/constant/generic.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/handler.py b/logger_36/constant/handler.py index bd41e01..5a41fbb 100644 --- a/logger_36/constant/handler.py +++ b/logger_36/constant/handler.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/issue.py b/logger_36/constant/issue.py index 0add56c..96e9497 100644 --- a/logger_36/constant/issue.py +++ b/logger_36/constant/issue.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/logger.py b/logger_36/constant/logger.py index c05eab2..64f0624 100644 --- a/logger_36/constant/logger.py +++ b/logger_36/constant/logger.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/memory.py b/logger_36/constant/memory.py index 413aa2f..76aeefc 100644 --- a/logger_36/constant/memory.py +++ b/logger_36/constant/memory.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/message.py b/logger_36/constant/message.py index 7cc6d15..ac06fb1 100644 --- a/logger_36/constant/message.py +++ b/logger_36/constant/message.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/record.py b/logger_36/constant/record.py index 8580133..4b9ee73 100644 --- a/logger_36/constant/record.py +++ b/logger_36/constant/record.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/constant/system.py b/logger_36/constant/system.py index ebb248a..abb547f 100644 --- a/logger_36/constant/system.py +++ b/logger_36/constant/system.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/instance.py b/logger_36/instance.py index d8179a0..a45d7fc 100644 --- a/logger_36/instance.py +++ b/logger_36/instance.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/main.py b/logger_36/main.py index b6194a1..17e6d35 100644 --- a/logger_36/main.py +++ b/logger_36/main.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/format/memory.py b/logger_36/task/format/memory.py index 3a78beb..4d6f73b 100644 --- a/logger_36/task/format/memory.py +++ b/logger_36/task/format/memory.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/format/message.py b/logger_36/task/format/message.py index e652c68..8aac44a 100644 --- a/logger_36/task/format/message.py +++ b/logger_36/task/format/message.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/format/rule.py b/logger_36/task/format/rule.py index 7ca93ed..454e2f1 100644 --- a/logger_36/task/format/rule.py +++ b/logger_36/task/format/rule.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/inspection.py b/logger_36/task/inspection.py index 23322c2..c00802c 100644 --- a/logger_36/task/inspection.py +++ b/logger_36/task/inspection.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/measure/chronos.py b/logger_36/task/measure/chronos.py index a9ee3aa..9c1dcfa 100644 --- a/logger_36/task/measure/chronos.py +++ b/logger_36/task/measure/chronos.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/measure/memory.py b/logger_36/task/measure/memory.py index 2464d33..ea341ee 100644 --- a/logger_36/task/measure/memory.py +++ b/logger_36/task/measure/memory.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/task/storage.py b/logger_36/task/storage.py index 7065199..d358fc8 100644 --- a/logger_36/task/storage.py +++ b/logger_36/task/storage.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/type/extension.py b/logger_36/type/extension.py index 87124f7..78c43bd 100644 --- a/logger_36/type/extension.py +++ b/logger_36/type/extension.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/type/issue.py b/logger_36/type/issue.py index f0e14b6..345ed5e 100644 --- a/logger_36/type/issue.py +++ b/logger_36/type/issue.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/type/logger.py b/logger_36/type/logger.py index 578b985..473f7f7 100644 --- a/logger_36/type/logger.py +++ b/logger_36/type/logger.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr diff --git a/logger_36/version.py b/logger_36/version.py index de044d4..5e56d5f 100644 --- a/logger_36/version.py +++ b/logger_36/version.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr @@ -29,4 +29,4 @@ # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. -__version__ = "2024.7" +__version__ = "2024.9" diff --git a/pyproject.toml b/pyproject.toml index 374b58c..15caa0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [build-system] requires = [ "setuptools>=42", - "wheel" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 9d1955a..ebb758c 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr @@ -30,15 +30,18 @@ # knowledge of the CeCILL license and that you accept its terms. import re as rgex +from importlib import util from pathlib import Path as path_t +from typing import Dict from setuptools import setup HERE = path_t(__file__).parent.resolve() -DOCUMENTATION_HOME = HERE / "documentation" / "wiki" / "description.asciidoc" +LOCAL_DOCUMENTATION = HERE / "documentation" / "wiki" +ASCIIDOC_DESCRIPTION = "description.asciidoc" -def DescriptionFromDocumentation(documentation: path_t, /) -> dict[str, str]: +def DescriptionFromAsciidoc(documentation: path_t, /) -> Dict[str, str]: """""" output = {} @@ -54,59 +57,50 @@ def DescriptionFromDocumentation(documentation: path_t, /) -> dict[str, str]: return output -DESCRIPTION = DescriptionFromDocumentation(DOCUMENTATION_HOME) - - -LICENSE_SHORT = "CeCILL-2.1" -LICENCE_LONG = "CEA CNRS Inria Logiciel Libre License, version 2.1" -PY_VERSION = "3" -PY_VERSION_MIN = "3.10" - -DOCUMENTATION_SITE = "-/wikis/home" - -PYPI_NAME = "logger-36" -PYPI_TOPIC = "Software Development" -PYPI_AUDIENCE = "Developers" -PYPI_STATUS = "5 - Production/Stable" - -IMPORT_NAME = "logger_36" +DESCRIPTION = DescriptionFromAsciidoc(LOCAL_DOCUMENTATION / ASCIIDOC_DESCRIPTION) PACKAGES = [ - IMPORT_NAME, - f"{IMPORT_NAME}.catalog", - f"{IMPORT_NAME}.catalog.config", - f"{IMPORT_NAME}.catalog.handler", - f"{IMPORT_NAME}.catalog.logging", - f"{IMPORT_NAME}.config", - f"{IMPORT_NAME}.constant", - f"{IMPORT_NAME}.task", - f"{IMPORT_NAME}.task.format", - f"{IMPORT_NAME}.task.measure", - f"{IMPORT_NAME}.type", + DESCRIPTION["IMPORT_NAME"], + f"{DESCRIPTION['IMPORT_NAME']}.catalog", + f"{DESCRIPTION['IMPORT_NAME']}.catalog.config", + f"{DESCRIPTION['IMPORT_NAME']}.catalog.handler", + f"{DESCRIPTION['IMPORT_NAME']}.catalog.logging", + f"{DESCRIPTION['IMPORT_NAME']}.config", + f"{DESCRIPTION['IMPORT_NAME']}.constant", + f"{DESCRIPTION['IMPORT_NAME']}.task", + f"{DESCRIPTION['IMPORT_NAME']}.task.format", + f"{DESCRIPTION['IMPORT_NAME']}.task.measure", + f"{DESCRIPTION['IMPORT_NAME']}.type", ] -EXCLUDED_FOLDERS = () -ENTRY_POINTS = {} +EXCLUDED_PACKAGES = ( + f"{DESCRIPTION['IMPORT_NAME']}.documentation", +) +ENTRY_POINTS = { + "console_scripts": [], + "gui_scripts": [], +} long_description = (HERE / "README.rst").read_text(encoding="utf-8") + repository_url = ( f"https://" f"{DESCRIPTION['REPOSITORY_SITE']}/" f"{DESCRIPTION['REPOSITORY_USER']}/" f"{DESCRIPTION['REPOSITORY_NAME']}/" ) -documentation_url = f"{repository_url}/{DOCUMENTATION_SITE}" +documentation_url = f"{repository_url}/{DESCRIPTION['DOCUMENTATION_SITE']}" def CheckCoherenceBetweenDeclarationAndReality() -> None: """""" - folders = [IMPORT_NAME] - for node in (HERE / IMPORT_NAME).rglob("*"): + folders = [DESCRIPTION["IMPORT_NAME"]] + for node in (HERE / DESCRIPTION["IMPORT_NAME"]).rglob("*"): if node.is_dir() and not str(node).startswith("."): node = node.relative_to(HERE) node = ".".join(node.parts) if not ( - (node in EXCLUDED_FOLDERS) - or any(node.startswith(_fld + ".") for _fld in EXCLUDED_FOLDERS) + (node in EXCLUDED_PACKAGES) + or any(node.startswith(_fld + ".") for _fld in EXCLUDED_PACKAGES) ): folders.append(node) folders = sorted(folders) @@ -116,21 +110,34 @@ def CheckCoherenceBetweenDeclarationAndReality() -> None: raise ValueError( f"Mismatch between declared and found packages:\n" f" - Declared=\n {packages}\n" - f" - Found=\n {folders}" + f" - Found=\n {folders}\n" + f" - Undeclared=\n {set(folders).difference(packages)}\n" + f" - Nonexistent=\n {set(packages).difference(folders)}" ) -def Version(): +def Version() -> str: """""" - contents = {} - with open(HERE / IMPORT_NAME / "version.py") as accessor: - exec(accessor.read(), contents) + where = HERE / DESCRIPTION["IMPORT_NAME"] / "version.py" + spec = util.spec_from_file_location(where.stem, where) + module = spec.loader.load_module(spec.name) - output = contents["__version__"] + output = module.__version__ if isinstance(output, str) and rgex.fullmatch(r"20[0-9]{2}\.[1-9][0-9]*", output): return output - raise ValueError(f"Invalid version: {output}.") + raise ValueError(f"{output}: Invalid version") + + +def Requirements() -> tuple[str, ...]: + """""" + if not (HERE / "requirements.txt").is_file(): + return () + + with open(HERE / "requirements.txt") as accessor: + output = accessor.readlines() + + return tuple(output) if __name__ == "__main__": @@ -141,19 +148,19 @@ if __name__ == "__main__": author=DESCRIPTION["AUTHOR"], author_email=DESCRIPTION["EMAIL"], # - name=PYPI_NAME, + name=DESCRIPTION["PYPI_NAME"], description=DESCRIPTION["SHORT_DESCRIPTION"], long_description=long_description, long_description_content_type="text/x-rst", - license=LICENSE_SHORT, + license=DESCRIPTION["LICENSE_SHORT"], version=Version(), # classifiers=[ - f"Topic :: {PYPI_TOPIC}", - f"Intended Audience :: {PYPI_AUDIENCE}", - f"License :: OSI Approved :: {LICENCE_LONG} ({LICENSE_SHORT})", - f"Programming Language :: Python :: {PY_VERSION}", - f"Development Status :: {PYPI_STATUS}", + f"Topic :: {DESCRIPTION['PYPI_TOPIC']}", + f"Intended Audience :: {DESCRIPTION['PYPI_AUDIENCE']}", + f"License :: OSI Approved :: {DESCRIPTION['LICENCE_LONG']} ({DESCRIPTION['LICENSE_SHORT']})", + f"Programming Language :: Python :: {DESCRIPTION['PY_VERSION_MAJOR']}", + f"Development Status :: {DESCRIPTION['PYPI_STATUS']}", ], keywords=DESCRIPTION["KEYWORDS"], # @@ -165,6 +172,6 @@ if __name__ == "__main__": # packages=PACKAGES, entry_points=ENTRY_POINTS, - python_requires=f">={PY_VERSION_MIN}", - install_requires=[], + python_requires=f">={DESCRIPTION['PY_VERSION_MIN']}", + install_requires=Requirements(), ) diff --git a/test/main.py b/test/main.py index c3e2156..ecbf1d4 100644 --- a/test/main.py +++ b/test/main.py @@ -1,4 +1,4 @@ -# Copyright CNRS/Inria/UCA +# Copyright CNRS/Inria/UniCA # Contributor(s): Eric Debreuve (since 2023) # # eric.debreuve@cnrs.fr -- GitLab