forked from pantsbuild/pantsbuild.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python-readme.html
928 lines (864 loc) · 48 KB
/
python-readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
<!DOCTYPE html>
<html lang="en">
<!--
Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
Licensed under the Apache License, Version 2.0 (see LICENSE).
-->
<head>
<meta charset="utf-8" />
<title>Python Projects with Pants</title>
<link rel="stylesheet" href="s.css">
<script src="s.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="logo.ico">
<!-- In case this is a "test publish", tell search engines where real version lives: -->
<link rel="canonical" href="https://pantsbuild.github.io/python-readme.html">
</head>
<body>
<div id="navtoggler">
◄ <!-- triangle -->
</div>
<div class="mainflow">
<nav class="breadcrumbs">
<ul>
<li><a href="index.html">Pants Build</a>
<li><a href="python-readme.html">Python Projects with Pants</a>
</ul>
</nav>
<nav class="pagetoc">
<ul>
<li class="toc-h1"><a href="#relevant-goals-and-targets">Relevant Goals and Targets</a></li>
<li class="toc-h1"><a href="#build-for-a-simple-binary">BUILD for a Simple Binary</a></li>
<li class="toc-h1"><a href="#build-for-tests">BUILD for Tests</a></li>
<li class="toc-h1"><a href="#handling-python_requirement">Handling python_requirement</a></li>
<li class="toc-h1"><a href="#pex-contents">PEX Contents</a></li>
<li class="toc-h1"><a href="#interactive-console-with-repl-goal">Interactive Console with repl Goal</a></li>
<li class="toc-h1"><a href="#python_binary-entry_point">python_binary entry_point</a></li>
<li class="toc-h1"><a href="#more-about-python-tests">More About Python Tests</a></li>
<li class="toc-h2"><a href="#code-coverage">Code Coverage</a></li>
<li class="toc-h2"><a href="#interactive-debugging-on-test-failure">Interactive Debugging on Test Failure</a></li>
<li class="toc-h1"><a href="#building-a-setuppy-distutils-package">Building a setup.py Distutils Package</a></li>
<li class="toc-h1"><a href="#manipulating-pex-behavior-with-environment-variables">Manipulating PEX behavior with environment variables</a></li>
<li class="toc-h2"><a href="#pex_interpreter1">PEX_INTERPRETER=1</a></li>
<li class="toc-h2"><a href="#pex_verbose1">PEX_VERBOSE=1</a></li>
<li class="toc-h2"><a href="#pex_moduleentry_point">PEX_MODULE=entry_point</a></li>
<li class="toc-h2"><a href="#pex_coverage">PEX_COVERAGE</a></li>
</ul>
</nav>
<!-- main content start -->
<!-- generated by pants! -->
<style>
.codehilite .hll { background-color: #ffffcc }
.codehilite { background: #f0f0f0; }
.codehilite .c { color: #60a0b0; font-style: italic } /* Comment */
.codehilite .err { border: 1px solid #FF0000 } /* Error */
.codehilite .k { color: #007020; font-weight: bold } /* Keyword */
.codehilite .o { color: #666666 } /* Operator */
.codehilite .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #007020 } /* Comment.Preproc */
.codehilite .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
.codehilite .ge { font-style: italic } /* Generic.Emph */
.codehilite .gr { color: #FF0000 } /* Generic.Error */
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
.codehilite .go { color: #808080 } /* Generic.Output */
.codehilite .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.codehilite .gs { font-weight: bold } /* Generic.Strong */
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.codehilite .gt { color: #0040D0 } /* Generic.Traceback */
.codehilite .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.codehilite .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.codehilite .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
.codehilite .kp { color: #007020 } /* Keyword.Pseudo */
.codehilite .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
.codehilite .kt { color: #902000 } /* Keyword.Type */
.codehilite .m { color: #40a070 } /* Literal.Number */
.codehilite .s { color: #4070a0 } /* Literal.String */
.codehilite .na { color: #4070a0 } /* Name.Attribute */
.codehilite .nb { color: #007020 } /* Name.Builtin */
.codehilite .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
.codehilite .no { color: #60add5 } /* Name.Constant */
.codehilite .nd { color: #555555; font-weight: bold } /* Name.Decorator */
.codehilite .ni { color: #d55537; font-weight: bold } /* Name.Entity */
.codehilite .ne { color: #007020 } /* Name.Exception */
.codehilite .nf { color: #06287e } /* Name.Function */
.codehilite .nl { color: #002070; font-weight: bold } /* Name.Label */
.codehilite .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
.codehilite .nt { color: #062873; font-weight: bold } /* Name.Tag */
.codehilite .nv { color: #bb60d5 } /* Name.Variable */
.codehilite .ow { color: #007020; font-weight: bold } /* Operator.Word */
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
.codehilite .mf { color: #40a070 } /* Literal.Number.Float */
.codehilite .mh { color: #40a070 } /* Literal.Number.Hex */
.codehilite .mi { color: #40a070 } /* Literal.Number.Integer */
.codehilite .mo { color: #40a070 } /* Literal.Number.Oct */
.codehilite .sb { color: #4070a0 } /* Literal.String.Backtick */
.codehilite .sc { color: #4070a0 } /* Literal.String.Char */
.codehilite .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
.codehilite .s2 { color: #4070a0 } /* Literal.String.Double */
.codehilite .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
.codehilite .sh { color: #4070a0 } /* Literal.String.Heredoc */
.codehilite .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
.codehilite .sx { color: #c65d09 } /* Literal.String.Other */
.codehilite .sr { color: #235388 } /* Literal.String.Regex */
.codehilite .s1 { color: #4070a0 } /* Literal.String.Single */
.codehilite .ss { color: #517918 } /* Literal.String.Symbol */
.codehilite .bp { color: #007020 } /* Name.Builtin.Pseudo */
.codehilite .vc { color: #bb60d5 } /* Name.Variable.Class */
.codehilite .vg { color: #bb60d5 } /* Name.Variable.Global */
.codehilite .vi { color: #bb60d5 } /* Name.Variable.Instance */
.codehilite .il { color: #40a070 } /* Literal.Number.Integer.Long */
</style>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h1 id="python-projects-with-pants">Python Projects with Pants</h1></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#python-projects-with-pants">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>Pants makes the manipulation and distribution of hermetically sealed
Python environments painless. You can organize your code in the
<a href="first_concepts.html">Pants way</a>
with targets for binaries, libraries, and
tests. Pants builds Python code into
<a href="https://github.com/pantsbuild/pex/blob/master/docs/whatispex.rst">PEXes</a>.
(A PEX is, roughly, an archive file containing a runnable Python
environment.) Pants isn't the only PEX-generation tool out there; but if
you have some "common code" used by more than one PEX, Pants makes it
easy to manage the dependencies.</p>
<p>This page assumes that you've already read
<a href="first_tutorial.html">the Pants Tutorial</a>.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="relevant-goals-and-targets">Relevant Goals and Targets</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#relevant-goals-and-targets">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p><strong>Runnable Binary</strong></p>
<blockquote>
<p>Pants can generate PEXes, executables built from Python. Invoke the
<a href="options_reference.html#oref_goal_binary" pantsref="oref_goal_binary"><code>binary</code></a> goal on a
<a href="build_dictionary.html#bdict_python_binary" pantsref="bdict_python_binary"><code>python_binary</code></a> target to generate a <code>.pex</code>.
You can also invoke the
<a href="options_reference.html#oref_goal_run" pantsref="oref_goal_run"><code>run</code></a> goal on a
<code>python_binary</code> to run its code "in place."</p>
</blockquote>
<p><strong>Importable Code</strong></p>
<blockquote>
<p><a href="build_dictionary.html#bdict_python_library" pantsref="bdict_python_library"><code>python_library</code></a> BUILD targets make Python
code "import-able". The rule of thumb is that each directory of <code>.py</code>
files has a <code>BUILD</code> file with a <code>python_library</code> target. A Python
target that has a <code>python_library</code> in its <code>dependencies</code> can import
its code.</p>
<p>To use code that's not in your workspace, use a
<a href="build_dictionary.html#bdict_python_requirement_library" pantsref="bdict_python_requirement_library"><code>python_requirement_library</code></a>
and a
<a href="build_dictionary.html#bdict_python_requirement" pantsref="bdict_python_requirement"><code>python_requirement</code></a> to refer to
the code. To use several several of these via a <code>pip</code>-style
<code>requirements.txt</code> file, use a
<a href="build_dictionary.html#bdict_python_requirements" pantsref="bdict_python_requirements"><code>python_requirements</code></a>.
For details, see <a href="3rdparty_py.html">Python 3rdparty Pattern</a>.</p>
</blockquote>
<p><strong>Tests</strong></p>
<blockquote>
<p>A <a href="build_dictionary.html#bdict_python_tests" pantsref="bdict_python_tests"><code>python_tests</code></a> BUILD target has some <code>pytest</code> tests.
It normally depends on a <code>python_library</code> target so it can import and test the library's code.
Use the <a href="options_reference.html#oref_goal_test" pantsref="oref_goal_test"><code>test</code></a> goal to run these tests.</p>
</blockquote>
<p><strong>Generated Code</strong></p>
<blockquote>
<p>A <a href="build_dictionary.html#bdict_python_thrift_library" pantsref="bdict_python_thrift_library"><code>python_thrift_library</code></a> generates
Python code from <code>.thrift</code> source; a Python target that has this
target in its <code>dependencies</code> can <code>import</code> the generated Python code.</p>
</blockquote>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="build-for-a-simple-binary">BUILD for a Simple Binary</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#build-for-a-simple-binary">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>The pantsbuild/pants repo has a simple "hello world" sample Python
binary. You can use <code>binary</code> to build a PEX from it. You can then
run the PEX:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants binary examples/src/python/example/hello/main
...much output...
<span class="nv">$ </span>./dist/main.pex <span class="c"># run the generated PEX</span>
Hello, world!
<span class="nv">$ </span>./dist/main.pex Whirled
Hello, Whirled!
<span class="err">$</span>
</pre></div>
<p>You can also run the binary "from source" with the <code>run</code> goal:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants run.py --args<span class="o">=</span><span class="s1">'Whirled'</span> examples/src/python/example/hello/main
...much output...
14:32:01 00:00 <span class="o">[</span>py<span class="o">]</span>
14:32:02 00:01 <span class="o">[</span>run<span class="o">]</span>
Hello, Whirled!
14:32:02 00:01 <span class="o">[</span>jvm<span class="o">]</span>
SUCCESS
<span class="err">$</span>
</pre></div>
<p><a href="https://github.com/pantsbuild/pants/blob/master/examples/src/python/example/hello/main/BUILD"><code>examples/src/python/example/hello/main/BUILD</code></a>
defines a <code>python_binary</code> target, a build-able thing that defines a runnable program made from
Python code:</p>
<p>
<div class="md-included-snippet"><div class="codehilite"><pre><span class="n">python_binary</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'main'</span><span class="p">,</span>
<span class="n">dependencies</span><span class="o">=</span><span class="p">[</span>
<span class="s">'examples/src/python/example/hello/greet:greet'</span><span class="p">,</span>
<span class="p">],</span>
<span class="n">source</span><span class="o">=</span><span class="s">'main.py'</span><span class="p">,</span>
<span class="p">)</span>
</pre></div></div>
</p>
<p>This binary has a source file, <code>main.py</code>, with its "main". A Python binary's "main" can be in a
depended-upon <code>python_library</code> or in the <code>python_binary</code>'s <code>source</code>. (Notice that's <code>source</code>,
not <code>sources</code>; a binary can have only one source file. If you want more, put them in a
<code>python_library</code> and let the <code>python_binary</code> depend on that.)</p>
<p>
<div class="md-included-snippet"><div class="codehilite"><pre><span class="k">if</span> <span class="n"><strong>name</strong></span> <span class="o">==</span> <span class="s">'<strong>main</strong>'</span><span class="p">:</span>
<span class="n">greetees</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="ow">or</span> <span class="p">[</span><span class="s">'world'</span><span class="p">]</span>
<span class="k">for</span> <span class="n">greetee</span> <span class="ow">in</span> <span class="n">greetees</span><span class="p">:</span>
<span class="k">print</span><span class="p">(</span><span class="n">greet</span><span class="p">(</span><span class="n">greetee</span><span class="p">))</span>
</pre></div></div>
</p>
<p>This code imports code from another target. To make this work, the
binary target has a dependency <code>examples/src/python/example/hello/greet</code>
and the Python code can thus import things from <code>example.hello.greet</code>.</p>
<p>You remember that libraries configure "importable" code;
<code>example/hello/greet/BUILD</code> has a <code>python_library</code>:</p>
<p>
<div class="md-included-snippet"><div class="codehilite"><pre><span class="n">python_library</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'greet'</span><span class="p">,</span>
<span class="n">dependencies</span><span class="o">=</span><span class="p">[</span>
<span class="s">'3rdparty/python:ansicolors'</span><span class="p">,</span>
<span class="p">],</span>
<span class="n">sources</span><span class="o">=</span><span class="n">globs</span><span class="p">(</span><span class="s">'*.py'</span><span class="p">),</span>
<span class="p">)</span>
</pre></div></div>
</p>
<p>This <code>python_library</code> pulls in <code>greet.py</code>'s Python code:</p>
<p>
<div class="md-included-snippet"><div class="codehilite"><pre><span class="kn">from</span> <span class="nn">colors</span> <span class="kn">import</span> <span class="n">green</span>
<span class="k">def</span> <span class="nf">greet</span><span class="p">(</span><span class="n">greetee</span><span class="p">):</span>
<span class="sd">"""Given the name, return a greeting for a person of that name."""</span>
<span class="k">return</span> <span class="n">green</span><span class="p">(</span><span class="s">'Hello, </span><span class="si">%s</span><span class="s">!'</span> <span class="o">%</span> <span class="n">greetee</span><span class="p">)</span>
</pre></div></div>
</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="build-for-tests">BUILD for Tests</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#build-for-tests">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>To test the library's code, we set up
<a href="https://github.com/pantsbuild/pants/blob/master/examples/tests/python/example_test/hello/greet/BUILD"><code>examples/tests/python/example_test/hello/greet/BUILD</code></a>
with a <code>python_tests</code> target. It depends on the library:</p>
<p>
<div class="md-included-snippet"><div class="codehilite"><pre><span class="n">python_tests</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'greet'</span><span class="p">,</span>
<span class="n">dependencies</span><span class="o">=</span><span class="p">[</span>
<span class="s">'examples/src/python/example/hello/greet:greet'</span><span class="p">,</span>
<span class="s">':prep'</span><span class="p">,</span>
<span class="p">],</span>
<span class="n">sources</span><span class="o">=</span><span class="n">globs</span><span class="p">(</span><span class="s">'*.py'</span><span class="p">),</span>
<span class="p">)</span>
<span class="c"># Prepare for the 'greet' test. Realistically, you wouldn't set up a</span>
<span class="c"># prep_command just to create an emtpy temp file. This is meant as a</span>
<span class="c"># simple example.</span>
<span class="n">prep_command</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">'prep'</span><span class="p">,</span>
<span class="n">prep_executable</span><span class="o">=</span><span class="s">'touch'</span><span class="p">,</span>
<span class="n">prep_args</span><span class="o">=</span><span class="p">[</span><span class="s">'/tmp/prep_command_result'</span><span class="p">]</span>
<span class="p">)</span>
</pre></div></div>
</p>
<p>Use <code>test</code> to run the tests. This uses <code>pytest</code>:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants <span class="nb">test </span>examples/tests/python/example_test/hello/greet
13:29:28 00:00 <span class="o">[</span>main<span class="o">]</span>
<span class="o">(</span>To run a reporting server: ./pants server<span class="o">)</span>
13:29:28 00:00 <span class="o">[</span>bootstrap<span class="o">]</span>
13:29:28 00:00 <span class="o">[</span>setup<span class="o">]</span>
13:29:28 00:00 <span class="o">[</span>parse<span class="o">]</span>
...
13:29:29 00:01 <span class="o">[</span><span class="nb">test</span><span class="o">]</span>
13:29:29 00:01 <span class="o">[</span>pytest<span class="o">]</span>
13:29:29 00:01 <span class="o">[</span>run<span class="o">]</span>
<span class="o">==============</span> <span class="nb">test </span>session <span class="nv">starts</span> <span class="o">===============</span>
platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2
plugins: cov, timeout
collected 1 items
examples/tests/python/example_test/hello/greet/greet.py .
<span class="o">============</span> 1 passed in 0.02 <span class="nv">seconds</span> <span class="o">============</span>
13:30:18 00:50 <span class="o">[</span>junit<span class="o">]</span>
13:30:18 00:50 <span class="o">[</span>specs<span class="o">]</span>
SUCCESS
<span class="err">$</span>
</pre></div>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="handling-python_requirement">Handling <code>python_requirement</code></h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#handling-python_requirement">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p><code>BUILD</code> files specify outside Python dependencies via
<a href="build_dictionary.html#bdict_python_requirements" pantsref="bdict_python_requirements"><code>python_requirements</code></a> and a
<code>requirements.txt</code> file and/or
<a href="build_dictionary.html#bdict_python_requirement_library" pantsref="bdict_python_requirement_library"><code>python_requirement_library</code></a> targets wrapping
<a href="build_dictionary.html#bdict_python_requirement" pantsref="bdict_python_requirement"><code>python_requirement</code></a>s.</p>
<p>Pants handles these dependencies for you. It never installs anything
globally. Instead, it builds the dependencies, caches them in <code>.pants.d</code>,
and assembles them <em>a la carte</em> into an execution environment.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="pex-contents">PEX Contents</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#pex-contents">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>To build a PEX, invoke <code>./pants binary</code> on a <code>python_binary</code>
target:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants binary examples/src/python/example/hello/main
...
SUCCESS
<span class="nv">$ </span>./dist/main.pex
Hello, world!
</pre></div>
<p>Though the binary itself specifies just one dependency, the transitive
closure of hello/main's dependencies pulled in hello/greet and, in turn,
hello/greet's dependencies. Pants bundles up the closed set of all
dependencies into into the PEX.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="interactive-console-with-repl-goal">Interactive Console with <code>repl</code> Goal</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#interactive-console-with-repl-goal">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>Use the <a href="options_reference.html#oref_goal_repl" pantsref="oref_goal_repl"><code>repl</code></a> goal with a Python target to run an interactive
Python REPL session.
Within the session, you can <code>import</code> the target's code and the code of its dependencies.</p>
<p>To drop into our example library target <code>examples/src/python/example/hello/greet</code> with verbosity
turn on to see what's going on in the background:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants -ldebug repl examples/src/python/example/hello/greet
15:11:41 00:00 <span class="o">[</span>main<span class="o">]</span>
<span class="o">(</span>To run a reporting server: ./pants server<span class="o">)</span>
...lots of build output...
15:11:42 00:01 <span class="o">[</span>repl<span class="o">]</span>
15:11:42 00:01 <span class="o">[</span>python-repl<span class="o">]</span>Building chroot <span class="k">for</span> <span class="o">[</span>PythonLibrary<span class="o">(</span>BuildFileAddress<span class="o">(</span>/Users/lhosken/workspace/pants/examples/src/python/example/hello/greet/BUILD, greet<span class="o">))]</span>:
Dumping library: PythonLibrary<span class="o">(</span>BuildFileAddress<span class="o">(</span>/Users/lhosken/workspace/pants/examples/src/python/example/hello/greet/BUILD, greet<span class="o">))</span>
Dumping requirement: <span class="nv">ansicolors</span><span class="o">==</span>1.0.2
Dumping distribution: .../ansicolors-1.0.2-py2-none-any.whl
15:11:42 00:01 <span class="o">[</span>run<span class="o">]</span>
Python 2.7.5 <span class="o">(</span>default, Mar 9 2014, 22:15:05<span class="o">)</span>
<span class="o">[</span>GCC 4.2.1 Compatible Apple LLVM 5.0 <span class="o">(</span>clang-500.0.68<span class="o">)]</span> on darwin
Type <span class="s2">"help"</span>, <span class="s2">"copyright"</span>, <span class="s2">"credits"</span> or <span class="s2">"license"</span> <span class="k">for </span>more information.
<span class="o">(</span>InteractiveConsole<span class="o">)</span>
>>>
</pre></div>
<p>Pants loads <code>ansicolors</code> (<code>greet</code>'s 3rdparty dependency). It would have
fetched this dependency over the network if necessary. (It wasn't
necessary to download <code>ansicolors</code>; Pants had already fetched it while
"bootstrapping" itself.)</p>
<p>To convince yourself that the environment contains <code>greet</code>'s dependencies, you can inspect
<code>sys.path</code> and import libraries:</p>
<div class="codehilite"><pre><span class="o">>>></span> <span class="kn">from</span> <span class="nn">example.hello.greet.greet</span> <span class="kn">import</span> <span class="n">greet</span>
<span class="o">>>></span> <span class="n">greet</span><span class="p">(</span><span class="s">"escape codes"</span><span class="p">)</span>
<span class="s">u'</span><span class="se">\x1b</span><span class="s">[32mHello, escape codes!</span><span class="se">\x1b</span><span class="s">[0m'</span>
<span class="o">>>></span> <span class="kn">from</span> <span class="nn">colors</span> <span class="kn">import</span> <span class="n">red</span>
<span class="o">>>></span> <span class="n">red</span><span class="p">(</span><span class="s">"other escape codes"</span><span class="p">)</span>
<span class="s">'</span><span class="se">\x1b</span><span class="s">[31mother escape codes</span><span class="se">\x1b</span><span class="s">[0m'</span>
</pre></div>
<p><strong>Dependencies built by Pants are never installed globally</strong>. These
dependencies only exist for the duration of the Python interpreter
forked by Pants.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="python_binary-entry_point"><code>python_binary</code> <code>entry_point</code></h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#python_binary-entry_point">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>An advanced feature of <code>python_binary</code> targets, you may in addition
specify direct entry points into PEX files rather than a source file.
For example, if we wanted to build an a la carte fab wrapper for fabric:</p>
<div class="codehilite"><pre><span class="n">python_binary</span><span class="p">(</span><span class="n">name</span> <span class="o">=</span> <span class="s">"fab"</span><span class="p">,</span>
<span class="n">entry_point</span> <span class="o">=</span> <span class="s">"fabric.main:main"</span><span class="p">,</span>
<span class="n">dependencies</span> <span class="o">=</span> <span class="p">[</span>
<span class="s">"3rdparty/python:fabric"</span><span class="p">,</span>
<span class="p">]</span>
<span class="p">)</span>
</pre></div>
<p>We build:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants src/python/fabwrap:fab
...
Wrote /private/tmp/wickman-pants/dist/fab.pex
</pre></div>
<p>And now dist/fab.pex behaves like a standalone fab binary:</p>
<div class="codehilite"><pre><span class="nv">$ </span>dist/fab.pex -h
Usage: fab <span class="o">[</span>options<span class="o">]</span> <<span class="nb">command</span>><span class="o">[</span>:arg1,arg2<span class="o">=</span>val2,host<span class="o">=</span>foo,hosts<span class="o">=</span><span class="s1">'h1;h2'</span>,...<span class="o">]</span> ...
Options:
-h, --help show this <span class="nb">help </span>message and <span class="nb">exit</span>
-d NAME, --display<span class="o">=</span>NAME
print detailed info about <span class="nb">command </span>NAME
-F FORMAT, --list-format<span class="o">=</span>FORMAT
formats --list, choices: short, normal, nested
-l, --list print list of possible commands and <span class="nb">exit</span>
--set<span class="o">=</span><span class="nv">KEY</span><span class="o">=</span>VALUE,... comma separated <span class="nv">KEY</span><span class="o">=</span>VALUE pairs to <span class="nb">set </span>Fab env vars
--shortlist <span class="nb">alias </span><span class="k">for</span> -F short --list
-V, --version show program<span class="s1">'s version number and exit</span>
<span class="s1"> -a, --no_agent don'</span>t use the running SSH agent
-A, --forward-agent forward <span class="nb">local </span>agent to remote end
--abort-on-prompts abort instead of prompting <span class="o">(</span><span class="k">for </span>password, host, etc<span class="o">)</span>
...
</pre></div>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="more-about-python-tests">More About Python Tests</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#more-about-python-tests">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>Pants runs Python tests with <code>pytest</code>. You can pass CLI options to <code>pytest</code> with
<code>test.pytest --options</code>. For example, to only run tests whose names contain <code>req</code>,
you could run:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest --options<span class="o">=</span><span class="s1">'-k req'</span> examples/tests/python/example_test/hello/greet
...
<span class="o">==============</span> <span class="nb">test </span>session <span class="nv">starts</span> <span class="o">===============</span>
platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2
plugins: cov, timeout
collected 2 <span class="nv">items</span>
<span class="o">=========</span> 2 tests deselected by <span class="s1">'-kfoo'</span> <span class="o">==========</span>
<span class="o">==========</span> 2 deselected in 0.01 <span class="nv">seconds</span> <span class="o">==========</span>
13:34:28 00:02 <span class="o">[</span>junit<span class="o">]</span>
13:34:28 00:02 <span class="o">[</span>specs<span class="o">]</span>
SUCCESS
</pre></div>
<p>You can pass CLI options to <code>pytest</code> via passthrough parameters if <code>test.pytest</code> is the last goal
and task on your command line. E.g., to run only tests whose names contain <code>req</code> via passthrough
parameters:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest examples/tests/python/example_test/hello/greet -- -k req
...lots of build output...
10:43:04 00:01 <span class="o">[</span><span class="nb">test</span><span class="o">]</span>
10:43:04 00:01 <span class="o">[</span>run_prep_command<span class="o">]</span>
10:43:04 00:01 <span class="o">[</span>prep_command<span class="o">]</span>
10:43:04 00:01 <span class="o">[</span>pytest<span class="o">]</span>
10:43:04 00:01 <span class="o">[</span>run<span class="o">]</span>
<span class="o">==============</span> <span class="nb">test </span>session <span class="nv">starts</span> <span class="o">===============</span>
platform darwin -- Python 2.7.5 -- py-1.4.26 -- pytest-2.6.4
plugins: cov, timeout
collected 2 items
examples/tests/python/example_test/hello/greet/greet.py .
<span class="o">=========</span> 1 tests deselected by <span class="s1">'-kreq'</span> <span class="o">==========</span>
<span class="o">=====</span> 1 passed, 1 deselected in 0.05 <span class="nv">seconds</span> <span class="o">=====</span>
10:43:05 00:02 <span class="o">[</span>junit<span class="o">]</span>
10:43:05 00:02 <span class="o">[</span>specs<span class="o">]</span>
SUCCESS
</pre></div>
<p>...and to "unsilence" py.test (not suppress stderr and stdout), pass <code>-- -s</code>:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest examples/tests/python/example_test/hello/greet -- -s
</pre></div>
<p>...and to remind yourself of py.test's help:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest examples/tests/python/example_test/hello/greet -- -h
</pre></div>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="code-coverage">Code Coverage</h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#code-coverage">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>To get code coverage data, set the <code>--coverage</code> flag in <code>test.pytest</code> scope.
If you haven't configured coverage data, it doesn't do much:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest --coverage<span class="o">=</span>1 examples/tests/python/example_test/hello/greet:greet
...lots of build output...
<span class="o">============</span> 2 passed in 0.23 <span class="nv">seconds</span> <span class="o">============</span>
Name Stmts Miss Cover
---------------------------
No data to report.
14:30:36 00:04 <span class="o">[</span>junit<span class="o">]</span>
14:30:36 00:04 <span class="o">[</span>specs<span class="o">]</span>
</pre></div>
<p>This uses the <code>python_tests.coverage</code> target attribute to determine what
modules to measure coverage against for each <code>python_tests</code> target run.
If the attribute is not present it's assumed the coverage should be
measured over the same packages that house the test target's sources.
This heuristic only works with parallel source and test package
structures and reliance upon it is discouraged.</p>
<p>There are 2 alternatives to specifying coverage attributes on all
<code>python_tests</code> targets, but both override any existing coverage
attributes in-play to form a global coverage specification for the test
run.</p>
<p><code>--coverage=modules:[module1](,...,[moduleN])</code> allows specification of
package or module names to track coverage against. For example:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest --coverage<span class="o">=</span>modules:example.hello.greet,example.hello.main examples/tests/python/example_test/hello/greet:greet
...lots of build output...
<span class="o">============</span> 2 passed in 0.22 <span class="nv">seconds</span> <span class="o">============</span>
Name Stmts Miss Branch BrMiss Cover
------------------------------------------------------------------------------------
examples/src/python/example/hello/greet/__init__ 0 0 0 0 100%
examples/src/python/example/hello/greet/greet 4 0 0 0 100%
------------------------------------------------------------------------------------
TOTAL 4 0 0 0 100%
</pre></div>
<p>This measures coverage against all python code in <code>example.hello.greet</code> and <code>example.hello.main</code>.
It ignores <code>python_library</code> <code>coverage=...</code> attributes.</p>
<p>Similarly, a set of base paths can be specified containing the code for
coverage to be measured over:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants test.pytest --coverage<span class="o">=</span>paths:example/hello examples/tests/python/example_test/hello/greet:greet
...lots of build output...
<span class="o">============</span> 2 passed in 0.23 <span class="nv">seconds</span> <span class="o">============</span>
Name Stmts Miss Branch BrMiss Cover
------------------------------------------------------------------------------------
examples/src/python/example/hello/__init__ 0 0 0 0 100%
examples/src/python/example/hello/greet/__init__ 0 0 0 0 100%
examples/src/python/example/hello/greet/greet 4 0 0 0 100%
------------------------------------------------------------------------------------
TOTAL 4 0 0 0 100%
</pre></div>
<p>Paths are relative to the source root housing the python code; for this example,
<code>examples/src/python</code>.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="interactive-debugging-on-test-failure">Interactive Debugging on Test Failure</h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#interactive-debugging-on-test-failure">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>You can invoke the Python debugger on a test failure by leaving out the
<code>test</code> and passing <code>--pdb</code>. This can be useful for inspecting the
state of objects especially if you are mocking interfaces.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="building-a-setuppy-distutils-package">Building a <code>setup.py</code> Distutils Package</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#building-a-setuppy-distutils-package">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>You can build Distutils packages from <code>python_library</code> targets.</p>
<p>To make a <code>python_library</code> "setup-able", give it a <code>provides</code> parameter; this parameter's value
should be a <a href="build_dictionary.html#bdict_setup_py" pantsref="bdict_setup_py"><code>setup_py</code></a> call; this call's parameters will be
passed to the <code>setup</code> function.</p>
<div class="codehilite"><pre><span class="n">python_library</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="s">'test_infra'</span><span class="p">,</span>
<span class="n">dependencies</span><span class="o">=</span><span class="p">[</span>
<span class="s">'tests/python/pants_test:base_test'</span><span class="p">,</span>
<span class="o">...</span>
<span class="p">],</span>
<span class="n">provides</span><span class="o">=</span><span class="n">setup_py</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="s">'pantsbuild.pants.testinfra'</span><span class="p">,</span>
<span class="n">version</span><span class="o">=</span><span class="s">'0.0.24'</span><span class="p">,</span>
<span class="n">description</span><span class="o">=</span><span class="s">'Test support for writing pants plugins.'</span><span class="p">,</span>
<span class="n">long_description</span><span class="o">=</span><span class="n">read_contents</span><span class="p">(</span><span class="s">'ABOUT.rst'</span><span class="p">)</span> <span class="o">+</span> <span class="n">read_contents</span><span class="p">(</span><span class="s">'CHANGELOG.rst'</span><span class="p">),</span>
<span class="n">url</span><span class="o">=</span><span class="s">'https://github.com/pantsbuild/pants'</span><span class="p">,</span>
<span class="n">license</span><span class="o">=</span><span class="s">'Apache License, Version 2.0'</span><span class="p">,</span>
<span class="n">zip_safe</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
<span class="n">namespace_packages</span><span class="o">=</span><span class="p">[</span><span class="s">'pants_test'</span><span class="p">],</span>
<span class="n">classifiers</span><span class="o">=</span><span class="p">[</span>
<span class="s">'Intended Audience :: Developers'</span><span class="p">,</span>
<span class="s">'License :: OSI Approved :: Apache Software License'</span><span class="p">,</span>
<span class="s">'Operating System :: MacOS :: MacOS X'</span><span class="p">,</span>
<span class="s">'Operating System :: POSIX :: Linux'</span><span class="p">,</span>
<span class="s">'Programming Language :: Python'</span><span class="p">,</span>
<span class="s">'Topic :: Software Development :: Build Tools'</span><span class="p">,</span>
<span class="s">'Topic :: Software Development :: Testing'</span><span class="p">,</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="p">)</span>
</pre></div>
<p>The <a href="options_reference.html#oref_goal_setup-py" pantsref="oref_goal_setup-py"><code>setup-py</code></a> goal builds a package from such a target:</p>
<div class="codehilite"><pre><span class="nv">$ </span>./pants setup-py src/python/pants:test_infra
10:23:06 00:00 <span class="o">[</span>main<span class="o">]</span>
<span class="o">(</span>To run a reporting server: ./pants server<span class="o">)</span>
10:23:07 00:01 <span class="o">[</span>bootstrap<span class="o">]</span>
10:23:07 00:01 <span class="o">[</span>setup<span class="o">]</span>
10:23:07 00:01 <span class="o">[</span>parse<span class="o">]</span>
Executing tasks in goals: setup-py
10:23:07 00:01 <span class="o">[</span>setup-py<span class="o">]</span>
10:23:07 00:01 <span class="o">[</span>setup-py<span class="o">]</span>
Running packager against /Users/you/workspace/pants/dist/pantsbuild.pants.testinfra-0.0.24
Writing /Users/you/workspace/pants/dist/pantsbuild.pants.testinfra-0.0.24.tar.gz
SUCCESS
</pre></div>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h2 id="manipulating-pex-behavior-with-environment-variables">Manipulating PEX behavior with environment variables</h2></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#manipulating-pex-behavior-with-environment-variables">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>You can alter a PEX file's behavior during invocation by setting some
environment variables.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="pex_interpreter1"><code>PEX_INTERPRETER=1</code></h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#pex_interpreter1">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>If you have a PEX file with a prescribed executable source or
<code>entry_point</code>, you can still drop into an interpreter with the
environment bootstrapped. Set <code>PEX_INTERPRETER=1</code> in your environment,
and the PEX bootstrapper skips any execution and instead launches an
interactive interpreter session.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="pex_verbose1"><code>PEX_VERBOSE=1</code></h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#pex_verbose1">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>If your environment is failing to bootstrap or simply bootstrapping very
slowly, it can be useful to set <code>PEX_VERBOSE=1</code> in your environment to
get debugging output printed to the console. Debugging output includes:</p>
<ol>
<li>Fetched dependencies</li>
<li>Built dependencies</li>
<li>Activated dependencies</li>
<li>Packages scrubbed out of sys.path</li>
<li>The sys.path used to launch the interpreter</li>
</ol>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="pex_moduleentry_point"><code>PEX_MODULE=entry_point</code></h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#pex_moduleentry_point">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>If you have a PEX file without a prescribed entry point, or want to
change the <code>entry_point</code> for a single invocation, you can set
<code>PEX_MODULE=entry_point</code> using the same format as described in the
<a href="build_dictionary.html#bdict_python_binary" pantsref="bdict_python_binary"><code>python_binary</code></a> Pants target.</p>
<p>This can be useful for bundling up some packages together and using that
single file to execute scripts from each of them.</p>
<p>Another common pattern is to link pytest into your PEX file, and run
<code>PEX_MODULE=pytest my_pex.pex tests/*.py</code> to run your test suite in its
isolated environment.</p>
<table class="h-plus-pilcrow">
<tbody>
<tr>
<td class="h-plus-pilcrow-holder"><h3 id="pex_coverage"><code>PEX_COVERAGE</code></h3></td>
<td><div class="pilcrow-div">
<a class="pilcrow-link" href="#pex_coverage">¶</a>
</div></td>
</tr>
</tbody>
</table>
<p>There is nascent support for performing code coverage within PEX files
by setting <code>PEX_COVERAGE=<suffix></code>. By default the coverage files will
be written into the current working directory with the file pattern
<code>.coverage.<suffix></code>. This requires that the coverage Python module has
been linked into your PEX.</p>
<p>You can then combine the coverage files by running <code>PEX_MODULE=coverage</code>
<code>my_pex.pex</code> <code>.coverage.suffix*</code> and run a report using
<code>PEX_MODULE=coverage</code>
<code>my_pex.pex</code> report. Since PEX files are just zip files, coverage is able
to understand and extract source and line numbers from them in order to
produce coverage reports.</p>
<!-- main content end -->
<div class="generated">
Generated by <a href="http://pantsbuild.github.io/docs.html">publish_docs</a>
from dist/markdown/html/examples/src/python/example/readme.html 2016-03-20T07:25:04.566741
</div>
</div> <!-- end of mainflow -->
<nav class="bignav">
<div class="bignav-logo">
<a href="index.html">
<img src="logo.ico" alt="[pantsbuild logo]">
</a>
</div>
<form class="search" action="https://www.google.com/search">
<input name="as_q" class="query" placeholder="Search">
<input name="as_sitesearch" value="pantsbuild.github.io" type="hidden">
</form>
<div class="site-toc">
<ul>
<li class="toc-h1 ">
<a href="first_concepts.html">Pants Conceptual Overview</a>
</li>
<li class="toc-h1 ">
<a href="install.html">Installing Pants</a>
</li>
<li class="toc-h1 ">
<a href="first_tutorial.html">First Tutorial</a>
</li>
<li class="toc-h1 ">
<a href="target_addresses.html">Target Addresses</a>
</li>
<li class="toc-h1 ">
<a href="JVMProjects.html">JVM Projects with Pants</a>
</li>
<li class="toc-h2 ">
<a href="3rdparty_jvm.html">JVM 3rdparty Pattern</a>
</li>
<li class="toc-h2 ">
<a href="scala.html">Scala Projects with Pants</a>
</li>
<li class="toc-h2 ">
<a href="from_maven.html">Pants for Maven Experts</a>
</li>
<li class="toc-h1 toc-here">
Python Projects with Pants
</li>
<li class="toc-h2 ">
<a href="3rdparty_py.html">Python 3rdparty Pattern</a>
</li>
<li class="toc-h2 ">
<a href="pex_design.html">PEX Design</a>
</li>
<li class="toc-h1 ">
<a href="page.html">README Files and Markdown</a>
</li>
<li class="toc-h1 ">
<a href="build_files.html">BUILD files</a>
</li>
<li class="toc-h1 ">
<a href="invoking.html">Invoking Pants Build</a>
</li>
<li class="toc-h1 ">
<a href="tshoot.html">Troubleshooting</a>
</li>
<li class="toc-h1 ">
<a href="3rdparty.html">Third-Party Dependencies</a>
</li>
<li class="toc-h2 ">
<a href="3rdparty_jvm.html">JVM 3rdparty Pattern</a>
</li>
<li class="toc-h2 ">
<a href="3rdparty_py.html">Python 3rdparty Pattern</a>
</li>
<li class="toc-h1 ">
<a href="ThriftDeps.html">Using Pants with Thrift Dependencies</a>
</li>
<li class="toc-h1 ">
<a href="publish.html">Publishing Artifacts</a>
</li>
<li class="toc-h1 ">
<a href="with_emacs.html">Emacs With Pants</a>
</li>
<li class="toc-h1 ">
<a href="with_intellij.html">Using Pants with IntelliJ IDEA</a>
</li>
<li class="toc-h1 ">
<a href="setup_repo.html">Set up Your Source Tree for Pants</a>
</li>
<li class="toc-h1 ">
<a href="build_dictionary.html">Pants BUILD Dictionary</a>
</li>
<li class="toc-h1 ">
<a href="options_reference.html">Pants Reference</a>
</li>
<li class="toc-h1 ">
<a href="changelog.html">RELEASE HISTORY</a>
</li>
<li class="toc-h1 ">
<a href="export.html">Export Format</a>
</li>
<li class="toc-h1 ">
<a href="dev.html">Pants Developer Center</a>
</li>
<li class="toc-h2 ">
<a href="howto_contribute.html">Pants Contributors Guide</a>
</li>
<li class="toc-h2 ">
<a href="howto_ask.html">How To Ask</a>
</li>
<li class="toc-h2 ">
<a href="howto_develop.html">Pants Developers Guide</a>
</li>
<li class="toc-h2 ">
<a href="dev_tasks.html">Task Developer's Guide</a>
</li>
<li class="toc-h3 ">
<a href="dev_tasks_publish_extras.html">Develop a Task to Publish "Extra" Artifacts</a>
</li>
<li class="toc-h2 ">
<a href="styleguide.html">Pants Style Guide</a>
</li>
<li class="toc-h2 ">
<a href="howto_plugin.html">Developing a Pants Plugin</a>
</li>
<li class="toc-h2 ">
<a href="intellij.html">Pants Development with IntelliJ IDEA</a>
</li>
<li class="toc-h2 ">
<a href="internals.html">Pants Internals</a>
</li>
<li class="toc-h2 ">
<a href="deprecation_policy.html">Pants Deprecation Policy</a>
</li>
<li class="toc-h2 ">
<a href="release.html">Release Process</a>
</li>
<li class="toc-h3 ">
<a href="release_jvm.html">JVM Artifact Release Process</a>
</li>
<li class="toc-h2 ">
<a href="docs.html">About the documentation</a>
</li>
<li class="toc-h2 ">
<a href="credits.html">Credits</a>
</li>
</ul>
</div>
</nav>
<div class="ci-status">
<a href="https://travis-ci.org/pantsbuild/pants">
<img src="https://travis-ci.org/pantsbuild/pants.png?branch=master"
alt="Are the tests passing?" title="Are the tests passing?"></a><br>
<a href="https://coveralls.io/r/pantsbuild/pants?branch=master">
<img src="https://coveralls.io/repos/pantsbuild/pants/badge.png?branch=master"
alt="Test Coverage Status" title="Test Coverage Status"></a>
</div>
</body>
</html>