-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: modernize build with pyproject.toml
refactor: pyTMD updates to definition files and database
- Loading branch information
1 parent
a0973be
commit 3f3c1b1
Showing
18 changed files
with
155 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
[build-system] | ||
requires = ["setuptools>=64", "setuptools_scm>=8"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "Grounding-Zones" | ||
description = "Python Tools for Estimating Ice Sheet Grounding Zone Locations with ICESat-2" | ||
keywords = [ | ||
"ICESat-2 laser altimetry", | ||
"Elastic Bending", | ||
"Grounding Zones", | ||
"Ice Shelves", | ||
"Ice Sheets", | ||
] | ||
authors = [ | ||
{name = "Tyler Sutterley"}, | ||
{name = "Karen Alley"}, | ||
{name = "Kelly Brunt"}, | ||
{name = "Susan Howard"}, | ||
{name = "Laurie Padman"}, | ||
{name = "Matt Siegfried"}, | ||
{email = "[email protected]"} | ||
] | ||
maintainers = [{ name = "Grounding-Zones contributors" }] | ||
license = {file = "LICENSE"} | ||
readme = "README.rst" | ||
version = "1.0.0" | ||
|
||
requires-python = "~=3.6" | ||
dependencies = [ | ||
"lxml", | ||
"numpy", | ||
"pyproj", | ||
"python-dateutil", | ||
"pyTMD", | ||
"scipy>=1.10.1", | ||
"timescale>=0.0.3", | ||
] | ||
|
||
|
||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Scientific/Engineering :: Physics", | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://grounding-zones.readthedocs.io" | ||
Documentation = "https://grounding-zones.readthedocs.io" | ||
Repository = "https://github.com/tsutterley/Grounding-Zones" | ||
Issues = "https://github.com/tsutterley/Grounding-Zones/issues" | ||
|
||
[project.optional-dependencies] | ||
doc = ["docutils", "fontconfig", "freetype", "graphviz", "numpydoc", "sphinx", "sphinx-argparse>=0.4", "sphinx_rtd_theme"] | ||
all = ["cartopy", "earthengine-api", "gdal", "h5py", "matplotlib", "mpi4py", "notebook", "pyyaml", "scikit-learn", "shapely", "ATM1b-QFIT", "geoid-toolkit", "icesat2-toolkit", "spatial-interpolators"] | ||
dev = ["flake8", "pytest>=4.6", "pytest-cov"] | ||
|
||
[tool.setuptools.packages.find] | ||
exclude = ["test*", "run*"] | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
norecursedirs = ".git" | ||
python_files = [ | ||
"test*.py" | ||
] | ||
testpaths = [ | ||
"test" | ||
] | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
source = [ | ||
"Grounding-Zones", | ||
"test", | ||
] | ||
omit = [ | ||
"setup.py", | ||
"conf.py", | ||
"DAC/*", | ||
"DEM/*", | ||
"geoid/*", | ||
"GZ/*", | ||
"SL/*", | ||
"scripts/*", | ||
"subset/*", | ||
"tides/*", | ||
] | ||
|
||
[tool.coverage.report] | ||
show_missing = true | ||
precision = 2 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,12 @@ | ||
import os | ||
import sys | ||
import logging | ||
import subprocess | ||
from setuptools import setup, find_packages | ||
|
||
logging.basicConfig(stream=sys.stderr, level=logging.INFO) | ||
log = logging.getLogger() | ||
|
||
# package description and keywords | ||
description = 'Python Tools for Estimating Ice Sheet Grounding Zone Locations with ICESat-2' | ||
keywords = 'ICESat-2 laser altimetry, Elastic Bending, Grounding Zones, Ice Shelves, Ice Sheets' | ||
# get long_description from README.rst | ||
with open('README.rst', 'r', encoding='utf8') as fh: | ||
long_description = fh.read() | ||
long_description_content_type = "text/x-rst" | ||
|
||
# install requirements and dependencies | ||
on_rtd = os.environ.get('READTHEDOCS') == 'True' | ||
if on_rtd: | ||
install_requires = [] | ||
else: | ||
# get install requirements | ||
with open('requirements.txt', 'r', encoding='utf8') as fh: | ||
install_requires = [line.split().pop(0) for line in fh.read().splitlines()] | ||
|
||
# get version | ||
with open('version.txt', 'r', encoding='utf8') as fh: | ||
version = fh.read() | ||
from setuptools import setup | ||
|
||
# list of all scripts to be included with package | ||
scripts=[] | ||
for s in ['scripts','subset','DAC','DEM','geoid','GZ','SL','tides']: | ||
scripts.extend([os.path.join(s,f) for f in os.listdir(s) if f.endswith('.py')]) | ||
|
||
# run cmd from the command line | ||
def check_output(cmd): | ||
return subprocess.check_output(cmd).decode('utf') | ||
|
||
# check if GDAL is installed | ||
gdal_output = [None] * 4 | ||
try: | ||
for i, flag in enumerate(("--cflags", "--libs", "--datadir", "--version")): | ||
gdal_output[i] = check_output(['gdal-config', flag]).strip() | ||
except: | ||
log.warning('Failed to get options via gdal-config') | ||
else: | ||
log.info(f"GDAL version from via gdal-config: {gdal_output[3]}") | ||
# if setting GDAL version from via gdal-config | ||
if gdal_output[3] and ('gdal' in install_requires): | ||
# add version information to gdal in install_requires | ||
gdal_index = install_requires.index('gdal') | ||
install_requires[gdal_index] = f'gdal=={gdal_output[3]}' | ||
elif any(install_requires) and ('gdal' in install_requires): | ||
# gdal version not found | ||
gdal_index = install_requires.index('gdal') | ||
install_requires.pop(gdal_index) | ||
|
||
setup( | ||
name='grounding-zones', | ||
version=version, | ||
description=description, | ||
long_description=long_description, | ||
long_description_content_type=long_description_content_type, | ||
url='https://github.com/tsutterley/Grounding-Zones', | ||
author='Tyler Sutterley', | ||
author_email='[email protected]', | ||
license='MIT', | ||
classifiers=[ | ||
'Development Status :: 3 - Alpha', | ||
'Intended Audience :: Science/Research', | ||
'Topic :: Scientific/Engineering :: Physics', | ||
'License :: OSI Approved :: MIT License', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
], | ||
keywords=keywords, | ||
packages=find_packages(), | ||
install_requires=install_requires, | ||
scripts=scripts, | ||
include_package_data=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.