diff options
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..85f4e6a --- /dev/null +++ b/README.rst | |||
@@ -0,0 +1,112 @@ | |||
1 | ====================== | ||
2 | Python Releasing Tools | ||
3 | ====================== | ||
4 | |||
5 | This code is licensed under the MIT license. | ||
6 | |||
7 | This is a suite of tools that are useful for releasing Python code for public | ||
8 | or private use. There are setuptools extensions to validate various conventions | ||
9 | and to perform release activities. | ||
10 | |||
11 | Installation and Usage | ||
12 | ====================== | ||
13 | This package is generally not installed directly but instead listed in the | ||
14 | ``setup_requires`` option of the setuptools ``setup`` function. For example:: | ||
15 | |||
16 | from setuptools import setup | ||
17 | |||
18 | setup( | ||
19 | name="my_clever_package", | ||
20 | version="1.0.0", | ||
21 | setup_requires=[ | ||
22 | "py_release_tools", | ||
23 | ] | ||
24 | ) | ||
25 | |||
26 | Commands are exported as distuils commands and should be automatically | ||
27 | available provided the package is installed. The tool provides the commands | ||
28 | documented below and are generally run by defining a ``release`` `alias | ||
29 | <http://pythonhosted.org/setuptools/setuptools.html#alias-define-shortcuts-for-commonly-used-commands>`_ | ||
30 | in the project's ``setup.cfg`` file. The author's typical project ``setup.cfg`` | ||
31 | contains these aliases:: | ||
32 | |||
33 | [aliases] | ||
34 | validate = cover_tests pep8 | ||
35 | release = validate increment_semver git_push sdist upload | ||
36 | release_major = validate increment_semver -M git_push sdist upload | ||
37 | release_minor = validate increment_semver -m git_push sdist upload | ||
38 | |||
39 | Commands | ||
40 | ======== | ||
41 | increment_semver | ||
42 | ---------------- | ||
43 | This command will update the ``setup.py`` file version number following the | ||
44 | rules of `Semantic Versioning (semver) <http://semver.org>`_. This command will | ||
45 | re-write and commit the project's ``setup.py`` file. It assumes that the | ||
46 | version line is formatted as such, with some amount of leading whitespace:: | ||
47 | |||
48 | version="1.20.1" | ||
49 | |||
50 | It will rewrite all lines that look like this in the file. | ||
51 | |||
52 | The version format is:: | ||
53 | |||
54 | MAJOR.MINOR.PATCH | ||
55 | |||
56 | For more information check out the semver docs. | ||
57 | |||
58 | Version generation increments a version component by one. By default a patch | ||
59 | version is generated. Passing the ``-m`` or ``--minor`` flags to the command | ||
60 | will increment the minor version and set the patch version to zero. Passing | ||
61 | ``-M`` or ``--major`` will increment the major version and set both the minor | ||
62 | and patch versions to zero. | ||
63 | |||
64 | This command will also create a tag in the git repository of format | ||
65 | ``release-{semver}``. | ||
66 | |||
67 | git_push | ||
68 | -------- | ||
69 | This command runs a ``git push`` command to push the ``master`` branch to the | ||
70 | remote ``origin``. The command will also push tags. If your git repository | ||
71 | doesn't use these naming conventions the command will fail. | ||
72 | |||
73 | cover_tests | ||
74 | ----------- | ||
75 | This command will setup python | ||
76 | `coverage <https://pypi.python.org/pypi/coverage>`_ monitoring and invoke the | ||
77 | setuptools ``test`` target. Coverage data will be written to ``.coverage`` in | ||
78 | the same directory as the ``setup.py`` file. | ||
79 | |||
80 | This command will also generate a Cobertura coverage report as ``coverage.xml`` | ||
81 | and an HTML report in the ``htmlcov`` folder. | ||
82 | |||
83 | Failure of the tests will cause a failure of the build so it is suitable to use | ||
84 | this command as a replacement for the builtin ``test`` command. This command | ||
85 | also suppresses the system exit that the builtin ``test`` command generates so | ||
86 | other commands can be chained after this one. | ||
87 | |||
88 | pep8 | ||
89 | ---- | ||
90 | This command will run a `PEP8 <https://www.python.org/dev/peps/pep-0008/>`_ | ||
91 | code style validation on all Python files in the project, including the | ||
92 | setup.py file. | ||
93 | |||
94 | Contributing | ||
95 | ============ | ||
96 | If you would like to contribute to Pydora please visit the project's | ||
97 | `GitHub page <https://github.com/mcrute/py_release_tools>`_ and open a pull | ||
98 | request with your changes. To have the best experience contributing, please: | ||
99 | |||
100 | * Don't break backwards compatibility of public interfaces | ||
101 | * Write tests for your new feature/bug fix | ||
102 | * Ensure that existing tests pass | ||
103 | * Update the readme/docstrings, if necessary | ||
104 | * Follow the coding style of the current code-base | ||
105 | * Ensure that your code is PEP8 compliant | ||
106 | * Validate that your changes work with Python 2.7+ and 3.x | ||
107 | |||
108 | All code is reviewed before acceptance and changes may be requested to better | ||
109 | follow the conventions of the existing API. | ||
110 | |||
111 | he build system runs ``python setup.py validate`` on all supported Python | ||
112 | versions. You can, and should, run this on your pull request before submitting. | ||