| 1 |
Development and Support |
| 2 |
======================= |
| 3 |
|
| 4 |
.. contents:: |
| 5 |
:depth: 1 |
| 6 |
:local: |
| 7 |
|
| 8 |
Reporting Issues |
| 9 |
---------------- |
| 10 |
|
| 11 |
Support requests, bugs, issues, documentation typos, and general questions |
| 12 |
should be submitted via the `GitHub Issue Tracker`_. The issue tracker offers a |
| 13 |
web interface which allows relevant information to be entered and submitted to |
| 14 |
the :doc:`Sorted Containers<index>` developers. Steps to file an issue: |
| 15 |
|
| 16 |
#. Please search the issues database to determine whether the problem has |
| 17 |
already been reported. It may be that a fix or workaround has already been |
| 18 |
provided or is soon to be released. If additional information is needed then |
| 19 |
you are welcome to reopen the issue and comment regarding your specific |
| 20 |
scenario. |
| 21 |
#. To file a new issue, click the green "New issue" button on the Issue |
| 22 |
Tracker. You will be required to sign-in to file an issue. It is not |
| 23 |
possible to submit an issue anonymously. |
| 24 |
#. The issue form has two primary fields: title and comment. The title should |
| 25 |
be a very short description of the problem; preferably less than ten words. |
| 26 |
The comment should describe the problem in detail, including what you |
| 27 |
expected to happen and what instead did happen. Working code samples that |
| 28 |
illustrate the issue are best. |
| 29 |
#. Submitted issues and comments will notify the lead developer and project |
| 30 |
maintainers. Bugs are typically fixed very quickly, within a week or so. |
| 31 |
Feature enhancements may take longer or be deferred until a pull request is |
| 32 |
made with a working prototype. |
| 33 |
|
| 34 |
Support |
| 35 |
------- |
| 36 |
|
| 37 |
Development of :doc:`Sorted Containers<index>` is lead by Grant Jenks |
| 38 |
<[email protected]>. The preferred method of contact for support is to |
| 39 |
create an issue on the `GitHub Issue Tracker`_. For anything sensitive, such as |
| 40 |
conduct issues or security issues, please contact the development lead directly |
| 41 |
by email. |
| 42 |
|
| 43 |
.. _`GitHub Issue Tracker`: https://github.com/grantjenks/python-sortedcontainers/issues |
| 44 |
|
| 45 |
How to Contribute? |
| 46 |
------------------ |
| 47 |
|
| 48 |
Collaborators are welcome! |
| 49 |
|
| 50 |
#. Check for open issues or open a fresh issue to start a discussion around a |
| 51 |
bug. |
| 52 |
#. Fork the `repository`_ on GitHub and start making your changes to a new |
| 53 |
branch. |
| 54 |
#. Write a test which shows that the bug was fixed. |
| 55 |
#. Send a pull request and bug the development lead until it gets merged and |
| 56 |
published :) |
| 57 |
|
| 58 |
.. _`repository`: https://github.com/grantjenks/python-sortedcontainers |
| 59 |
|
| 60 |
Requests for Contributions |
| 61 |
-------------------------- |
| 62 |
|
| 63 |
#. Terabytes of memory for benchmarks of 100,000,000,000 elements. |
| 64 |
#. Find a way for SortedSet to inherit directly from ``set``. |
| 65 |
#. Testing / benchmarking with Cython. |
| 66 |
|
| 67 |
Get the Code |
| 68 |
------------ |
| 69 |
|
| 70 |
:doc:`Sorted Containers<index>` is actively developed on GitHub, where the code |
| 71 |
is `open source`_. The recommended way to get a copy of the source repository |
| 72 |
is to clone the repository from GitHub:: |
| 73 |
|
| 74 |
$ git clone git://github.com/grantjenks/python-sortedcontainers.git |
| 75 |
|
| 76 |
.. _`open source`: https://github.com/grantjenks/python-sortedcontainers |
| 77 |
|
| 78 |
Development Dependencies |
| 79 |
------------------------ |
| 80 |
|
| 81 |
Install development dependencies with `pip`_:: |
| 82 |
|
| 83 |
$ pip install -r requirements.txt |
| 84 |
|
| 85 |
This includes everything for building/running tests, benchmarks and |
| 86 |
documentation. |
| 87 |
|
| 88 |
Some alternative implementations, such as `banyan`, may have issues when |
| 89 |
installing on Windows. You can still develop :doc:`Sorted Containers<index>` |
| 90 |
without these packages. They will be omitted from benchmarking. |
| 91 |
|
| 92 |
.. _`pip`: https://pypi.org/project/pip/ |
| 93 |
|
| 94 |
Testing |
| 95 |
------- |
| 96 |
|
| 97 |
Testing uses `tox`_. If you don't want to install all the development |
| 98 |
requirements, then, after downloading, you can simply run:: |
| 99 |
|
| 100 |
$ python setup.py test |
| 101 |
|
| 102 |
The test argument to `setup.py` will download a minimal testing infrastructure |
| 103 |
and run the tests. |
| 104 |
|
| 105 |
:: |
| 106 |
|
| 107 |
$ python setup.py test |
| 108 |
running test |
| 109 |
running egg_info |
| 110 |
writing sortedcontainers.egg-info/PKG-INFO |
| 111 |
writing dependency_links to sortedcontainers.egg-info/dependency_links.txt |
| 112 |
writing top-level names to sortedcontainers.egg-info/top_level.txt |
| 113 |
reading manifest file 'sortedcontainers.egg-info/SOURCES.txt' |
| 114 |
reading manifest template 'MANIFEST.in' |
| 115 |
writing manifest file 'sortedcontainers.egg-info/SOURCES.txt' |
| 116 |
running build_ext |
| 117 |
GLOB sdist-make: /Users/grantj/repos/python-sortedcontainers/setup.py |
| 118 |
py36 inst-nodeps: /Users/grantj/repos/python-sortedcontainers/.tox/dist/sortedcontainers-1.5.10.zip |
| 119 |
py36 installed: attrs==18.1.0,more-itertools==4.1.0,pluggy==0.6.0,py==1.5.3,pytest==3.5.1,six==1.11.0,sortedcontainers==1.5.10 |
| 120 |
py36 runtests: PYTHONHASHSEED='365015869' |
| 121 |
py36 runtests: commands[0] | python -m pytest |
| 122 |
================================================= test session starts ================================================= |
| 123 |
platform darwin -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0 |
| 124 |
rootdir: /Users/grantj/repos/python-sortedcontainers, inifile: tox.ini |
| 125 |
collected 357 items |
| 126 |
|
| 127 |
docs/introduction.rst . [ 0%] |
| 128 |
sortedcontainers/__init__.py . [ 0%] |
| 129 |
sortedcontainers/sorteddict.py ........... [ 3%] |
| 130 |
sortedcontainers/sortedlist.py ..................................... [ 14%] |
| 131 |
sortedcontainers/sortedset.py ................. [ 18%] |
| 132 |
tests/benchmark_splits_fill.py . [ 19%] |
| 133 |
tests/sortedcollection.py . [ 19%] |
| 134 |
tests/test_coverage_sorteddict.py ................................................... [ 33%] |
| 135 |
tests/test_coverage_sortedkeylist_modulo.py ................................................................... [ 52%] |
| 136 |
tests/test_coverage_sortedkeylist_negate.py ....................................................... [ 68%] |
| 137 |
tests/test_coverage_sortedlist.py .......................................................... [ 84%] |
| 138 |
tests/test_coverage_sortedset.py .................................................. [ 98%] |
| 139 |
tests/test_stress_sorteddict.py .. [ 98%] |
| 140 |
tests/test_stress_sortedkeylist.py . [ 99%] |
| 141 |
tests/test_stress_sortedlist.py . [ 99%] |
| 142 |
tests/test_stress_sortedset.py .. [100%] |
| 143 |
|
| 144 |
============================================= 357 passed in 10.86 seconds ============================================= |
| 145 |
lint inst-nodeps: /Users/grantj/repos/python-sortedcontainers/.tox/dist/sortedcontainers-1.5.10.zip |
| 146 |
lint installed: astroid==1.6.4,isort==4.3.4,lazy-object-proxy==1.3.1,mccabe==0.6.1,pylint==1.9.0,six==1.11.0,sortedcontainers==1.5.10,wrapt==1.10.11 |
| 147 |
lint runtests: PYTHONHASHSEED='365015869' |
| 148 |
lint runtests: commands[0] | pylint sortedcontainers |
| 149 |
Using config file /Users/grantj/repos/python-sortedcontainers/.pylintrc |
| 150 |
|
| 151 |
-------------------------------------------------------------------- |
| 152 |
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00) |
| 153 |
|
| 154 |
_______________________________________________________ summary _______________________________________________________ |
| 155 |
py36: commands succeeded |
| 156 |
lint: commands succeeded |
| 157 |
|
| 158 |
Coverage testing uses `pytest-cov`_: |
| 159 |
|
| 160 |
:: |
| 161 |
|
| 162 |
$ python -m pytest --cov sortedcontainers --cov-report term-missing --cov-branch |
| 163 |
================================================= test session starts ================================================= |
| 164 |
platform darwin -- Python 3.6.5, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 |
| 165 |
rootdir: /Users/grantj/repos/python-sortedcontainers, inifile: tox.ini |
| 166 |
plugins: cov-2.5.1, hypothesis-3.55.3 |
| 167 |
collected 357 items |
| 168 |
|
| 169 |
docs/introduction.rst . [ 0%] |
| 170 |
sortedcontainers/__init__.py . [ 0%] |
| 171 |
sortedcontainers/sorteddict.py ........... [ 3%] |
| 172 |
sortedcontainers/sortedlist.py ..................................... [ 14%] |
| 173 |
sortedcontainers/sortedset.py ................. [ 18%] |
| 174 |
tests/benchmark_splits_fill.py . [ 19%] |
| 175 |
tests/sortedcollection.py . [ 19%] |
| 176 |
tests/test_coverage_sorteddict.py ................................................... [ 33%] |
| 177 |
tests/test_coverage_sortedkeylist_modulo.py ................................................................... [ 52%] |
| 178 |
tests/test_coverage_sortedkeylist_negate.py ....................................................... [ 68%] |
| 179 |
tests/test_coverage_sortedlist.py .......................................................... [ 84%] |
| 180 |
tests/test_coverage_sortedset.py .................................................. [ 98%] |
| 181 |
tests/test_stress_sorteddict.py .. [ 98%] |
| 182 |
tests/test_stress_sortedkeylist.py . [ 99%] |
| 183 |
tests/test_stress_sortedlist.py . [ 99%] |
| 184 |
tests/test_stress_sortedset.py .. [100%] |
| 185 |
|
| 186 |
---------- coverage: platform darwin, python 3.6.5-final-0 ----------- |
| 187 |
Name Stmts Miss Branch BrPart Cover Missing |
| 188 |
---------------------------------------------------------------------------- |
| 189 |
sortedcontainers/__init__.py 10 0 0 0 100% |
| 190 |
sortedcontainers/sorteddict.py 159 0 40 0 100% |
| 191 |
sortedcontainers/sortedlist.py 1001 8 420 3 99% 34-39, 44-45, 33->34, 785->787, 1429->1437 |
| 192 |
sortedcontainers/sortedset.py 179 0 26 0 100% |
| 193 |
---------------------------------------------------------------------------- |
| 194 |
TOTAL 1349 8 486 3 99% |
| 195 |
|
| 196 |
It's normal to see coverage a little less than 100%. Some code is specific to |
| 197 |
the Python runtime. |
| 198 |
|
| 199 |
Stress testing is also based on pytest but can be run independently as a |
| 200 |
module. Stress tests are kept in the tests directory and prefixed with |
| 201 |
test_stress. Stress tests accept two arguments: an iteration count and random |
| 202 |
seed value. For example, to run stress on the SortedList data type: |
| 203 |
|
| 204 |
:: |
| 205 |
|
| 206 |
$ python -m tests.test_stress_sortedlist 1000 0 |
| 207 |
Python sys.version_info(major=2, minor=7, micro=0, releaselevel='final', serial=0) |
| 208 |
Setting iterations to 1000 |
| 209 |
Setting seed to 0 |
| 210 |
Exiting after 0:00:00.846000 |
| 211 |
|
| 212 |
If stress exits normally then it worked successfully. Some stress is run by tox |
| 213 |
and pytest but the iteration count is limited at 1,000. More rigorous testing |
| 214 |
requires increasing the iteration count to millions. At that level, it's best |
| 215 |
to just let it run overnight. Stress testing will stop at the first failure. |
| 216 |
|
| 217 |
Running Benchmarks |
| 218 |
------------------ |
| 219 |
|
| 220 |
Running and plotting benchmarks is a two step process. Each is a Python script |
| 221 |
in the tests directory. To run the benchmarks for :class:`SortedList`, plot the |
| 222 |
results, and save the resulting graphs, run: |
| 223 |
|
| 224 |
:: |
| 225 |
|
| 226 |
$ python -m tests.benchmark_sortedlist --bare > tests/results_sortedlist.txt |
| 227 |
$ python -m tests.benchmark_plot tests/results_sortedlist.txt SortedList --save |
| 228 |
|
| 229 |
Each script has a handful of useful arguments. Use ``--help`` to display |
| 230 |
those. Consult the source for details. The file `tests/benchmark_plot.py` |
| 231 |
contains notes about benchmarking different Python runtimes against each other. |
| 232 |
|
| 233 |
If you simply want to run the benchmarks to observe the performance on your |
| 234 |
local machine, then run: |
| 235 |
|
| 236 |
:: |
| 237 |
|
| 238 |
$ curl -OL https://github.com/grantjenks/python-sortedcontainers/zipball/master |
| 239 |
$ unzip master |
| 240 |
$ cd grantjenks-python-sortedcontainers-[GITHASH]/ |
| 241 |
$ export PYTHONPATH=`pwd` |
| 242 |
$ python -m tests.benchmark_sortedlist |
| 243 |
$ python -m tests.benchmark_sorteddict |
| 244 |
$ python -m tests.benchmark_sortedset |
| 245 |
|
| 246 |
The benchmarks will warn if some packages are not importable. This limits the |
| 247 |
possible comparisons. See `requirements.txt` for the package names than can be |
| 248 |
installed from PyPI. |
| 249 |
|
| 250 |
Tested Runtimes |
| 251 |
--------------- |
| 252 |
|
| 253 |
:doc:`Sorted Containers<index>` actively tests against the following versions |
| 254 |
of Python: |
| 255 |
|
| 256 |
* CPython 2.7 |
| 257 |
* CPython 3.2 |
| 258 |
* CPython 3.3 |
| 259 |
* CPython 3.4 |
| 260 |
* CPython 3.5 |
| 261 |
* CPython 3.6 |
| 262 |
* CPython 3.7 |
| 263 |
* PyPy |
| 264 |
* PyPy3 |
| 265 |
|
| 266 |
Life will feel much saner if you use `venv`_ or `virtualenv`_ and `tox`_ to |
| 267 |
manage and test each of the runtimes. |
| 268 |
|
| 269 |
.. _`tox`: https://pypi.org/project/tox/ |
| 270 |
.. _`pytest-cov`: https://pypi.org/project/pytest-cov/ |
| 271 |
.. _`venv`: https://docs.python.org/3/library/venv.html |
| 272 |
.. _`virtualenv`: https://pypi.org/project/virtualenv/ |