From 4aa40b14499ff7c74ebc89b07e640fef460d59d1 Mon Sep 17 00:00:00 2001 From: John Sharples <41682323+John-Sharples@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:58:20 -0600 Subject: [PATCH] Feature #461 move to pyproject.toml (#462) * 461: move to pyproject.toml for build * 461: update docs and sonarQube --- docs/Users_Guide/installation.rst | 22 ++++++++++++ .../sonarqube/sonar-project.properties | 4 +-- metplotpy/__init__.py | 7 ++++ pyproject.toml | 35 +++++++++++++++++++ setup.py | 29 --------------- 5 files changed, 66 insertions(+), 31 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py 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/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..651f426d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "metplotpy" +dynamic = ["version", "dependencies"] +description = "plotting package for METplus" +authors = [ + {name = "METplus", email = "met-help@ucar.edu"}, +] +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.dynamic] +version = {attr = "metplotpy.__version__"} +dependencies = {file = ["requirements.txt"]} + +[tool.setuptools] +packages = ["metplotpy"] + +[tool.pytest.ini_options] +testpaths = ["test"] + +[tool.coverage.run] +source = ["metplotpy/plots"] \ 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', -)