Skip to content

Commit cf5fdcb

Browse files
Update install guide to use ./pants generate-pants-ini and pants_runtime_python_version (pantsbuild#7453)
Now that we support running with Python 3 and have the `./pants generate-pants-ini` command, we must update our setup instructions to explain how to use both.
1 parent 6030bdd commit cf5fdcb

File tree

3 files changed

+30
-42
lines changed

3 files changed

+30
-42
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ We use [Coveralls](https://coveralls.io) to monitor test coverage
1818

1919
# Requirements
2020

21-
At a minimum, pants requires the following to run properly:
21+
At a minimum, Pants requires the following to run properly:
2222

23-
* Linux or Mac OS X
24-
* Python 2.7.x (the latest stable version of 2.7 is recommended)
23+
* Linux or macOS.
24+
* Python 2.7 or 3.6.
2525
* A C compiler, system headers, Python headers (to compile native Python modules) and the libffi
2626
library and headers (to compile and link modules that use CFFI to access native code).
27-
* Internet access (so that pants can fully bootstrap itself)
27+
* Internet access (so that Pants can fully bootstrap itself)
2828

29-
Additionally, if you use the jvm backend to work with java or scala code (installed by default):
29+
Additionally, if you use the JVM backend to work with Java or Scala code (installed by default):
3030

31-
* OpenJDK or Oracle JDK version 7 or greater
31+
* OpenJDK or Oracle JDK version 7 or greater.
3232

src/docs/howto_develop.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@ You'll need to setup some files one-time in your own repo:
8484
'linux-x86_64',
8585
'macosx-10.4-x86_64',
8686
],
87-
# You may want to adjust the python interpreter constraints, but note that pants requires
88-
# python2.7 currently.
89-
compatibility='CPython>=2.7,<3',
87+
# You may want to adjust the Python interpreter constraints. Note that Pants requires Python 2.7
88+
# or 3.6+. Pex currently does not support flexible interpreter constraints (tracked by
89+
# https://github.com/pantsbuild/pex/issues/690), so you must choose which version to target.
90+
compatibility=['CPython==3.6.*'],
9091
dependencies=[
9192
':pantsbuild.pants',
9293
# List any other pants backend local or remote deps here, ie:
@@ -324,4 +325,3 @@ present as follows:
324325
...
325326
</chain>
326327
</resolvers>
327-

src/docs/install.md

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,51 @@
11
Installing Pants
22
================
33

4-
There are a few ways to get a runnable version of pants set up for your workspace. Before
5-
beginning, make sure your machine fits the requirements. At a minimum, pants requires the following to run properly:
4+
There are a few ways to get a runnable version of Pants set up for your workspace. Before
5+
beginning, make sure your machine fits the requirements. At a minimum, Pants requires the following to run properly:
66

7-
* Linux or Mac OS X.
8-
* Python 2.7.x (the latest stable version of 2.7 is recommended).
7+
* Linux or macOS.
8+
* Python 2.7 or 3.6.
99
* A C compiler, system headers, Python headers (to compile native Python modules) and the libffi
1010
library and headers (to compile and link modules that use CFFI to access native code).
1111
* OpenJDK or Oracle JDK 7 or greater.
12-
* Internet access (so that pants can fully bootstrap itself)
12+
* Internet access (so that Pants can fully bootstrap itself)
1313

14-
After you have pants installed, you'll need to
14+
After you have Pants installed, you'll need to
1515
[[Set up your code workspace to work with Pants|pants('src/docs:setup_repo')]].
1616

1717
Recommended Installation
1818
------------------------
1919

20-
To set up pants in your repo, we recommend installing our self-contained `pants` bash script
21-
in the root (ie, "buildroot") of your repo:
20+
To set up Pants in your repo, we recommend installing our self-contained `pants` bash script
21+
in the root (i.e. the "buildroot") of your repo:
2222

2323
:::bash
24-
curl -L -O https://pantsbuild.github.io/setup/pants && chmod +x pants && touch pants.ini
24+
curl -L -O https://pantsbuild.github.io/setup/pants && chmod +x pants
2525

26-
The first time you run the new `./pants` script it will install the latest version of pants (using
27-
virtualenv) and then run it. It's recommended though, that you pin the version of pants. To do
28-
this, first find out the version of pants you just installed:
26+
Start by running the below command to auto-generate a `pants.ini` config file with sensible defaults.
2927

3028
:::bash
31-
./pants -V
32-
1.0.0
29+
./pants generate-pants-ini
3330

34-
Then add an entry like so to `pants.ini` with that version:
31+
This command pins the `pants_version`. When you'd like to upgrade Pants, just edit the version in `pants.ini` and `./pants` will self-update on the next run.
3532

36-
:::ini
37-
[GLOBAL]
38-
pants_version: 1.0.0
39-
40-
When you'd like to upgrade pants, just edit the version in `pants.ini` and pants will self-update on
41-
the next run. This script stores the various pants versions you use centrally in
42-
`~/.cache/pants/setup`. When you switch back and forth between branches pants will select the
43-
correct version from your local cache and use that.
44-
45-
If you use pants plugins published to pypi you can configure them by adding a `plugins` list as
46-
follows:
33+
To use Pants plugins published to PyPi, add them to a `plugins` list, like so:
4734

4835
:::ini
4936
[GLOBAL]
50-
pants_version: 1.0.0
37+
pants_version: 1.15.0
5138

5239
plugins: [
5340
'pantsbuild.pants.contrib.go==%(pants_version)s',
5441
'pantsbuild.pants.contrib.scrooge==%(pants_version)s',
5542
]
5643

57-
Pants notices you changed your plugins and it installs them.
58-
NB: The formatting of the plugins list is important; all lines below the `plugins:` line must be
59-
indented by at least one white space to form logical continuation lines. This is standard for python
60-
ini files, see [[Options|pants('src/docs:options')]].
44+
Pants will notice you changed your plugins and will install them the next time you run `./pants`.
45+
46+
Note that the formatting of the plugins list is important; all lines below the `plugins:` line must be
47+
indented by at least one white space to form logical continuation lines. This is standard for Python
48+
ini files. See [[Options|pants('src/docs:options')]] for a guide on modifying your `pants.ini`.
6149

6250
The ./pants Runner Script
6351
-------------------------
@@ -98,6 +86,6 @@ where you are attempting to bootstrap pants. In particular, if you see an error
9886
Failed to install requirements from /Users/someuser/workspace/pants/3rdparty/python/requirements.txt.
9987

10088
This indicates that pants was attempting to `pip install` the `psutil` dependency into it's private
101-
virtualenv, and that install failed due to a compiler issue. On Mac OS X, we recommend running
89+
virtualenv, and that install failed due to a compiler issue. On macOS, we recommend running
10290
`xcode-select --install` to make sure you have the latest compiler infrastructure installed, and
10391
unset any compiler-related environment variables (i.e. run `unset CC`).

0 commit comments

Comments
 (0)