2018-04-15 20:40:44 +00:00
|
|
|
# HOW TO CONTRIBUTE TO TQDM
|
2015-10-11 10:18:26 +00:00
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
This file describes how to
|
|
|
|
|
|
|
|
- contribute changes to the project, and
|
|
|
|
- upload released to the pypi repository.
|
2015-10-11 10:18:26 +00:00
|
|
|
|
2015-11-01 16:01:18 +00:00
|
|
|
Most of the management commands have been directly placed inside the
|
2016-06-04 12:58:44 +00:00
|
|
|
Makefile:
|
|
|
|
|
|
|
|
```
|
|
|
|
make [<alias>] # on UNIX-like environments
|
|
|
|
python setup.py make [<alias>] # if make is unavailable
|
|
|
|
```
|
2015-10-13 13:15:11 +00:00
|
|
|
|
2019-01-26 14:34:39 +00:00
|
|
|
The latter depends on [`py-make>=0.1.0`](https://github.com/tqdm/py-make).
|
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
Use the alias `help` (or leave blank) to list all available aliases.
|
2015-10-13 13:25:12 +00:00
|
|
|
|
2015-10-11 14:53:32 +00:00
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
## HOW TO COMMIT CONTRIBUTIONS
|
2015-10-11 10:18:26 +00:00
|
|
|
|
2015-11-01 16:01:18 +00:00
|
|
|
Contributions to the project are made using the "Fork & Pull" model. The
|
|
|
|
typical steps would be:
|
2015-10-11 10:18:26 +00:00
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
1. create an account on [github](https://github.com)
|
|
|
|
2. fork [tqdm](https://github.com/tqdm/tqdm)
|
|
|
|
3. make a local clone: `git clone https://github.com/your_account/tqdm.git`
|
|
|
|
4. make changes on the local copy
|
|
|
|
5. test (see below) and commit changes `git commit -a -m "my message"`
|
2019-01-27 00:14:15 +00:00
|
|
|
6. `push` to your GitHub account: `git push origin`
|
|
|
|
7. create a Pull Request (PR) from your GitHub fork
|
2015-10-11 17:05:33 +00:00
|
|
|
(go to your fork's webpage and click on "Pull Request."
|
|
|
|
You can then add a message to describe your proposal.)
|
2015-10-11 10:18:26 +00:00
|
|
|
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
## TESTING
|
2015-10-11 11:35:16 +00:00
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
To test functionality (such as before submitting a Pull
|
2015-10-11 17:05:33 +00:00
|
|
|
Request), there are a number of unit tests.
|
2015-10-11 11:35:16 +00:00
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Standard unit tests
|
2015-10-13 22:42:01 +00:00
|
|
|
|
|
|
|
The standard way to run the tests:
|
2015-10-11 17:05:33 +00:00
|
|
|
|
|
|
|
- install `tox`
|
|
|
|
- `cd` to the root of the `tqdm` directory (in the same folder as this file)
|
2015-10-13 13:15:11 +00:00
|
|
|
- run the following command:
|
2015-10-11 11:35:16 +00:00
|
|
|
|
2015-10-15 13:47:02 +00:00
|
|
|
```
|
2016-06-04 12:58:44 +00:00
|
|
|
[python setup.py] make test
|
|
|
|
# or:
|
2015-10-13 22:42:01 +00:00
|
|
|
tox --skip-missing-interpreters
|
2015-10-11 10:18:26 +00:00
|
|
|
```
|
2015-10-13 13:15:11 +00:00
|
|
|
|
2015-11-01 16:01:18 +00:00
|
|
|
This will build the module and run the tests in a virtual environment.
|
|
|
|
Errors and coverage rates will be output to the console/log. (Ignore missing
|
|
|
|
interpreters errors - these are due to the local machine missing certain
|
|
|
|
versions of Python.)
|
2015-10-13 20:49:38 +00:00
|
|
|
|
2015-11-01 16:01:18 +00:00
|
|
|
Note: to install all versions of the Python interpreter that are specified
|
|
|
|
in [tox.ini](https://raw.githubusercontent.com/tqdm/tqdm/master/tox.ini),
|
|
|
|
you can use `MiniConda` to install a minimal setup. You must also make sure
|
|
|
|
that each distribution has an alias to call the Python interpreter:
|
|
|
|
`python27` for Python 2.7's interpreter, `python32` for Python 3.2's, etc.
|
2015-10-13 20:49:38 +00:00
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Alternative unit tests with Nose
|
2015-10-13 22:42:01 +00:00
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
Alternatively, use `nose` to run the tests just for the current Python version:
|
2015-10-13 22:42:01 +00:00
|
|
|
|
|
|
|
- install `nose` and `flake8`
|
2015-11-01 16:01:18 +00:00
|
|
|
- run the following command:
|
2015-10-13 22:42:01 +00:00
|
|
|
|
|
|
|
```
|
2016-06-04 12:58:44 +00:00
|
|
|
[python setup.py] make alltests
|
2015-10-13 22:42:01 +00:00
|
|
|
```
|
|
|
|
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
# MANAGE A NEW RELEASE
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
This section is intended for the project's maintainers and describes
|
|
|
|
how to build and upload a new release. Once again,
|
|
|
|
`[python setup.py] make [<alias>]` will help.
|
2019-01-26 14:34:39 +00:00
|
|
|
Also consider `pip install`ing development utilities:
|
|
|
|
`-r requirements-dev.txt` or `tqdm[dev]`.
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
## Semantic Versioning
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
The tqdm repository managers should:
|
|
|
|
|
|
|
|
- regularly bump the version number in the file
|
|
|
|
[_version.py](https://raw.githubusercontent.com/tqdm/tqdm/master/tqdm/_version.py)
|
2018-05-31 16:13:41 +00:00
|
|
|
- follow the [Semantic Versioning](https://semver.org/) convention
|
2016-06-04 12:58:44 +00:00
|
|
|
- take care of this (instead of users) to avoid PR conflicts
|
|
|
|
solely due to the version file bumping
|
|
|
|
|
|
|
|
Note: tools can be used to automate this process, such as
|
|
|
|
[bumpversion](https://github.com/peritus/bumpversion) or
|
|
|
|
[python-semanticversion](https://github.com/rbarrois/python-semanticversion/).
|
|
|
|
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
## Checking setup.py
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-01-27 00:14:15 +00:00
|
|
|
To check that the `setup.py` file is compliant with PyPI requirements (e.g.
|
|
|
|
version number; reStructuredText in `README.rst`) use:
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
[python setup.py] make testsetup
|
|
|
|
```
|
|
|
|
|
|
|
|
To upload just metadata (including overwriting mistakenly uploaded metadata)
|
2019-01-27 00:14:15 +00:00
|
|
|
to PyPI, use:
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
[python setup.py] make pypimeta
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
## Merging Pull Requests
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
This section describes how to cleanly merge PRs.
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 1 Rebase
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
From your project repository, merge and test
|
|
|
|
(replace `pr-branch-name` as appropriate):
|
2015-10-13 22:42:01 +00:00
|
|
|
|
|
|
|
```
|
2016-06-04 12:58:44 +00:00
|
|
|
git fetch origin
|
|
|
|
git checkout -b pr-branch-name origin/pr-branch-name
|
|
|
|
git rebase master
|
|
|
|
```
|
|
|
|
|
|
|
|
If there are conflicts:
|
|
|
|
|
|
|
|
```
|
|
|
|
git mergetool
|
|
|
|
git rebase --continue
|
|
|
|
```
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 2 Push
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
Update branch with the rebased history:
|
|
|
|
|
2015-10-13 22:42:01 +00:00
|
|
|
```
|
2016-06-04 12:58:44 +00:00
|
|
|
git push origin pr-branch-name --force
|
|
|
|
```
|
|
|
|
|
|
|
|
Non maintainers can stop here.
|
|
|
|
|
|
|
|
Note: NEVER just `git push --force` (this will push all local branches,
|
|
|
|
overwriting remotes).
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 3 Merge
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
git checkout master
|
|
|
|
git merge --no-ff pr-branch-name
|
|
|
|
```
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 4 Test
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
[python setup.py] make alltests
|
|
|
|
```
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 5 Version
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
Modify `tqdm/_version.py` and amend the last (merge) commit:
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
git add tqdm/_version.py
|
|
|
|
git commit --amend # Add "+ bump version" in the commit message
|
|
|
|
```
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### 6 Push to master
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
git push origin master
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
## Building a Release and Uploading to PyPI
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
Formally publishing requires additional steps: testing and tagging.
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Test
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
- ensure that all online CI tests have passed
|
|
|
|
- check `setup.py` and `MANIFEST.in` - which define the packaging
|
2019-01-27 00:14:15 +00:00
|
|
|
process and info that will be uploaded to [PyPI](https://pypi.org) -
|
2016-06-04 12:58:44 +00:00
|
|
|
using `[python setup.py] make installdev`
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Tag
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
- ensure the version has been bumped, committed **and** tagged.
|
|
|
|
The tag format is `v{major}.{minor}.{patch}`, for example: `v4.4.1`.
|
|
|
|
The current commit's tag is used in the version checking process.
|
|
|
|
If the current commit is not tagged appropriately, the version will
|
|
|
|
display as `v{major}.{minor}.{patch}-{commit_hash}`.
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Upload
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-03-01 23:24:34 +00:00
|
|
|
Travis CI should automatically do this after pushing tags.
|
|
|
|
Manual instructions are given below in case of failure.
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
Build `tqdm` into a distributable python package:
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
[python setup.py] make build
|
|
|
|
```
|
|
|
|
|
|
|
|
This will generate several builds in the `dist/` folder. On non-windows
|
|
|
|
machines the windows `exe` installer may fail to build. This is normal.
|
|
|
|
|
|
|
|
Finally, upload everything to pypi. This can be done easily using the
|
|
|
|
[twine](https://github.com/pypa/twine) module:
|
|
|
|
|
|
|
|
```
|
|
|
|
[python setup.py] make pypi
|
|
|
|
```
|
|
|
|
|
2019-01-27 00:14:15 +00:00
|
|
|
Also, the new release can (should) be added to GitHub by creating a new
|
2019-03-01 23:24:34 +00:00
|
|
|
release from the [web interface](https://github.com/tqdm/tqdm/releases);
|
|
|
|
uploading packages from the `dist/` folder
|
2016-06-04 12:58:44 +00:00
|
|
|
created by `[python setup.py] make build`.
|
2019-01-27 00:14:15 +00:00
|
|
|
The [wiki] can be automatically updated with GitHub release notes by
|
2018-04-03 18:27:47 +00:00
|
|
|
running `make` within the wiki repository.
|
|
|
|
|
|
|
|
[wiki]: https://github.com/tqdm/tqdm/wiki
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-03-02 22:27:19 +00:00
|
|
|
Docker images may be uploaded to <https://hub.docker.com/r/tqdm/tqdm>.
|
|
|
|
Assuming `docker` is
|
|
|
|
[installed](https://docs.docker.com/install/linux/docker-ce/ubuntu/):
|
|
|
|
|
|
|
|
```
|
|
|
|
make -B docker
|
|
|
|
docker login
|
|
|
|
docker push tqdm/tqdm:latest
|
|
|
|
docker push tqdm/tqdm:$(docker run -i --rm tqdm/tqdm -v)
|
|
|
|
```
|
|
|
|
|
2019-03-01 23:24:34 +00:00
|
|
|
Snaps may be uploaded to <https://snapcraft.io/tqdm>.
|
|
|
|
Assuming `snapcraft` is installed (`snap install snapcraft --classic --beta`):
|
|
|
|
|
|
|
|
```
|
2019-03-02 22:27:19 +00:00
|
|
|
make snap
|
2019-03-01 23:24:34 +00:00
|
|
|
snapcraft login
|
|
|
|
snapcraft push tqdm*.snap --release stable
|
|
|
|
```
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
### Notes
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-01-27 00:14:15 +00:00
|
|
|
- you can also test on the PyPI test servers `test.pypi.org`
|
2016-06-04 12:58:44 +00:00
|
|
|
before the real deployment
|
2019-01-27 00:14:15 +00:00
|
|
|
- in case of a mistake, you can delete an uploaded release on PyPI, but you
|
2016-06-04 12:58:44 +00:00
|
|
|
cannot re-upload another with the same version number
|
2019-01-27 00:14:15 +00:00
|
|
|
- in case of a mistake in the metadata on PyPI (e.g. bad README),
|
2016-06-04 12:58:44 +00:00
|
|
|
updating just the metadata is possible: `[python setup.py] make pypimeta`
|
|
|
|
|
|
|
|
|
2019-01-21 00:01:17 +00:00
|
|
|
## Updating Websites
|
2016-10-30 16:15:30 +00:00
|
|
|
|
2019-01-27 00:14:15 +00:00
|
|
|
The most important file is `.readme.rst`, which should always be kept up-to-date
|
2016-10-30 16:15:30 +00:00
|
|
|
and in sync with the in-line source documentation. This will affect all of the
|
|
|
|
following:
|
|
|
|
|
2019-01-27 00:14:15 +00:00
|
|
|
- `README.rst` (generated by `mkdocs.py` during `make build`)
|
2016-10-30 16:15:30 +00:00
|
|
|
- The [main repository site](https://github.com/tqdm/tqdm) which automatically
|
2019-01-27 00:14:15 +00:00
|
|
|
serves the latest `README.rst` as well as links to all of GitHub's features.
|
2019-01-21 00:01:17 +00:00
|
|
|
This is the preferred online referral link for `tqdm`.
|
2019-01-27 00:14:15 +00:00
|
|
|
- The [PyPI mirror](https://pypi.org/project/tqdm) which automatically
|
2019-01-21 00:01:17 +00:00
|
|
|
serves the latest release built from `README.rst` as well as links to past
|
2016-10-30 16:15:30 +00:00
|
|
|
releases.
|
|
|
|
- Many external web crawlers.
|
|
|
|
|
|
|
|
Additionally (less maintained), there exists:
|
|
|
|
|
2018-04-03 18:27:47 +00:00
|
|
|
- A [wiki] which is publicly editable.
|
2016-10-30 16:15:30 +00:00
|
|
|
- The [gh-pages project](https://tqdm.github.io/tqdm/) which is built from the
|
|
|
|
[gh-pages branch](https://github.com/tqdm/tqdm/tree/gh-pages), which is
|
|
|
|
built using [asv](https://github.com/spacetelescope/asv/).
|
|
|
|
- The [gh-pages root](https://tqdm.github.io/) which is built from a separate
|
2019-01-12 12:07:47 +00:00
|
|
|
[github.io repo](https://github.com/tqdm/tqdm.github.io).
|
2016-10-30 16:15:30 +00:00
|
|
|
|
|
|
|
|
2018-04-15 20:40:44 +00:00
|
|
|
## QUICK DEV SUMMARY
|
2016-06-04 12:58:44 +00:00
|
|
|
|
2019-01-12 12:07:47 +00:00
|
|
|
For experienced devs, once happy with local master:
|
2016-06-04 12:58:44 +00:00
|
|
|
|
|
|
|
1. bump version in `tqdm/_version.py`
|
|
|
|
2. test (`[python setup.py] make alltests`)
|
|
|
|
3. `git commit [--amend] # -m "bump version"`
|
|
|
|
4. `git push`
|
|
|
|
5. wait for tests to pass
|
|
|
|
a) in case of failure, fix and go back to (2)
|
|
|
|
6. `git tag vM.m.p && git push --tags`
|
|
|
|
7. `[python setup.py] make distclean`
|
|
|
|
8. `[python setup.py] make build`
|
2019-03-01 23:24:34 +00:00
|
|
|
9. **`[AUTO:TravisCI]`** upload to PyPI. either:
|
|
|
|
a) `[python setup.py] make pypi`, or
|
2018-08-20 15:15:11 +00:00
|
|
|
b) `twine upload -s -i $(git config user.signingkey) dist/tqdm-*`
|
2019-03-02 22:27:19 +00:00
|
|
|
10. **`[AUTO:TravisCI]`** upload to docker hub:
|
|
|
|
a) `make -B docker`
|
|
|
|
b) `docker push tqdm/tqdm:latest`
|
|
|
|
c) `docker push tqdm/tqdm:$(docker run -i --rm tqdm/tqdm -v)`
|
|
|
|
11. upload to snapcraft:
|
|
|
|
a) `make snap`, and
|
2019-03-01 23:24:34 +00:00
|
|
|
b) `snapcraft push tqdm*.snap --release stable`
|
2019-03-02 22:27:19 +00:00
|
|
|
12. create new release on <https://github.com/tqdm/tqdm/releases>
|
2018-08-20 15:15:11 +00:00
|
|
|
a) add helpful release notes
|
2019-03-01 23:24:34 +00:00
|
|
|
b) **`[AUTO:TravisCI]`** attach `dist/tqdm-*` binaries
|
|
|
|
(usually only `*.whl*`)
|
2019-03-02 22:27:19 +00:00
|
|
|
13. **`[SUB]`** run `make` in the `wiki` submodule to update release notes
|
|
|
|
14. **`[SUB]`** run `make deploy` in the `docs` submodule to update website
|
|
|
|
15. **`[SUB]`** accept the automated PR in the `feedstock` submodule to update conda
|
2019-03-01 23:24:34 +00:00
|
|
|
|
|
|
|
Key:
|
|
|
|
|
|
|
|
- **`[AUTO:TravisCI]`**: Travis CI should automatically do this after
|
|
|
|
`git push --tags` (6)
|
|
|
|
- **`[SUB]`**: Requires one-time `make submodules` to clone
|
|
|
|
`docs`, `wiki`, and `feedstock`
|