@@ -4,13 +4,12 @@ Developing and Contributing
4
4
Collaborators are welcome!
5
5
6
6
#. Check for open issues or open a fresh issue to start a discussion around a
7
- bug. There is a Contributor Friendly tag for issues that should be used by
8
- people who are not very familiar with the codebase yet.
7
+ bug.
9
8
#. Fork `the repository <https://github.com/grantjenks/sorted_containers >`_ on
10
9
GitHub and start making your changes to a new branch.
11
10
#. Write a test which shows that the bug was fixed.
12
11
#. Send a pull request and bug the maintainer until it gets merged and
13
- published. :)
12
+ published :)
14
13
15
14
Development Lead
16
15
----------------
@@ -28,32 +27,26 @@ Get the Code
28
27
------------
29
28
30
29
:doc: `Sorted Containers<index> ` is actively developed on GitHub, where the code
31
- is `always available <https://github.com/grantjenks/sorted_containers >`_.
32
-
33
- You can either clone the public repository::
30
+ is `open source `_. The recommended way to get a copy of the source repository
31
+ is to clone the repository from GitHub::
34
32
35
33
$ git clone git://github.com/grantjenks/sorted_containers.git
36
34
37
- Download the `tarball <https://github.com/grantjenks/sorted_containers/tarball/master >`_::
38
-
39
- $ curl -OL https://github.com/grantjenks/sorted_containers/tarball/master
40
-
41
- Or, download the `zipball <https://github.com/grantjenks/sorted_containers/zipball/master >`_::
42
-
43
- $ curl -OL https://github.com/grantjenks/sorted_containers/zipball/master
35
+ .. _`open source` : https://github.com/grantjenks/sorted_containers
44
36
45
37
Development Dependencies
46
38
------------------------
47
39
48
- Install development dependencies with `pip <http ://www.pip-installer. org/ >`_::
40
+ Install development dependencies with `pip <https ://pypi. org/project/pip / >`_::
49
41
50
42
$ pip install -r requirements.txt
51
43
52
44
This includes everything for building/running tests, benchmarks and
53
45
documentation.
54
46
55
- Note that installing the Banyan module on Windows requires `patching the source
56
- <https://code.google.com/p/banyan/issues/detail?id=3> `_ in a couple places.
47
+ Some alternative implementations, such as `banyan `, may have issues when
48
+ installing on Windows. You can still develop :doc: `Sorted Containers<index> `
49
+ without these packages. They will be omitted from benchmarking.
57
50
58
51
Testing
59
52
-------
@@ -64,84 +57,24 @@ simply run::
64
57
65
58
$ python setup.py test
66
59
67
- The test argument to setup.py will download a minimal testing infrastructure
60
+ The test argument to ` setup.py ` will download a minimal testing infrastructure
68
61
and run the tests.
69
62
70
63
::
71
64
72
- $ tox
73
- GLOB sdist-make: /repos/sorted_containers/setup.py
74
- py26 inst-nodeps: /repos/sorted_containers/.tox/dist/sortedcontainers-0.8.0.zip
75
- py26 runtests: PYTHONHASHSEED='1205144536'
76
- py26 runtests: commands[0] | nosetests
77
- ...
78
- ----------------------------------------------------------------------
79
- Ran 150 tests in 7.080s
80
-
81
- OK
82
- py27 inst-nodeps: /repos/sorted_containers/.tox/dist/sortedcontainers-0.8.0.zip
83
- py27 runtests: PYTHONHASHSEED='1205144536'
84
- py27 runtests: commands[0] | nosetests
85
- ...
86
- ----------------------------------------------------------------------
87
- Ran 150 tests in 6.670s
88
-
89
- OK
90
- py32 inst-nodeps: /repos/sorted_containers/.tox/dist/sortedcontainers-0.8.0.zip
91
- py32 runtests: PYTHONHASHSEED='1205144536'
92
- py32 runtests: commands[0] | nosetests
93
- ...
94
- ----------------------------------------------------------------------
95
- Ran 150 tests in 10.254s
96
-
97
- OK
98
- py33 inst-nodeps: /repos/sorted_containers/.tox/dist/sortedcontainers-0.8.0.zip
99
- py33 runtests: PYTHONHASHSEED='1205144536'
100
- py33 runtests: commands[0] | nosetests
101
- ...
102
- ----------------------------------------------------------------------
103
- Ran 150 tests in 10.485s
104
-
105
- OK
106
- py34 inst-nodeps: /repos/sorted_containers/.tox/dist/sortedcontainers-0.8.0.zip
107
- py34 runtests: PYTHONHASHSEED='1205144536'
108
- py34 runtests: commands[0] | nosetests
109
- ...
110
- ----------------------------------------------------------------------
111
- Ran 150 tests in 11.350s
112
-
113
- OK
114
- ___________________ summary _______________________
115
- py26: commands succeeded
116
- py27: commands succeeded
117
- py32: commands succeeded
118
- py33: commands succeeded
119
- py34: commands succeeded
120
- congratulations :)
121
-
122
- Coverage testing uses `nose <https://nose.readthedocs.org >`_:
65
+ $ python setup.py test
66
+ <todo>
67
+
68
+ Coverage testing uses `pytest-cov <https://pypi.org/project/pytest-cov/ >`_:
123
69
124
70
::
125
71
126
- $ nosetests --with-coverage
127
- ...................................................
128
- Name Stmts Miss Cover Missing
129
- -----------------------------------------------------------
130
- sortedcontainers 4 0 100%
131
- sortedcontainers.sorteddict 220 10 95% 18, 21, 96, 106, 115, 149, 158, 183, 220, 253
132
- sortedcontainers.sortedlist 452 1 99% 16
133
- sortedcontainers.sortedset 163 10 94% 51, 62, 65, 70, 75, 80, 84, 86, 88, 90
134
- -----------------------------------------------------------
135
- TOTAL 839 21 97%
136
- ----------------------------------------------------------------------
137
- Ran 146 tests in 15.447s
138
-
139
- OK
140
-
141
- It's normal not to see 100% coverage. Some code is specific to the Python
142
- runtime.
143
-
144
- Stress testing is also based on nose but can be run independently as a
72
+ $ todo
73
+
74
+ It's normal to see coverage a little less than 100%. Some code is specific to
75
+ the Python runtime.
76
+
77
+ Stress testing is also based on pytest but can be run independently as a
145
78
module. Stress tests are kept in the tests directory and prefixed with
146
79
test_stress. Stress tests accept two arguments: an iteration count and random
147
80
seed value. For example, to run stress on the SortedList data type:
@@ -155,24 +88,24 @@ seed value. For example, to run stress on the SortedList data type:
155
88
Exiting after 0:00:00.846000
156
89
157
90
If stress exits normally then it worked successfully. Some stress is run by tox
158
- and nose but the iteration count is limited at 1,000. More rigorous testing
91
+ and pytest but the iteration count is limited at 1,000. More rigorous testing
159
92
requires increasing the iteration count to millions. At that level, it's best
160
93
to just let it run overnight. Stress testing will stop at the first failure.
161
94
162
95
Running Benchmarks
163
96
------------------
164
97
165
98
Running and plotting benchmarks is a two step process. Each is a Python script
166
- in the tests directory. To run the benchmarks for SortedList, plot the results,
167
- and save the resulting graphs, run:
99
+ in the tests directory. To run the benchmarks for :class: ` SortedList ` , plot the
100
+ results, and save the resulting graphs, run:
168
101
169
102
::
170
103
171
104
$ python -m tests.benchmark_sortedlist --bare > tests/results_sortedlist.txt
172
105
$ python -m tests.benchmark_plot tests/results_sortedlist.txt SortedList --save
173
106
174
107
Each script has a handful of useful arguments. Use ``--help `` to display
175
- those. Consult the source for details. The file `` tests/benchmark_plot.py ` `
108
+ those. Consult the source for details. The file `tests/benchmark_plot.py `
176
109
contains notes about benchmarking different Python runtimes against each other.
177
110
178
111
If you simply want to run the benchmarks to observe the performance on your
@@ -189,7 +122,8 @@ local machine, then run:
189
122
$ python -m tests.benchmark_sortedset
190
123
191
124
The benchmarks will warn if some packages are not importable. This limits the
192
- possible comparisons. In all cases, you can install missing packages from PyPI.
125
+ possible comparisons. See `requirements.txt ` for the package names than can be
126
+ installed from PyPI.
193
127
194
128
Tested Runtimes
195
129
---------------
@@ -202,8 +136,9 @@ of Python:
202
136
* CPython 3.3
203
137
* CPython 3.4
204
138
* CPython 3.5
139
+ * CPython 3.6
205
140
* PyPy
206
141
* PyPy3
207
142
208
143
Life will feel much saner if you use `virtualenv <http://www.virtualenv.org/ >`_
209
- to manage each of the runtimes.
144
+ and ` tox ` to manage and test each of the runtimes.
0 commit comments