Skip to content

Commit

Permalink
fix(packaging): include pyproject.toml to sdist, check package for Py…
Browse files Browse the repository at this point in the history
…PI (#1373)
  • Loading branch information
mwtoews authored Mar 21, 2022
1 parent 8b82212 commit 830016c
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-mf6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
pip install https://github.com/modflowpy/pymake/zipball/master
pip install https://github.com/Deltares/xmipy/zipball/develop
pip install https://github.com/MODFLOW-USGS/modflowapi/zipball/develop
pip install . --use-feature=in-tree-build
pip install .
- name: Setup symbolic links on Linux
run: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ jobs:
with:
python-version: 3.9

- name: Upgrade pip and install wheel
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Base flopy installation
run: |
pip install . --use-feature=in-tree-build
pip install .
- name: Print flopy version
run: |
Expand Down Expand Up @@ -91,16 +90,15 @@ jobs:
run: |
conda env update --name flopy --file etc/environment.yml
- name: Upgrade pip and install wheel
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Install pymake, xmipy, and flopy
run: |
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install . --use-feature=in-tree-build
pip install .
- name: Prepare for the autotests
working-directory: ./autotest
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,23 @@ jobs:
with:
python-version: 3.9

- name: Upgrade pip and install wheel
- name: Upgrade pip and install build and twine
run: |
python -m pip install --upgrade pip
pip install wheel
pip install build twine
- name: Base flopy installation
run: |
pip install . --use-feature=in-tree-build
pip install .
- name: Print flopy version
run: |
python -c "import flopy; print(flopy.__version__)"
- name: Build flopy packages, check dist outputs
run: |
python -m build
twine check --strict dist/*
flopy_lint:
name: linting
Expand Down Expand Up @@ -138,10 +142,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip and install wheel
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Install Python packages on Linux and MacOS
run: |
Expand All @@ -156,7 +159,7 @@ jobs:
run: |
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install . --use-feature=in-tree-build
pip install .
- name: Prepare for the autotests
working-directory: ./autotest
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include pyproject.toml
include flopy/mf6/data/dfn/*.dfn
include flopy/plot/mplstyle/*.mplstyle
include flopy/plot/mplstyle/*.mplstyle
File renamed without changes.
24 changes: 9 additions & 15 deletions docs/make_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,32 +123,26 @@ Use `run_notebooks.py` in the `release` directory to rerun all of the notebooks
6. Make pull request to [flopy-feedstock](https://github.com/conda-forge/flopy-feedstock)
## Update PyPi
## Update PyPI
1. Make sure `twine` is installed using:
1. Make sure the latest `build` and `twine` tools are installed using:
```
conda search twine
pip install --upgrade build twine
```
2. If it is not installed, install using using:
```
conda install twine
```
3. Create the source zip file in a terminal using:
2. Create the source and wheel packages with:
```
python setup.py sdist
rm -rf dist
python -m build
```
4. Upload the release to PyPi using (*make sure* `twine` *is installed using conda*):
3. Check and upload the release to PyPI using:
```
twine upload dist/flopy-version.zip
twine check --strict dist/*
twine upload dist/*
```
## Sync develop and master branches
Expand Down
10 changes: 5 additions & 5 deletions release/make-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
file_paths = {
"version.py": "../flopy",
"README.md": "../",
"PyPi_release.md": "../docs",
"PyPI_release.md": "../docs",
"code.json": "../",
"DISCLAIMER.md": "../flopy",
"notebook_examples.md": "../docs",
Expand Down Expand Up @@ -215,8 +215,8 @@ def update_version():
# update code.json
update_codejson(vmajor, vminor, vmicro)

# update PyPi_release.md
update_PyPi_release(vmajor, vminor, vmicro)
# update PyPI_release.md
update_PyPI_release(vmajor, vminor, vmicro)


def update_codejson(vmajor, vminor, vmicro):
Expand Down Expand Up @@ -360,15 +360,15 @@ def update_notebook_examples_markdown():
f.close()


def update_PyPi_release(vmajor, vminor, vmicro):
def update_PyPI_release(vmajor, vminor, vmicro):
# create disclaimer text
is_approved, disclaimer = get_disclaimer()

# create version
version = get_tag(vmajor, vminor, vmicro)

# read README.md into memory
file = "PyPi_release.md"
file = "PyPI_release.md"
fpth = os.path.join(file_paths[file], file)
with open(fpth, "r") as file:
lines = [line.rstrip() for line in file]
Expand Down
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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 = file: docs/PyPI_release.md
long_description_content_type = text/markdown
author = FloPy Team
author_email = modflow@usgs.gov
Expand Down Expand Up @@ -40,9 +40,6 @@ install_requires =
flopy.mf6.data = dfn/*.dfn
flopy.plot = mplstyle/*.mplstyle

[sdist]
formats = zip

[flake8]
exclude =
.git
Expand Down

0 comments on commit 830016c

Please sign in to comment.