-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: update pyproject.toml to replace setup.cfg (#134)
]* update README.md * update version to 1.2.9.dev0 * add pytest conftest.py * install test requirements for CI from pyproject.toml
- Loading branch information
1 parent
2d6ca3f
commit fecade8
Showing
11 changed files
with
243 additions
and
97 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,29 @@ | ||
[flake8] | ||
exclude = | ||
.git | ||
__pycache__ | ||
build | ||
dist | ||
examples | ||
autotest | ||
ignore = | ||
# https://flake8.pycqa.org/en/latest/user/error-codes.html | ||
F401, | ||
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes | ||
# Indentation | ||
E121, E122, E126, E127, E128, | ||
# Whitespace | ||
E203, E221, E222, E226, E231, E241, | ||
# Import | ||
E402, | ||
# Line length | ||
E501, E502, | ||
# Statement | ||
E722, E741, | ||
# Whitespace warning | ||
W291, W292, W293, | ||
# Blank line warning | ||
W391, | ||
# Line break warning | ||
W503, W504 | ||
statistics = True |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import contextlib | ||
import os | ||
import re | ||
from importlib import metadata | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
# import modflow-devtools fixtures | ||
|
||
pytest_plugins = ["modflow_devtools.fixtures"] | ||
|
||
|
||
# constants | ||
|
||
|
||
# misc utilities | ||
@contextlib.contextmanager | ||
def working_directory(path): | ||
"""Changes working directory and returns to previous on exit.""" | ||
prev_cwd = os.getcwd() | ||
os.chdir(path) | ||
try: | ||
yield | ||
finally: | ||
os.chdir(prev_cwd) | ||
|
||
|
||
def get_pymake_appdir(): | ||
appdir = Path.home() / ".pymake" | ||
appdir.mkdir(parents=True, exist_ok=True) | ||
return appdir | ||
|
||
|
||
def get_project_root_path() -> Path: | ||
return Path(__file__).parent.parent | ||
|
||
|
||
# path fixtures | ||
|
||
|
||
# pytest configuration hooks | ||
|
||
|
||
@pytest.hookimpl(hookwrapper=True, tryfirst=True) | ||
def pytest_runtest_makereport(item, call): | ||
# this is necessary so temp dir fixtures can | ||
# inspect test results and check for failure | ||
# (see https://doc.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures) | ||
|
||
outcome = yield | ||
rep = outcome.get_result() | ||
|
||
# report attribute for each phase (setup, call, teardown) | ||
# we're only interested in result of the function call | ||
setattr(item, "rep_" + rep.when, rep) | ||
|
||
|
||
def pytest_report_header(config): | ||
"""Header for pytest to show versions of packages.""" | ||
|
||
required = [] | ||
extra = {} | ||
for item in metadata.requires("flopy"): | ||
pkg_name = re.findall(r"[a-z0-9_\-]+", item, re.IGNORECASE)[0] | ||
if res := re.findall("extra == ['\"](.+)['\"]", item): | ||
assert len(res) == 1, item | ||
pkg_extra = res[0] | ||
if pkg_extra not in extra: | ||
extra[pkg_extra] = [] | ||
extra[pkg_extra].append(pkg_name) | ||
else: | ||
required.append(pkg_name) | ||
|
||
processed = set() | ||
lines = [] | ||
items = [] | ||
for name in required: | ||
processed.add(name) | ||
try: | ||
version = metadata.version(name) | ||
items.append(f"{name}-{version}") | ||
except metadata.PackageNotFoundError: | ||
items.append(f"{name} (not found)") | ||
lines.append("required packages: " + ", ".join(items)) | ||
installed = [] | ||
not_found = [] | ||
for name in extra["optional"]: | ||
if name in processed: | ||
continue | ||
processed.add(name) | ||
try: | ||
version = metadata.version(name) | ||
installed.append(f"{name}-{version}") | ||
except metadata.PackageNotFoundError: | ||
not_found.append(name) | ||
if installed: | ||
lines.append("optional packages: " + ", ".join(installed)) | ||
if not_found: | ||
lines.append("optional packages not found: " + ", ".join(not_found)) | ||
return "\n".join(lines) |
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,6 +1,6 @@ | ||
__author__ = "Joseph D. Hughes" | ||
__date__ = "July 5, 2023" | ||
__version__ = "1.2.8" | ||
__version__ = "1.2.9.dev0" | ||
__maintainer__ = "Joseph D. Hughes" | ||
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
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,14 +1,98 @@ | ||
[build-system] | ||
# Minimum requirements for the build system to execute | ||
requires = [ | ||
"setuptools>=45", | ||
"setuptools>=61", | ||
"wheel", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "mfpymake" | ||
description = "pymake is a Python package to compile MODFLOW-based models." | ||
authors = [ | ||
{ name = "mfpymake Team", email = "[email protected]" }, | ||
] | ||
maintainers = [ | ||
{ name = "Joseph D. Hughes", email = "[email protected]" }, | ||
] | ||
keywords = ["MODFLOW", "groundwater", "hydrogeology"] | ||
license = { text = "CC0" } | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Science/Research", | ||
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Scientific/Engineering :: Hydrology", | ||
] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
"numpy", | ||
"requests", | ||
"networkx >= 2.6.3", | ||
"meson", | ||
"ninja", | ||
"pydotplus", | ||
] | ||
dynamic = ["version", "readme"] | ||
[project.optional-dependencies] | ||
lint = [ | ||
"black", | ||
"cffconvert", | ||
"flake8", | ||
"isort", | ||
"pylint", | ||
] | ||
test = [ | ||
"mfpymake[lint]", | ||
"coverage", | ||
"flaky", | ||
"filelock", | ||
"pytest", | ||
"pytest-benchmark", | ||
"pytest-cases", | ||
"pytest-cov", | ||
"pytest-dotenv", | ||
"pytest-virtualenv", | ||
"pytest-xdist", | ||
"appdirs", | ||
"matplotlib", | ||
"modflow-devtools", | ||
"flopy", | ||
] | ||
[project.scripts] | ||
mfpymake = "pymake.cmds.mfpymakecli:main" | ||
make-program = "pymake.cmds.build:main" | ||
make-code-json = "pymake.cmds.createjson:main" | ||
|
||
|
||
[project.urls] | ||
Documentation = "https://mfpymake.readthedocs.io" | ||
"Release Notes" = "https://github.com/modflowpy/flopy/blob/develop/docs/version_changes.md" | ||
"Bug Tracker" = "https://github.com/modflowpy/pymake/issues" | ||
"Source Code" = "https://github.com/modflowpy/pymake" | ||
|
||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
zip-safe = false | ||
|
||
[tool.setuptools.dynamic] | ||
version = { attr = "pymake.config.__version__" } | ||
readme = { file = ["README.md"], content-type = "text/markdown" } | ||
|
||
[tool.setuptools.packages.find] | ||
include = ["pymake", "pymake.*"] | ||
|
||
[tool.setuptools.package-data] | ||
"pymake.utils" = ["usgsprograms.txt"] | ||
|
||
[tool.black] | ||
line-length = 79 | ||
target_version = ["py37"] | ||
target_version = ["py38"] | ||
|
||
[tool.flynt] | ||
line-length = 79 | ||
|
@@ -20,4 +104,4 @@ src_paths = ["pymake", "autotest", "examples"] | |
line_length = 79 | ||
|
||
[tool.setuptools_scm] | ||
fallback_version = "999" | ||
fallback_version = "999" |
Oops, something went wrong.