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

refactor(setup): prefer setup.cfg for package metadata, and other changes #1267

Merged
merged 1 commit into from
Oct 21, 2021
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
36 changes: 0 additions & 36 deletions .flake8

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ jobs:
- name: Run black
run: |
echo "if black check fails run"
echo " black --line-length 79 ./flopy"
echo " black ./flopy"
echo "and then commit the changes."
black --check --line-length 79 ./flopy
black --check ./flopy

- name: Run flake8
run: |
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Before you submit your Pull Request (PR) consider the following guidelines:
1. Run the [black formatter](https://github.com/psf/black) on Flopy source files from the git repository root directory using:

```shell
black -l 79 ./flopy
black ./flopy
```
Note: Pull Requests must pass black format checks run on the [GitHub actions](https://github.com/modflowpy/flopy/actions) (*linting*) before they will be accepted. The black formatter can be installed using [`pip`](https://pypi.org/project/black/) and [`conda`](https://anaconda.org/conda-forge/black).

Expand Down
10 changes: 4 additions & 6 deletions docs/make_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Instructions for making a FloPy release
5. Run `black` on the updated MODFLOW 6 package classes by running the following from the root directory:

```
black -l 79 flopy/mf6
black flopy/mf6
```


Expand Down Expand Up @@ -120,26 +120,24 @@ Use `run_notebooks.py` in the `release` directory to rerun all of the notebooks

## Update PyPi

1. Make sure `pypandoc` and `twine` are installed using:
1. Make sure `twine` is installed using:

```
conda search pypandoc
conda search twine
```


2. If they are not installed, install one or both using using:
2. If it is not installed, install using using:


```
conda install pypandoc
conda install twine
```

3. Create the source zip file in a terminal using:

```
python setup.py sdist --format=zip
python setup.py sdist
```

4. Upload the release to PyPi using (*make sure* `twine` *is installed using conda*):
Expand Down
4 changes: 2 additions & 2 deletions flopy/mf6/modflow/mfgwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(
save_flows=None,
newtonoptions=None,
packages=None,
**kwargs
**kwargs,
):
super().__init__(
simulation,
Expand All @@ -101,7 +101,7 @@ def __init__(
version=version,
exe_name=exe_name,
model_rel_path=model_rel_path,
**kwargs
**kwargs,
)

self.name_file.list.set_data(list)
Expand Down
4 changes: 2 additions & 2 deletions flopy/mf6/modflow/mfgwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
print_flows=None,
save_flows=None,
packages=None,
**kwargs
**kwargs,
):
super().__init__(
simulation,
Expand All @@ -95,7 +95,7 @@ def __init__(
version=version,
exe_name=exe_name,
model_rel_path=model_rel_path,
**kwargs
**kwargs,
)

self.name_file.list.set_data(list)
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
# Minimum requirements for the build system to execute
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79
target_version = ["py37"]
80 changes: 80 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[metadata]
name = flopy
version = attr: flopy.version.__version__
description = FloPy is a Python package to create, run, and post-process MODFLOW-based models
long_description = file: docs/PyPi_release.md
long_description_content_type = text/markdown
author = FloPy Team
author_email = modflow@usgs.gov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@langevin-usgs Not sure this is the author email we want but I can't think of another.

maintainer = Joseph D. Hughes
maintainer_email = jdhughes@usgs.gov
license = CC0
license_files = LICENSE, LICENSE.md
platform = Windows, Mac OS-X, Linux
keywords = MODFLOW, groundwater, hydrogeology
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Topic :: Scientific/Engineering :: Hydrology
url = https://github.com/modflowpy/flopy
download_url = https://pypi.org/project/flopy
project_urls =
Documentation = https://flopy.readthedocs.io
Release Notes = https://github.com/modflowpy/flopy/blob/develop/docs/version_changes.md
Bug Tracker = https://github.com/modflowpy/flopy/issues
Source Code = https://github.com/modflowpy/flopy

[options]
include_package_data = True # includes files listed in MANIFEST.in
zip_safe = False
packages = find:
python_requires = >=3.7
install_requires =
numpy >= 1.15.0
matplotlib >= 1.4.0

[options.package_data]
flopy.mf6.data = dfn/*.dfn
flopy.plot = mplstyle/*.mplstyle

[sdist]
formats = zip

[flake8]
exclude =
.git
__pycache__
build
dist
examples
autotest
ignore =
# https://flake8.pycqa.org/en/latest/user/error-codes.html
F401 # 'module' imported but unused
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
E121 # continuation line under-indented for hanging indent
E122 # continuation line missing indentation or outdented
E126 # continuation line over-indented for hanging indent
E127 # continuation line over-indented for visual indent
E128 # continuation line under-indented for visual indent
E203 # whitespace before
E221 # multiple spaces before operator
E222 # multiple spaces after operator
E226 # missing whitespace around arithmetic operator
E231 # missing whitespace after ','
E241 # multiple spaces after ','
E402 # module level import not at top of file
E501 # line too long (> 79 characters)
E502 # backslash is redundant between brackets
E722 # do not use bare 'except'
E741 # ambiguous variable name
W291 # trailing whitespace
W292 # no newline at end of file
W293 # blank line contains whitespace
W391 # blank line at end of file
W503 # line break before binary operator
W504 # line break after binary operator
statistics = True
56 changes: 1 addition & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,4 @@
import os
import sys
from setuptools import setup

# ensure minimum version of Python is running
if sys.version_info[0:2] < (3, 7):
raise RuntimeError("Flopy requires Python >= 3.7")

# local import of package variables in flopy/version.py
# imports __version__, __pakname__, __author__, __author_email__
exec(open(os.path.join("flopy", "version.py")).read())

try:
import pypandoc

fpth = os.path.join("docs", "PyPi_release.md")
long_description = pypandoc.convert(fpth, "rst")
except ImportError:
long_description = ""

setup(
name=__pakname__,
description="FloPy is a Python package to create, run, and "
+ "post-process MODFLOW-based models.",
long_description=long_description,
author=__author__,
author_email=__author_email__,
url="https://github.com/modflowpy/flopy/",
license="CC0",
platforms="Windows, Mac OS-X, Linux",
install_requires=[
"numpy>=1.15.0",
"matplotlib>=1.4.0",
],
packages=[
"flopy",
"flopy.modflow",
"flopy.modflowlgr",
"flopy.mfusg",
"flopy.modpath",
"flopy.mt3d",
"flopy.seawat",
"flopy.utils",
"flopy.plot",
"flopy.pest",
"flopy.export",
"flopy.discretization",
"flopy.mf6",
"flopy.mf6.coordinates",
"flopy.mf6.data",
"flopy.mf6.modflow",
"flopy.mf6.utils",
],
include_package_data=True, # includes files listed in MANIFEST.in
# use this version ID if .svn data cannot be found
version=__version__,
classifiers=["Topic :: Scientific/Engineering :: Hydrology"],
)
setup()