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

Upgrade to Python 3 #72

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ env/
tr55/wintab32dll.txt
tr55/Results_*.csv
*.bak

*.egg-info/
*.egg
.eggs

build/
dist/
15 changes: 15 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
nose = ">=1.3.7"
numpy = ">=1.20.3"

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

[requires]
python_version = "3.9"
260 changes: 260 additions & 0 deletions Pipfile.lock

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

74 changes: 55 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ The following land use values are implemented and correspond to the keys listed:
The output of the following program:
```Python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

import pprint

Expand Down Expand Up @@ -206,33 +203,72 @@ u'unmodified': {u'bod': 43.11309178874012,
The output shown is a tree-like dictionary, akin to the one in the discussion of the first parameter of the `simulate_water_quality` function, except with additional keys and values attached to each node in the tree. The additional keys, `runoff`, `tss`, and so on, have associated values which are the water volumes and pollutant loads that have been calculated. The volumes and loads at the leaves of the tree are those returned by the `fn` function (the second parameter of the `simulate_modifications` function), while those of internal nodes are the sums of the amounts found in their child nodes.


## Testing
## Development

Run `python setup.py test` from within the project directory.
Development uses [pipenv](https://pipenv.pypa.io/en/latest/). After cloning this repository, setup your local development environment with:

```console
$ pipenv install --dev
```

## Testing

```console
$ pipenv run nosetests --verbosity=2
```

## Deployments

Deployments to PyPi are handled through [Travis-CI](https://travis-ci.org/WikiWatershed/tr-55). The following git flow commands approximate a release using Travis:
Create a new release using git flow:

``` bash
$ git flow release start 0.1.0
```console
$ git flow release start 2.0.0
$ vim CHANGELOG.md
$ vim setup.py
$ git commit -m "0.1.0"
$ git flow release publish 0.1.0
$ git flow release finish 0.1.0
$ git add CHANGELOG.md setup.py
$ git commit -m "2.0.0"
$ git flow release publish 2.0.0
```

After you've completed the `git flow` steps, you'll need to push the changes from your local `master` and `develop` branches back to the main repository.
Then create a wheel to publish to PyPI using [build](https://github.com/pypa/build):

```bash
$ git checkout develop
$ git push origin develop
$ git checkout master
$ git push origin master
# Trigger PyPi deployment
$ git push --tags
```console
$ pipenv run python -m build
```

This should create two files under `dist/`:

```console
$ ls -1 dist/
tr55-2.0.0.tar.gz
tr55-2.0.0-py2.py3-none-any.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/tr55-2.0.0-py2.py3-none-any.whl: PASSED
Checking dist/tr55-2.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 tr55-2.0.0-py2.py3-none-any.whl
100%|
Uploading tr55-2.0.0.tar.gz
100%|

View at:
https://pypi.org/project/tr-55/2.0.0/
```

Finally, finish the release:

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

## License
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel>=0.31",
"twine>=1.11",
]
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nose==1.3.4
numpy==1.11.0
nose==1.3.7
numpy==1.20.3
Loading