diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2bfe91..a5bb753 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,16 +20,14 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: restore cached dependencies + - name: load cached `~/.local` uses: actions/cache@v2 with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.py') }} - restore-keys: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}- - - name: install dependencies - run: pip install --upgrade pip setuptools wheel + path: ~/.local + key: ${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'setup.*') }} + restore-keys: ${{ runner.os }}-python${{ matrix.python-version }}- - name: build wheel - run: pip wheel . -w dist + run: pip wheel . -w dist --no-deps - name: save wheel uses: actions/upload-artifact@v2 with: @@ -43,6 +41,8 @@ jobs: uses: actions/checkout@v2 - name: install Python uses: actions/setup-python@v2 + - name: install dependencies + run: pip install dunamai - name: package source run: python setup.py sdist - name: save source package diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml deleted file mode 100644 index 6288725..0000000 --- a/.github/workflows/formatting.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: formatting - -on: pull_request - -jobs: - format: - name: format - runs-on: ubuntu-latest - steps: - - name: clone repository - uses: actions/checkout@v2 - - name: install Python - uses: actions/setup-python@v2 - - name: install dependencies - run: pip install ".[development]" - - name: run linters / formatters - uses: wearerequired/lint-action@master - with: - oitnb_command_prefix: isort --fss --fass .; - oitnb: true - auto_fix: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 44c7a94..e2e7736 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.local - key: ${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} + key: ${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'setup.*') }} restore-keys: ${{ runner.os }}-python${{ matrix.python-version }}- - name: install dependencies run: pip install ".[development]" @@ -37,7 +37,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - python-version: [ '3.7', '3.x' ] + python-version: [ '3.6', '3.x' ] steps: - name: clone repository uses: actions/checkout@v2 @@ -49,7 +49,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.local - key: ${{ runner.os }}-python${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('setup.py') }} + key: ${{ runner.os }}-python${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'setup.*') }} restore-keys: ${{ runner.os }}-python${{ matrix.python-version }}- - name: install `pipwin` on Windows if: contains(matrix.os, 'windows') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a054380 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "dunamai", + "setuptools", +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 6d152c1..e7750c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,14 +1,38 @@ [metadata] name = stormevents -lead_developer = Zachary Burnett -author = Jaime R Calzada, Zachary Burnett, William Pringle -author_email = jreniel@gmail.com, zachary.burnett@noaa.gov, wpringle@anl.gov +author = Zach Burnett , William Pringle , Jaime R Calzada description = Python interfaces for observational data surrounding named storm events -long_description = file: README.md -long_description_content_type = 'text/markdown' +long_description = file:README.md +long_description_content_type = text/markdown license = GPL -url = https://github.com/zacharyburnettNOAA/StormEvents.git +python_requires = >=3.6 +url = https://github.com/noaa-ocs-modeling/StormEvents.git -[nosetests] -exe = True -tests = tests/ +[options] +install_requires = + bs4 + geopandas + numpy + python-dateutil + pandas + pooch + pyproj >= 2.6 + requests + shapely + typepigeon >= 1.0.5 + xarray + +[options.extras_require] +testing = + pytest + pytest-cov + pytest-socket + pytest-xdist +development = + flake8 + isort + oitnb +documentation = + m2r2 + sphinx + sphinx-rtd-theme diff --git a/setup.py b/setup.py index 1820baf..f3931b6 100644 --- a/setup.py +++ b/setup.py @@ -1,79 +1,12 @@ -import os -from pathlib import Path -import subprocess -import sys +import warnings -from setuptools import config, find_packages, setup - -DEPENDENCIES = [ - 'bs4', - 'geopandas', - 'numpy', - 'python-dateutil', - 'pandas', - 'pooch', - 'pyproj>=2.6', - 'requests', - 'shapely', - 'typepigeon>=1.0.5', - 'xarray', -] - -if (Path(sys.prefix) / 'conda-meta').exists() or os.name == 'nt': - try: - import gartersnake - - MISSING_DEPENDENCIES = gartersnake.missing_requirements(DEPENDENCIES) - - if len(MISSING_DEPENDENCIES) > 0: - print( - f'{len(MISSING_DEPENDENCIES)} (out of {len(DEPENDENCIES)}) dependencies are missing') - - if len(MISSING_DEPENDENCIES) > 0 and gartersnake.is_conda(): - gartersnake.install_conda_requirements(MISSING_DEPENDENCIES) - MISSING_DEPENDENCIES = gartersnake.missing_requirements( - DEPENDENCIES) - - if len(MISSING_DEPENDENCIES) > 0 and gartersnake.is_windows(): - gartersnake.install_windows_requirements(MISSING_DEPENDENCIES) - MISSING_DEPENDENCIES = gartersnake.missing_requirements( - DEPENDENCIES) - except: - pass +from dunamai import Version +from setuptools import find_packages, setup try: - try: - import dunamai - except ImportError: - subprocess.run( - f'{sys.executable} -m pip install dunamai', - shell=True, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - ) - - from dunamai import Version - __version__ = Version.from_any_vcs().serialize() -except (ModuleNotFoundError, RuntimeError) as error: - print(error) +except RuntimeError as error: + warnings.warn(f'{error.__class__.__name__} - {error}') __version__ = '0.0.0' -print(f'using version {__version__}') - -metadata = config.read_configuration('setup.cfg')['metadata'] - -setup( - **metadata, - version=__version__, - packages=find_packages(), - python_requires='>=3.6', - setup_requires=['dunamai', 'setuptools>=41.2'], - install_requires=DEPENDENCIES, - extras_require={ - 'testing': ['pytest', 'pytest-cov', 'pytest-socket', - 'pytest-xdist'], - 'development': ['flake8', 'isort', 'oitnb'], - 'documentation': ['m2r2', 'sphinx', 'sphinx-rtd-theme'], - }, -) +setup(version=__version__, packages=find_packages(exclude=('tests',)), test_suite='tests')