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

Update build, publish mechanism #96

Merged
merged 6 commits into from
Jul 3, 2024
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
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pipenv, build dependencies
run: |
python -m pip install pipenv
pipenv install --dev
- name: Build source package
run: |
pipenv run python -m build --sdist
- name: Build wheels
run: |
pipenv run python -m cibuildwheel --output-dir dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 0 additions & 1 deletion DESCRIPTION.rst

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
include DESCRIPTION.rst
include *.md
include *.py
include LICENSE
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ numba = "==0.55.*"

[dev-packages]
build = "*"
cibuildwheel = "*"
twine = "*"

[requires]
Expand Down
75 changes: 62 additions & 13 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 11 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# gwlf-e
Port of Generalized Watersheds Loading Functions - Enhanced (MapShed)

[![Build Status](https://travis-ci.org/WikiWatershed/gwlf-e.svg?branch=develop)](https://travis-ci.org/WikiWatershed/gwlf-e)

## Installation

Install using `pip`:
Expand All @@ -11,6 +9,15 @@ Install using `pip`:
$ pip install gwlf-e
```

For Linux x64 on Python 3.8, 3.9, and 3.10 the above will pull a published wheel.
For other platforms, a wheel would have to be built.
In that case, you may also need to install `setuptools`, `wheel`, and `build` to compile it locally:

```bash
$ pip install wheel build
$ pip install --no-build-isolation gwlf-e
```

## Development

Ensure you have Python 3.10 and [pipenv](https://pipenv.pypa.io/en/latest/) available. Then run:
Expand Down Expand Up @@ -41,50 +48,11 @@ $ vim CHANGELOG.md
$ vim setup.py
$ git add CHANGELOG.md setup.py
$ git commit -m "3.0.0"
$ git flow release publish 3.0.0
```

Then create a wheel to publish to PyPI using [build](https://github.com/pypa/build):

```console
$ pipenv run python -m build
```

This should create two files under `dist/`:

```console
$ ls -1 dist/
gwlf-e-3.0.0.tar.gz
gwlf_e-3.0.0-cp39-cp39-macosx_11_0_x86_64.whl
```

Then publish the wheel to PyPI using [twine](https://github.com/pypa/twine/) and credentials from LastPass:

```console
$ python -m twine check dist/*
Checking dist/gwlf_e-3.0.0-cp39-cp39-macosx_11_0_x86_64.whl: PASSED
Checking dist/gwlf-e-3.0.0.tar.gz: PASSED
```
```console
$ python -m twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Enter your username: azavea
Enter your password:
Uploading gwlf_e-3.0.0-cp39-cp39-macosx_11_0_x86_64.whl
100%|
Uploading gwlf-e-3.0.0.tar.gz
100%|

View at:
https://pypi.org/project/gwlf-e/3.0.0/
```

Finally, finish the release:

```console
$ git flow release finish -p 3.0.0
```

When the tag is pushed up, [GitHub Actions](./.github/workflows/release.yml) will publish a release to PyPI.

## License

This project is licensed under the terms of the Apache 2.0 license.
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
requires = [
"setuptools>=42",
"wheel>=0.31",
"cibuildwheel>=2.13",
"twine>=1.11",
'numba==0.55.*',
]

[tool.cibuildwheel]
build = "cp38-manylinux_* cp39-manylinux_* cp310-manylinux_*"
archs = "x86_64"
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
from gwlfe.MultiUse_Fxns.Runoff.WashImperv_inner import cc as wipcc
from gwlfe.MultiUse_Fxns.Runoff.WashPerv_inner import cc as wpcc

# Get the long description from DESCRIPTION.rst
# Get the long description from README.md
with open(path.join(path.abspath(path.dirname(__file__)),
'DESCRIPTION.rst'), encoding='utf-8') as f:
'README.md'), encoding='utf-8') as f:
long_description = f.read()

tests_require = [
Expand All @@ -36,7 +36,7 @@
version='3.1.0',
description='A Python port of Generalized Watersheds Loading Functions - Enhanced (MapShed)',
long_description=long_description,
long_description_content_type='text/x-rst',
long_description_content_type='text/markdown',
url='https://github.com/WikiWatershed/gwlf-e',
author='Azavea Inc.',
author_email='systems@azavea.com',
Expand Down