Develop and Maintain Your Package
Release a Version
Test your package:
Run the tests (in PyCharm and/or with GitHub actions).
Check your coverage (locally in
cov/index.html
and/or on Codecov) and add tests if necessary.
In PyCharm:
Check that all new classes are in the file
__init__.py
and in the Reference section of the documentation.
Generate the documentation (in PyCharm and/or with GitHub actions) in order to check that it is
working.
If you were working on a secondary branch (which is desirable), do what you have to do: pull request to
"main" or "master", etc.
Ensure that you are now in your default git branch ("main" or "master").
Update the file HISTORY.rst
.
Stick to pure .rst
syntax:
never use Sphinx' specific directives such as
:class:`MyClass`
.
In PyCharm's terminal, do one of the following (except for the first release):
bumpversion patch
(version x.y.z → x.y.(z+1)) when you made a backwards-compatible modification (such as a
bug fix).
bumpversion minor
(version x.y.z → x.(y+1).0) when you added a functionality.
bumpversion major
(version x.y.z → (x+1).0.0) when you changed the API. Note: in versions 0.y.z, the API is
not expected to be stable anyway.
Commit/push.
On GitHub's website:
Go to “releases”.
Select “Draft a new release” or “Create a new release”.
Add a tag name as in HISTORY.rst
,
e.g. 0.1.0
.
Add a release title as in HISTORY.rst
,
e.g. First release
.
Add release notes as in HISTORY.rst
,
e.g. * First release on PyPI.
.
Select “Publish release”.
After a few minutes, GitHub has finished the built and it is deployed on
PyPI. If you want to check, search for your package name on PyPI
and check that the version number is correct. Note that the PyPI badge may take several more minutes before being
updated.
If the Deployment on PyPI Fails...
Check that the readme will be correctly rendered on PyPI.
In a terminal:
python setup.py bdist
twine check dist/the_name_of_the_file.zip
where the_name_of_the_file
must be replaced by the relevant file name.
Add a Module (= a File)
Typically, this is a file
sub_package\my_class
, containing
the class MyClass
.
In the file __init__.py
:
add the shortcut.
In the directory reference
of the documentation: add the auto-documentation.
Use a Third-Party Package
For example, you want to use Numpy in your module.
Open the file
setup.py
.
In the list requirements
,
add the name of the package (e.g.
'numpy'
).
Contributing
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
Fix Bugs
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help
wanted” is open to whoever wants to implement it.
Implement Features
Look through the GitHub issues for features. Anything tagged with “enhancement”
and “help wanted” is open to whoever wants to implement it.
Write Documentation
Package Helper 2 could always use more documentation, whether as part of the
official Package Helper 2 docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
The best way to send feedback is to file an issue at https://github.com/francois-durand/package_helper_2/issues.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
Ready to contribute? Here’s how to set up package_helper_2 for local development.
Fork the package_helper_2 repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/package_helper_2.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv package_helper_2
$ cd package_helper_2/
$ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox:
$ flake8 package_helper_2 tests
$ python setup.py test or py.test
$ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines
Before you submit a pull request, check that it meets these guidelines:
The pull request should include tests.
If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
The pull request should work for Python 3.6, 3.7 and 3.8,. Check
https://github.com/francois-durand/package_helper_2/actions
and make sure that the tests pass for all supported Python versions.
Tips
To run a subset of tests:
$ py.test tests.test_package_helper_2
Deploying
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in HISTORY.rst).
Then run:
$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags
GitHub will then deploy to PyPI if tests pass.