Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update build system #19

Merged
3 commits merged into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/formatting.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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
Expand All @@ -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')
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"dunamai",
"setuptools",
]
build-backend = "setuptools.build_meta"
42 changes: 33 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
[metadata]
name = stormevents
lead_developer = Zachary Burnett
author = Jaime R Calzada, Zachary Burnett, William Pringle
author_email = [email protected], [email protected], [email protected]
author = Zach Burnett <[email protected]>, William Pringle <[email protected]>, Jaime R Calzada <[email protected]>
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
79 changes: 6 additions & 73 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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')