Skip to content

Commit 5a479da

Browse files
committed
SVGs do not render on PyPI. Making a note
1 parent f0eaa9e commit 5a479da

File tree

1 file changed

+45
-41
lines changed

1 file changed

+45
-41
lines changed

Diff for: README.rst

+45-41
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
:target: https://landscape.io/github/brooksandrew/postman_problems/master
1212
:alt: Code Health
1313

14+
*Note to those reading this on PyPI: For a better reading experience, checkout the README on GitHub*
15+
`here <https://github.com/brooksandrew/postman_problems/blob/master/README.rst>`__. *GitHub and PyPI are not
16+
cooperating on rendering SVGs*.
17+
18+
1419

1520
.. sectnum::
1621

@@ -49,14 +54,14 @@ guarantees they'll be stable.
4954

5055
1. Clone the repo.
5156

52-
.. code:: bash
57+
.. code::
5358
5459
git clone https://github.com/brooksandrew/postman_problems.git
5560
cd postman_problems
5661
5762
2. Install with pip. Builds are tested on Python 2.7, 3.3, 3.4, 3.5, 3.6.
5863

59-
.. code:: bash
64+
.. code::
6065
6166
pip install .
6267
@@ -71,7 +76,7 @@ installing viz dependencies, if they so choose.
7176

7277
1. Install optional Python visualization libraries.
7378

74-
.. code:: bash
79+
.. code::
7580
7681
pip install postman_problems[viz]
7782
@@ -81,15 +86,15 @@ installing viz dependencies, if they so choose.
8186

8287
For Mac, this should be as easy as:
8388

84-
.. code:: bash
89+
.. code::
8590
86-
brew install graphviz
91+
brew install graphviz
8792
8893
For Linux,
8994

90-
.. code:: bash
95+
.. code::
9196
92-
sudo apt-get install graphviz
97+
sudo apt-get install graphviz
9398
9499
These are the installs I'm currently using on my builds for the `tests on TravisCI`_. YMMV. For Windows users and
95100
for those where these methods fail, I defer to the Graphviz download docs.
@@ -118,14 +123,14 @@ A note on some edge attributes:
118123
- ``required``: must be provided for the RPP. 0 is used for optional edges, 1 for required.
119124
- ``distance``: default edge attribute used for shortest path computations. Can be overridden with ``edge_weight``.
120125
- ``id``: recommended to not include, but will be used if provided. This will be generated automatically to assist with
121-
computation of parallel edges. If provided, it should be unique to ensure stable computation.
126+
computation of parallel edges. If provided, it should be unique to ensure stable computation.
122127

123128
Arguments: others
124129
~~~~~~~~~~~~~~~~~
125130

126131
For the complete list of optional arguments run one of the following:
127132

128-
.. code:: bash
133+
.. code::
129134
130135
chinese_postman --help
131136
rural_postman --help
@@ -140,21 +145,21 @@ Simple example
140145
Below we solve the CPP on the `Seven Bridges of Konigsberg`_ network. The edgelist is provided in this repo, but you
141146
can swap this out for any comma delimited text file where the first two columns represent the node pairs in your network.
142147

143-
.. code:: bash
148+
.. code::
144149
145150
chinese_postman --edgelist postman_problems/examples/seven_bridges/edgelist_seven_bridges.csv
146151
147152
148153
If the ``chinese_postman`` entry point is not working for whatever reason, you can run the script directly with:
149154

150-
.. code:: bash
155+
.. code::
151156
152157
python postman_problems/chinese_postman.py --edgelist postman_problems/examples/seven_bridges/edgelist_seven_bridges.csv
153158
154159
155160
You should see output that describes the CPP route solution (Eulerian circuit through each edge). Something like this:
156161

157-
.. code::
162+
.. code ::
158163
159164
('A', 'C', 1, {'trail': 'd', 'distance': 10, 'id': 3})
160165
('C', 'D', 0, {'trail': 'g', 'distance': 3, 'id': 6, 'augmented': True})
@@ -179,7 +184,7 @@ with two exceptions:
179184

180185
A summary report of the solution should be printed. Something like this:
181186

