Skip to content

Commit

Permalink
refactor(setup): convert project to use pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
aleaf committed Jan 15, 2024
1 parent 585fe20 commit 8fa3c57
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 200 deletions.
13 changes: 0 additions & 13 deletions AUTHORS.rst

This file was deleted.

2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include Readme.md
include requirements.txt

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
Expand All @@ -10,7 +9,6 @@ include versioneer.py
include mfsetup/_version.py
include mfsetup/mfnwt_defaults.yml
include mfsetup/mf6_defaults.yml
include mfsetup/tests/data/shellmound.yml

# If including data files in the package, add them like:
# include path/to/data_file
84 changes: 83 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,89 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = [
"setuptools >= 61",
#"wheel"
#'tomli; python_version < "3.11"',
]
build-backend = "setuptools.build_meta"

[project]
name = "modflow-setup"
dynamic = ["version"]
authors = [
{ name = "Andrew Leaf", email = "[email protected]" },
{ name = "Mike Fienen", email = "[email protected]" },
]
description = "Rapid and robust construction of MODFLOW groundwater flow models"
readme = "Readme.md"
keywords = ["MODFLOW", "groundwater", "hydrogeology"]
license = {file = "LICENSE.md"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Scientific/Engineering :: Hydrology",
]
requires-python = ">=3.11"
dependencies = [
"geopandas",
"gis-utils",
"fiona",
"flopy",
"modflow-export",
"netcdf4",
"numpy",
"pandas",
"pyproj",
"pyyaml",
"rasterio",
"rasterstats",
"rtree",
"scipy",
"sfrmaker",
"shapely",
"xarray",
]

[project.optional-dependencies]
optional = [
"matplotlib",

]
test = [
"codecov",
"coverage",
"pytest",
"pytest-timeout"
]
docs = [
"matplotlib",
"modflow-export[optional]",
"ipython[kernel]",
"sphinx",
"numpydoc",
"nbsphinx",
"sphinx-copybutton",
"sphinx-rtd-theme"
]

[project.scripts]
get-modflow = "flopy.utils.get_modflow:cli_main"

[project.urls]
documentation = "https://doi-usgs.github.io/modflow-setup/latest/"
repository = "https://github.com/doi-usgs/modflow-setup"

[tool.setuptools.packages.find]
include = ["mfsetup", "mfsetup.*"]

[tool.versioneer]
VCS = "git"
style = "pep440-post"
versionfile_source = "mfsetup/_version.py"
versionfile_build = "mfsetup/_version.py"
tag_prefix = "v"
parentdir_prefix = "mfsetup-"

[tool.isort]
default_section = "THIRDPARTY"
known_first_party = ["xarray"]
Expand Down
29 changes: 0 additions & 29 deletions requirements-dev.txt

This file was deleted.

42 changes: 0 additions & 42 deletions requirements-dev.yml

This file was deleted.

14 changes: 0 additions & 14 deletions requirements.txt

This file was deleted.

31 changes: 0 additions & 31 deletions requirements.yml

This file was deleted.

7 changes: 0 additions & 7 deletions setup.cfg

This file was deleted.

66 changes: 5 additions & 61 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,74 +1,18 @@
import os
import sys
from os import path

from setuptools import find_packages, setup
from setuptools import setup

# ensure the current directory is on sys.path so versioneer can be imported
# when pip uses PEP 517/518 build rules.
# https://github.com/python-versioneer/python-versioneer/issues/193
sys.path.append(path.dirname(__file__))

import versioneer # noqa: E402

# NOTE: This file must remain Python 2 compatible for the foreseeable future,
# to ensure that we error out properly for people with outdated setuptools
# and/or pip.
min_version = (3, 6)
if sys.version_info < min_version:
error = """
modflow-setup does not support Python {0}.{1}.
Python {2}.{3} and above is required. Check your Python version like so:
python3 --version
This may be due to an out-of-date pip. Make sure you have pip >= 9.0.1.
Upgrade pip like so:
pip install --upgrade pip
""".format(*(sys.version_info[:2] + min_version))
sys.exit(error)

here = path.abspath(path.dirname(__file__))

with open(path.join(here, 'Readme.md'), encoding='utf-8') as readme_file:
readme = readme_file.read()

with open(path.join(here, 'requirements.txt')) as requirements_file:
# Parse requirements.txt, ignoring any commented-out lines.
requirements = [line for line in requirements_file.read().splitlines()
if not line.startswith('#')]
sys.path.append(os.path.dirname(__file__))

import versioneer

# see pyproject.toml for static project metadata
setup(
name='modflow-setup',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Robust automation of MODFLOW model construction.",
long_description=readme,
long_description_content_type='text/markdown',
author="USGS MAP Project",
author_email='[email protected]',
url='https://github.com/aleaf/modflow-setup',
python_requires='>={}'.format('.'.join(str(n) for n in min_version)),
packages=find_packages(exclude=['docs', 'tests']),
entry_points={
'console_scripts': [
# 'some.module:some_function',
],
},
include_package_data=True,
package_data={
'modflow-setup': [
# When adding files here, remember to update MANIFEST.in as well,
# or else they will not be included in the distribution on PyPI!
# 'path/to/data_file',
]
},
install_requires=requirements,
license="BSD (3-clause)",
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Natural Language :: English',
'Programming Language :: Python :: 3',
],
)

0 comments on commit 8fa3c57

Please sign in to comment.