From c3e0a45d001c74df554407dfbdfe151193ae7881 Mon Sep 17 00:00:00 2001 From: John-Sharples Date: Wed, 18 Sep 2024 18:54:56 +0000 Subject: [PATCH 1/2] 461: move to pyproject.toml for build --- metplotpy/__init__.py | 7 +++++++ pyproject.toml | 32 ++++++++++++++++++++++++++++++++ setup.py | 29 ----------------------------- 3 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/metplotpy/__init__.py b/metplotpy/__init__.py index e69de29b..d8d4b110 100644 --- a/metplotpy/__init__.py +++ b/metplotpy/__init__.py @@ -0,0 +1,7 @@ +from distutils.util import convert_path + +main_ns = {} +version_path = convert_path('docs/version') +with open(version_path) as version_file: + exec(version_file.read(), main_ns) +__version__ = main_ns['__version__'] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..8e451052 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "metplotpy" +dynamic = ["version"] +description = "plotting package for METplus" +authors = [ + {name = "METplus", email = "met-help@ucar.edu"}, +] +dependencies = [] +requires-python = ">=3.10.4" +readme = "README.md" +license = {text = "MIT"} +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", +] + +[project.urls] +Homepage = "https://github.com/dtcenter/METplotpy" + +[tool.setuptools] +packages = ["metplotpy"] + +[tool.pytest.ini_options] +testpaths = ["test"] + +[tool.coverage.run] +source = ["metplotpy"] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index d91b5711..00000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -import setuptools -from setuptools import setup, find_packages -from distutils.util import convert_path - -with open("README.md", "r") as fh: - long_description = fh.read() - -main_ns = {} -version_path = convert_path('docs/version') -with open(version_path) as version_file: - exec(version_file.read(), main_ns) - -setuptools.setup( - name="metplotpy", - version=main_ns['__version__'], - author="METplus", - author_email="met-help@ucar.edu", - description="plotting package for METplus", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/dtcenter/METplotpy", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires='>=3.6', -) From 61d18ecf13db93cee1580076a04b9a77f5bd72ff Mon Sep 17 00:00:00 2001 From: John-Sharples Date: Wed, 18 Sep 2024 20:06:28 +0000 Subject: [PATCH 2/2] 461: update docs and sonarQube --- docs/Users_Guide/installation.rst | 22 +++++++++++++++++++ .../sonarqube/sonar-project.properties | 4 ++-- pyproject.toml | 9 +++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/docs/Users_Guide/installation.rst b/docs/Users_Guide/installation.rst index ce5532cc..a7bed344 100644 --- a/docs/Users_Guide/installation.rst +++ b/docs/Users_Guide/installation.rst @@ -20,6 +20,28 @@ file at the top level of the repository. .. literalinclude:: ../../requirements.txt +Install METplotpy +------------------- + +METplotpy can be installed into a conda environment. First navigate to the +base directory, then run the following commands. + +.. code-block:: ini + + $ conda create -n "metplotpy" python=3.10.4 pip + $ conda activate metplotpy + (metplotpy)$ pip install -e . + +This will install METplotpy into the conda env, along with all the dependancies +listed above in **requirements.txt**. + +If you already have an environment setup, or want to install METplotpy without +the dependancies, add the `--no-deps` argument to pip. + +.. code-block:: ini + + $ pip install -e . --no-deps + .. _METcalcpy_conda: Install METcalcpy in the Conda Environment diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index 0777e588..ea63fbd9 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -3,8 +3,8 @@ sonar.projectKey=METplotpy sonar.projectName=METplotpy sonar.projectVersion=SONAR_PROJECT_VERSION sonar.branch.name=SONAR_BRANCH_NAME -sonar.sources=metplotpy,test -sonar.coverage.exclusions=test/** +sonar.sources=metplotpy +sonar.coverage.exclusions=test/**,contributed/** sonar.python.coverage.reportPaths=coverage.xml sonar.sourceEncoding=UTF-8 diff --git a/pyproject.toml b/pyproject.toml index 8e451052..651f426d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,11 @@ build-backend = "setuptools.build_meta" [project] name = "metplotpy" -dynamic = ["version"] +dynamic = ["version", "dependencies"] description = "plotting package for METplus" authors = [ {name = "METplus", email = "met-help@ucar.edu"}, ] -dependencies = [] requires-python = ">=3.10.4" readme = "README.md" license = {text = "MIT"} @@ -22,6 +21,10 @@ classifiers = [ [project.urls] Homepage = "https://github.com/dtcenter/METplotpy" +[tool.setuptools.dynamic] +version = {attr = "metplotpy.__version__"} +dependencies = {file = ["requirements.txt"]} + [tool.setuptools] packages = ["metplotpy"] @@ -29,4 +32,4 @@ packages = ["metplotpy"] testpaths = ["test"] [tool.coverage.run] -source = ["metplotpy"] \ No newline at end of file +source = ["metplotpy/plots"] \ No newline at end of file