Skip to content

Commit bb93b94

Browse files
authored
docs: README.md Do not hardcode the supported versions of Python (#2880)
1 parent 0f1f667 commit bb93b94

File tree

3 files changed

+24
-123
lines changed

3 files changed

+24
-123
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- run: pip install --user ruff
16-
- run: ruff --format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="PLC1901,S101,UP031" --target-version=py37 .
16+
- run: ruff --format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="E721,PLC1901,S101,UP031" --target-version=py38 .
1717
Tests:
18+
needs: Lint_Python # Lint_Python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
1819
strategy:
1920
fail-fast: false
2021
max-parallel: 15

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
`node-gyp` is a cross-platform command-line tool written in Node.js for
77
compiling native addon modules for Node.js. It contains a vendored copy of the
88
[gyp-next](https://github.com/nodejs/gyp-next) project that was previously used
9-
by the Chromium team, extended to support the development of Node.js native addons.
9+
by the Chromium team and extended to support the development of Node.js native
10+
addons.
1011

1112
Note that `node-gyp` is _not_ used to build Node.js itself.
1213

@@ -31,23 +32,22 @@ Depending on your operating system, you will need to install:
3132

3233
### On Unix
3334

34-
* Python v3.7, v3.8, v3.9, or v3.10
35+
* [A supported version of Python](https://devguide.python.org/versions/)
3536
* `make`
3637
* A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org)
3738

3839
### On macOS
3940

40-
**ATTENTION**: If your Mac has been _upgraded_ to macOS Catalina (10.15) or higher, please read [macOS_Catalina.md](macOS_Catalina.md).
41-
42-
* Python v3.7, v3.8, v3.9, or v3.10
41+
* [A supported version of Python](https://devguide.python.org/versions/)
4342
* `XCode Command Line Tools` which will install `clang`, `clang++`, and `make`.
4443
* Install the `XCode Command Line Tools` standalone by running `xcode-select --install`. -- OR --
4544
* Alternatively, if you already have the [full Xcode installed](https://developer.apple.com/xcode/download/), you can install the Command Line Tools under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`.
4645

4746

4847
### On Windows
4948

50-
Install the current version of Python from the [Microsoft Store package](https://www.microsoft.com/en-us/p/python-310/9pjpw5ldxlz5).
49+
Install the current [version of Python](https://devguide.python.org/versions/) from the
50+
[Microsoft Store](https://apps.microsoft.com/store/search?publisher=Python+Software+Foundation).
5151

5252
Install tools and configuration manually:
5353
* Install Visual C++ Build Environment: [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools)
@@ -62,9 +62,9 @@ Install tools and configuration manually:
6262

6363
### Configuring Python Dependency
6464

65-
`node-gyp` requires that you have installed a compatible version of Python, one of: v3.7, v3.8,
66-
v3.9, or v3.10. If you have multiple Python versions installed, you can identify which Python
67-
version `node-gyp` should use in one of the following ways:
65+
`node-gyp` requires that you have installed a [supported version of Python](https://devguide.python.org/versions/).
66+
If you have multiple versions of Python installed, you can identify which version
67+
`node-gyp` should use in one of the following ways:
6868

6969
1. by setting the `--python` command-line option, e.g.:
7070

@@ -73,24 +73,28 @@ node-gyp <command> --python /path/to/executable/python
7373
```
7474

7575
2. If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
76-
Python installed, then you can set `npm`'s 'python' config key to the appropriate
77-
value:
78-
76+
Python installed, then you can set the `npm_config_python` environment variable
77+
to the appropriate path:
7978
``` bash
80-
npm config set python /path/to/executable/python
79+
export npm_config_python=/path/to/executable/python
80+
```
81+
&nbsp;&nbsp;&nbsp;&nbsp;Or on Windows:
82+
```console
83+
py --list-paths # To see the installed Python versions
84+
set npm_config_python=C:\path\to\python.exe
8185
```
8286

8387
3. If the `PYTHON` environment variable is set to the path of a Python executable,
84-
then that version will be used, if it is a compatible version.
88+
then that version will be used if it is a supported version.
8589

8690
4. If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a
8791
Python executable, it will be used instead of any of the other configured or
88-
builtin Python search paths. If it's not a compatible version, no further
92+
built-in Python search paths. If it's not a compatible version, no further
8993
searching will be done.
9094

9195
### Build for Third Party Node.js Runtimes
9296

93-
When building modules for third party Node.js runtimes like Electron, which have
97+
When building modules for third-party Node.js runtimes like Electron, which have
9498
different build configurations from the official Node.js distribution, you
9599
should use `--dist-url` or `--nodedir` flags to specify the headers of the
96100
runtime to build for.
@@ -106,7 +110,7 @@ to work around configuration errors.
106110

107111
## How to Use
108112

109-
To compile your native addon, first go to its root directory:
113+
To compile your native addon first go to its root directory:
110114

111115
``` bash
112116
cd my_node_addon
@@ -240,7 +244,7 @@ Or this on Windows:
240244
set npm_config_devdir=c:\temp\.gyp
241245
```
242246

243-
### `npm` configuration
247+
### `npm` configuration for npm versions before v9
244248

245249
Use the form `OPTION_NAME` for any of the command options listed above.
246250

macOS_Catalina.md

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)