From 0b5a3b883fe8f08e0f8d34198ab3c44b39728159 Mon Sep 17 00:00:00 2001 From: Maxime Vergez Date: Mon, 5 Dec 2022 11:40:32 +0100 Subject: [PATCH] feat: packaged module --- .gitignore | 2 +- MANIFEST.in | 3 ++ backend/gn_module_monitoring/__init__.py | 2 + .../{ => gn_module_monitoring}/blueprint.py | 0 .../gn_module_monitoring/command/__init__.py | 0 .../{ => gn_module_monitoring}/command/cmd.py | 0 .../command/utils.py | 0 .../gn_module_monitoring}/conf_schema_toml.py | 0 .../config}/__init__.py | 0 .../config/data_utils.py | 0 .../config/repositories.py | 0 .../config/utils.py | 2 +- .../modules}/__init__.py | 0 .../modules/repositories.py | 0 .../monitoring}/__init__.py | 0 .../monitoring/base.py | 0 .../monitoring/definitions.py | 0 .../monitoring/geom.py | 0 .../monitoring/models.py | 0 .../monitoring/objects.py | 0 .../monitoring/repositories.py | 0 .../monitoring/serializer.py | 0 .../monitoring/utils.py | 0 .../routes/__init__.py | 0 .../routes/config.py | 0 .../routes/data_utils.py | 0 .../routes/decorators.py | 0 .../routes/modules.py | 0 .../routes/monitoring.py | 0 .../{ => gn_module_monitoring}/routes/test.py | 0 .../utils}/__init__.py | 0 .../{ => gn_module_monitoring}/utils/env.py | 0 .../{ => gn_module_monitoring}/utils/utils.py | 0 .../utils/utilsjsonschema.py | 0 backend/monitoring/__init__.py | 0 backend/utils/__init__.py | 0 manifest.toml | 6 --- pyproject.toml | 17 +++++++ requirements.txt => requirements.in | 0 setup.py | 49 +++++++++++++++++++ 40 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 MANIFEST.in create mode 100644 backend/gn_module_monitoring/__init__.py rename backend/{ => gn_module_monitoring}/blueprint.py (100%) rename __init__.py => backend/gn_module_monitoring/command/__init__.py (100%) rename backend/{ => gn_module_monitoring}/command/cmd.py (100%) rename backend/{ => gn_module_monitoring}/command/utils.py (100%) rename {config => backend/gn_module_monitoring}/conf_schema_toml.py (100%) rename backend/{ => gn_module_monitoring/config}/__init__.py (100%) rename backend/{ => gn_module_monitoring}/config/data_utils.py (100%) rename backend/{ => gn_module_monitoring}/config/repositories.py (100%) rename backend/{ => gn_module_monitoring}/config/utils.py (99%) rename backend/{command => gn_module_monitoring/modules}/__init__.py (100%) rename backend/{ => gn_module_monitoring}/modules/repositories.py (100%) rename backend/{config => gn_module_monitoring/monitoring}/__init__.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/base.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/definitions.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/geom.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/models.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/objects.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/repositories.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/serializer.py (100%) rename backend/{ => gn_module_monitoring}/monitoring/utils.py (100%) rename backend/{ => gn_module_monitoring}/routes/__init__.py (100%) rename backend/{ => gn_module_monitoring}/routes/config.py (100%) rename backend/{ => gn_module_monitoring}/routes/data_utils.py (100%) rename backend/{ => gn_module_monitoring}/routes/decorators.py (100%) rename backend/{ => gn_module_monitoring}/routes/modules.py (100%) rename backend/{ => gn_module_monitoring}/routes/monitoring.py (100%) rename backend/{ => gn_module_monitoring}/routes/test.py (100%) rename backend/{modules => gn_module_monitoring/utils}/__init__.py (100%) rename backend/{ => gn_module_monitoring}/utils/env.py (100%) rename backend/{ => gn_module_monitoring}/utils/utils.py (100%) rename backend/{ => gn_module_monitoring}/utils/utilsjsonschema.py (100%) delete mode 100644 backend/monitoring/__init__.py delete mode 100644 backend/utils/__init__.py delete mode 100644 manifest.toml create mode 100644 pyproject.toml rename requirements.txt => requirements.in (100%) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index fe31849bb..98dd43081 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ config/conf_gn_module.toml config/monitoring/* !config/monitoring/generic frontend/assets/*.jpg - +*.egg-info # Node .npm diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..367824a2b --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include VERSION +include README.md +include requirements.in \ No newline at end of file diff --git a/backend/gn_module_monitoring/__init__.py b/backend/gn_module_monitoring/__init__.py new file mode 100644 index 000000000..a797bae29 --- /dev/null +++ b/backend/gn_module_monitoring/__init__.py @@ -0,0 +1,2 @@ +MODULE_CODE = "MONITORINGS" +MODULE_PICTO = "fa-puzzle-piece" \ No newline at end of file diff --git a/backend/blueprint.py b/backend/gn_module_monitoring/blueprint.py similarity index 100% rename from backend/blueprint.py rename to backend/gn_module_monitoring/blueprint.py diff --git a/__init__.py b/backend/gn_module_monitoring/command/__init__.py similarity index 100% rename from __init__.py rename to backend/gn_module_monitoring/command/__init__.py diff --git a/backend/command/cmd.py b/backend/gn_module_monitoring/command/cmd.py similarity index 100% rename from backend/command/cmd.py rename to backend/gn_module_monitoring/command/cmd.py diff --git a/backend/command/utils.py b/backend/gn_module_monitoring/command/utils.py similarity index 100% rename from backend/command/utils.py rename to backend/gn_module_monitoring/command/utils.py diff --git a/config/conf_schema_toml.py b/backend/gn_module_monitoring/conf_schema_toml.py similarity index 100% rename from config/conf_schema_toml.py rename to backend/gn_module_monitoring/conf_schema_toml.py diff --git a/backend/__init__.py b/backend/gn_module_monitoring/config/__init__.py similarity index 100% rename from backend/__init__.py rename to backend/gn_module_monitoring/config/__init__.py diff --git a/backend/config/data_utils.py b/backend/gn_module_monitoring/config/data_utils.py similarity index 100% rename from backend/config/data_utils.py rename to backend/gn_module_monitoring/config/data_utils.py diff --git a/backend/config/repositories.py b/backend/gn_module_monitoring/config/repositories.py similarity index 100% rename from backend/config/repositories.py rename to backend/gn_module_monitoring/config/repositories.py diff --git a/backend/config/utils.py b/backend/gn_module_monitoring/config/utils.py similarity index 99% rename from backend/config/utils.py rename to backend/gn_module_monitoring/config/utils.py index f22ebfa1e..792d6a67a 100644 --- a/backend/config/utils.py +++ b/backend/gn_module_monitoring/config/utils.py @@ -12,7 +12,7 @@ # chemin ver le repertoire de la config MONITORING_CONFIG_PATH = os.path.dirname(os.path.abspath( - __file__)) + '/../../config/monitoring' + __file__)) + '/../../../config/monitoring' def get_monitoring_module(module_code): diff --git a/backend/command/__init__.py b/backend/gn_module_monitoring/modules/__init__.py similarity index 100% rename from backend/command/__init__.py rename to backend/gn_module_monitoring/modules/__init__.py diff --git a/backend/modules/repositories.py b/backend/gn_module_monitoring/modules/repositories.py similarity index 100% rename from backend/modules/repositories.py rename to backend/gn_module_monitoring/modules/repositories.py diff --git a/backend/config/__init__.py b/backend/gn_module_monitoring/monitoring/__init__.py similarity index 100% rename from backend/config/__init__.py rename to backend/gn_module_monitoring/monitoring/__init__.py diff --git a/backend/monitoring/base.py b/backend/gn_module_monitoring/monitoring/base.py similarity index 100% rename from backend/monitoring/base.py rename to backend/gn_module_monitoring/monitoring/base.py diff --git a/backend/monitoring/definitions.py b/backend/gn_module_monitoring/monitoring/definitions.py similarity index 100% rename from backend/monitoring/definitions.py rename to backend/gn_module_monitoring/monitoring/definitions.py diff --git a/backend/monitoring/geom.py b/backend/gn_module_monitoring/monitoring/geom.py similarity index 100% rename from backend/monitoring/geom.py rename to backend/gn_module_monitoring/monitoring/geom.py diff --git a/backend/monitoring/models.py b/backend/gn_module_monitoring/monitoring/models.py similarity index 100% rename from backend/monitoring/models.py rename to backend/gn_module_monitoring/monitoring/models.py diff --git a/backend/monitoring/objects.py b/backend/gn_module_monitoring/monitoring/objects.py similarity index 100% rename from backend/monitoring/objects.py rename to backend/gn_module_monitoring/monitoring/objects.py diff --git a/backend/monitoring/repositories.py b/backend/gn_module_monitoring/monitoring/repositories.py similarity index 100% rename from backend/monitoring/repositories.py rename to backend/gn_module_monitoring/monitoring/repositories.py diff --git a/backend/monitoring/serializer.py b/backend/gn_module_monitoring/monitoring/serializer.py similarity index 100% rename from backend/monitoring/serializer.py rename to backend/gn_module_monitoring/monitoring/serializer.py diff --git a/backend/monitoring/utils.py b/backend/gn_module_monitoring/monitoring/utils.py similarity index 100% rename from backend/monitoring/utils.py rename to backend/gn_module_monitoring/monitoring/utils.py diff --git a/backend/routes/__init__.py b/backend/gn_module_monitoring/routes/__init__.py similarity index 100% rename from backend/routes/__init__.py rename to backend/gn_module_monitoring/routes/__init__.py diff --git a/backend/routes/config.py b/backend/gn_module_monitoring/routes/config.py similarity index 100% rename from backend/routes/config.py rename to backend/gn_module_monitoring/routes/config.py diff --git a/backend/routes/data_utils.py b/backend/gn_module_monitoring/routes/data_utils.py similarity index 100% rename from backend/routes/data_utils.py rename to backend/gn_module_monitoring/routes/data_utils.py diff --git a/backend/routes/decorators.py b/backend/gn_module_monitoring/routes/decorators.py similarity index 100% rename from backend/routes/decorators.py rename to backend/gn_module_monitoring/routes/decorators.py diff --git a/backend/routes/modules.py b/backend/gn_module_monitoring/routes/modules.py similarity index 100% rename from backend/routes/modules.py rename to backend/gn_module_monitoring/routes/modules.py diff --git a/backend/routes/monitoring.py b/backend/gn_module_monitoring/routes/monitoring.py similarity index 100% rename from backend/routes/monitoring.py rename to backend/gn_module_monitoring/routes/monitoring.py diff --git a/backend/routes/test.py b/backend/gn_module_monitoring/routes/test.py similarity index 100% rename from backend/routes/test.py rename to backend/gn_module_monitoring/routes/test.py diff --git a/backend/modules/__init__.py b/backend/gn_module_monitoring/utils/__init__.py similarity index 100% rename from backend/modules/__init__.py rename to backend/gn_module_monitoring/utils/__init__.py diff --git a/backend/utils/env.py b/backend/gn_module_monitoring/utils/env.py similarity index 100% rename from backend/utils/env.py rename to backend/gn_module_monitoring/utils/env.py diff --git a/backend/utils/utils.py b/backend/gn_module_monitoring/utils/utils.py similarity index 100% rename from backend/utils/utils.py rename to backend/gn_module_monitoring/utils/utils.py diff --git a/backend/utils/utilsjsonschema.py b/backend/gn_module_monitoring/utils/utilsjsonschema.py similarity index 100% rename from backend/utils/utilsjsonschema.py rename to backend/gn_module_monitoring/utils/utilsjsonschema.py diff --git a/backend/monitoring/__init__.py b/backend/monitoring/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/backend/utils/__init__.py b/backend/utils/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/manifest.toml b/manifest.toml deleted file mode 100644 index e21c0f8b6..000000000 --- a/manifest.toml +++ /dev/null @@ -1,6 +0,0 @@ -package_format_version = '1' -module_code = 'MONITORINGS' -module_version = '0.3.0' -min_geonature_version = '2.10.0' -max_geonature_version = '3.0.0' -exclude_geonature_versions = [ ] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..e3efdf334 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[tool.pytest.ini_options] +minversion = "6.0" +testpaths = [ + "backend", +] + +[tool.coverage.run] +source = [ + "gn_module_monitoring", +] +omit = [ + "*/tests/*", + "*/migrations/*", +] + +[tool.black] +line-length = 99 \ No newline at end of file diff --git a/requirements.txt b/requirements.in similarity index 100% rename from requirements.txt rename to requirements.in diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..3d486f968 --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +import setuptools +from pathlib import Path + + +root_dir = Path(__file__).absolute().parent +with (root_dir / 'VERSION').open() as f: + version = f.read() +with (root_dir / 'README.rst').open() as f: + long_description = f.read() +with (root_dir / 'requirements.in').open() as f: + requirements = f.read().splitlines() + + +setuptools.setup( + name='gn_module_monitoring', + version=version, + description="GeoNature", + long_description=long_description, + long_description_content_type='text/markdown', + maintainer='Parcs nationaux des Écrins et des Cévennes', + maintainer_email='geonature@ecrins-parcnational.fr', + url='https://github.com/PnX-SI/gn_module_monitoring', + packages=setuptools.find_packages('backend'), + package_dir={'': 'backend'}, + package_data={'gn_module_monitoring.migrations': ['data/*.sql']}, + install_requires=requirements, + tests_require=[], + zip_safe=False, + entry_points={ + 'gn_module': [ + 'code = gn_module_monitoring:MODULE_CODE', + 'picto = gn_module_monitoring:MODULE_PICTO', + 'blueprint = gn_module_monitoring.blueprint:blueprint', + 'config_schema = gn_module_monitoring.conf_schema_toml:GnModuleSchemaConf', + #'migrations = gn_module_monitoring:migrations', + ], + }, + classifiers=['Development Status :: 1 - Planning', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: GNU Affero General Public License v3' + 'Operating System :: OS Independent'], +) \ No newline at end of file