182-
.. code::
187+
.. code ::
183188
184189
Solution summary stats:
185190
distance_walked : 39
@@ -205,20 +210,19 @@ The snippet below should produce exactly the same output as printed above in `CL
205210

206211
.. code:: python
207212
208-
from postman_problems.solver import cpp
209-
from postman_problems.stats import calculate_postman_solution_stats
213+
from postman_problems.solver import cpp
214+
from postman_problems.stats import calculate_postman_solution_stats
210215
211-
# find CPP solution
212-
circuit, graph = cpp(edgelist_filename='postman_problems/examples/seven_bridges/edgelist_seven_bridges.csv',
213-
start_node='D')
216+
# find CPP solution
217+
circuit, graph = cpp(edgelist_filename='postman_problems/examples/seven_bridges/edgelist_seven_bridges.csv', start_node='D')
214218
215-
# print solution route
216-
for e in circuit:
217-
print(e)
219+
# print solution route
220+
for e in circuit:
221+
print(e)
218222
219-
# print solution summary stats
220-
for k, v in calculate_postman_solution_stats(circuit).items():
221-
print(k, v)
223+
# print solution summary stats
224+
for k, v in calculate_postman_solution_stats(circuit).items():
225+
print(k, v)
222226
223227
224228
Examples
@@ -257,7 +261,7 @@ right and this property is a key part of solving the Postman Problems.
257261

258262
This contrived example has been bundled and parameterized into a script that can be run with:
259263

260-
.. code:: bash
264+
.. code::
261265
262266
chinese_postman_seven_bridges
263267
@@ -266,7 +270,7 @@ The example can also be run using the verbose method below which allows you to p
266270
Many of the options provided below are defaults and can be excluded in practice. They are included here simply to convey
267271
what the possibilities are:
268272

269-
.. code:: bash
273+
.. code::
270274
271275
chinese_postman --edgelist postman_problems/examples/seven_bridges/edgelist_seven_bridges.csv \
272276
--viz \
@@ -282,7 +286,7 @@ what the possibilities are:
282286
283287
``base_cpp_graph.svg``: This is the starting graph. Edges are annotated by distance.
284288

285-
.. image:: ./postman_problems/examples/seven_bridges/output/base_cpp_graph.svg
289+
.. image:: https://github.com/brooksandrew/postman_problems/raw/master/postman_problems/examples/seven_bridges/output/base_cpp_graph.svg
286290

287291

288292
``cpp_graph.svg``: Edges are annotated with the order in which they are walked, starting at 0. Edges walked more than
@@ -299,7 +303,7 @@ once are annotated by a sequence of numbers (walk order) and **bolded**.
299303
``cpp_graph``: dot representation of the graph is also provided. This is mostly for reference, but in rare cases you may
300304
want to tweak graphviz parameters directly here.
301305

302-
.. code::
306+
.. code ::
303307
304308
graph {
305309
graph [forcelabels=true "strict"=false]
@@ -325,7 +329,7 @@ This is a simple example that demonstrates the power of the RPP vs CPP.
325329

326330
Run with:
327331

328-
.. code:: bash
332+
.. code::
329333
330334
rural_postman_star
331335
@@ -369,7 +373,7 @@ That's all I'll say here. I wrote more about the personal motivation and Sleepi
369373

370374
Run this example with:
371375

372-
.. code:: bash
376+
.. code::
373377
374378
rural_postman_sleeping_giant
375379
@@ -386,7 +390,7 @@ annotating their order in the route).
386390

387391
Here are the solution summary stats.
388392

389-
.. code::
393+
.. code ::
390394
391395
RPP Solution summary stats:
392396
@@ -408,7 +412,7 @@ so it is omitted here.
408412
For a base of comparison on RPP vs CPP, selected stats are printed below for the CPP. the RPP shortens the CPP solution
409413
route by about 1 mile.
410414

411-
.. code::
415+
.. code ::
412416
413417
CPP Solution summary stats:
414418
@@ -429,33 +433,33 @@ If you'd like to fork or contribute directly to this project (PRs welcome), or s
429433

430434
1. Full install with test and viz dependencies.
431435

432-
.. code:: bash
436+
.. code::
433437
434438
pip install .[test,viz]
435439
436440
Or do an editable install from the beginning. This is my typical approach when developing.
437441

438-
.. code:: bash
442+
.. code::
439443
440-
pip install -e .[test,viz]
444+
pip install -e .[test,viz]
441445
442446
2.
443447

444448
.. image:: http://troll.me/images/x-all-the-things/run-all-the-tests.jpg
445449

446-
.. code:: bash
450+
.. code::
447451
448-
python -m pytest
449-
pytest --cov
452+
python -m pytest
453+
pytest --cov
450454
451455
Some tests take quite a while to run. Namely the examples that write visualizations to the filesystem for large networks.
452456

453457
As I have limited patience while developing, but am too cautious to drop them completely, I've kept and marked them with the ``@slow`` and ``@long`` decorators. ``conftest.py`` is configured to exclude them by default with a simple run of ``pytest`` or ``python -m pytest``, but the full test suite can be run by:
454458

455-
.. code:: bash
459+
.. code::
456460
457-
python -m pytest --runslow
458-
pytest --cov --runslow
461+
python -m pytest --runslow
462+
pytest --cov --runslow
459463
460464
461465
Release Notes

0 commit comments

Comments
 (0)