From 546baf5fe6e649d0eb3ebd1d632be5ffbc2d95e7 Mon Sep 17 00:00:00 2001 From: Charles Morton Date: Tue, 24 Oct 2023 11:10:56 -0700 Subject: [PATCH] Switching from setup.py to pyproject.toml Bumped version number to 0.6.3 --- .github/workflows/build.yml | 13 ++++----- MANIFEST.in | 5 ---- openet/refetgee/__init__.py | 10 ++++++- pyproject.toml | 44 ++++++++++++++++++++++++++++++ requirements.txt | 1 - requirements_test.txt | 3 --- setup.cfg | 2 -- setup.py | 54 ------------------------------------- 8 files changed, 58 insertions(+), 74 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements_test.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b55c901..2ef1246 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,26 +2,23 @@ name: build on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - - name: Set up Python 3.7 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements_test.txt + pip install .[test] pip install --upgrade pytest - name: Lint with flake8 run: | diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 82df3cc..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -exclude *.txt -include LICENSE.txt README.rst setup.py -recursive-include openet * -global-exclude *.py[co] -global-exclude __pycache__ diff --git a/openet/refetgee/__init__.py b/openet/refetgee/__init__.py index 796aba6..8d4cba6 100644 --- a/openet/refetgee/__init__.py +++ b/openet/refetgee/__init__.py @@ -1,4 +1,12 @@ +# try: +# from importlib import metadata +# except ImportError: # for Python<3.8 +# import importlib_metadata as metadata + from .daily import Daily from .hourly import Hourly -__version__ = '0.6.2' +# # __version__ = metadata.version(__package__ or __name__) +# __version__ = metadata.version(__package__.replace('.', '-') or __name__.replace('.', '-')) +# # __version__ = metadata.version('openet-refet-gee') + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..09d3f52 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +[project] +name = "openet-refet-gee" +version = "0.6.3" +authors = [ + { name = "Charles Morton", email = "charles.morton@dri.edu" }, +] +# maintainers = [ +# { name = "Charles Morton", email = "charles.morton@dri.edu" } +# ] +description = "Google Earth Engine based ASCE Standardized Reference Evapotranspiration Functions" +readme = "README.rst" +requires-python = ">=3.7" +keywords = ["RefET", "OpenET", "Earth Engine", "evapotranspiration"] +license = {file = "LICENSE.txt"} +# license = {text = "Apache-2.0"} +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", +] +dependencies = [ + "earthengine-api>=0.1.364", + "importlib-metadata; python_version <= '3.7'", +] + +[project.urls] +"Homepage" = "https://github.com/Open-ET/openet-refet-gee" +# "Repository" = "https://github.com/Open-ET/openet-refet-gee.git" +# "Documentation" = "https://github.com/Open-ET/openet-refet-gee" +# "Bug Tracker" = "https://github.com/Open-ET/openet-refet-gee" +# "Changelog" = "https://github.com/Open-ET/openet-refet-gee" + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project.optional-dependencies] +test = [ + "pytest", "pandas", "pytz" +] + +[tool.setuptools.packages.find] +# include = ["openet*"] +exclude = ["docs*", "examples*"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 573b63d..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -earthengine-api>=0.1.232 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index d06b583..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,3 +0,0 @@ -pytest>=4.0.0 -pandas -pytz \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b7e4789..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[aliases] -test=pytest diff --git a/setup.py b/setup.py deleted file mode 100644 index 255dae6..0000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -import codecs -import os -import re - -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -# Single sourcing code from here: -# https://packaging.python.org/guides/single-sourcing-package-version/ -here = os.path.abspath(os.path.dirname(__file__)) - -def read(*parts): - with codecs.open(os.path.join(here, *parts), 'r') as fp: - return fp.read() - -def find_version(*file_paths): - version_file = read(*file_paths) - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError('Unable to find version string.') - -version = find_version('openet', 'refetgee', '__init__.py') - -# Get the long description from the README file -here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: - long_description = f.read() - -setup( - name='openet-refet-gee', - version=version, - description='Google Earth Engine based ASCE Standardized Reference Evapotranspiration Functions', - long_description=long_description, - long_description_content_type='text/x-rst', - license='Apache', - author='Charles Morton', - author_email='charles.morton@dri.edu', - url='https://github.com/Open-ET/openet-refet-gee', - download_url='https://github.com/Open-ET/openet-refet-gee/archive/v{}.tar.gz'.format(version), - install_requires=['earthengine-api'], - setup_requires=['pytest-runner'], - tests_require=['pytest', 'pandas', 'pytz'], - packages=['openet.refetgee'], - keywords='RefET OpenET Evapotranspiration Earth Engine', - classifiers = [ - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7'], - zip_safe=False, -)