Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix code examples for setting-up-ide and interpreter-compatibility docs (Cherry-pick of #19624) #19639

Merged
merged 1 commit into from Aug 22, 2023

Conversation

WorkerPants
Copy link
Member

Setting Up IDE Doc Issue

Currently, in the docs/markdown/Using Pants/setting-up-an-ide.md page, the project instructs users to run

$ ROOTS=$(pants roots --roots-sep=' ')
$ python3 -c "print('PYTHONPATH=\"./' + ':./'.join(\"${ROOTS}\".split()) + ':\$PYTHONPATH\"')" > .env

However, for some reason, the command pants roots --roots-sep=' ' is not working for the ' ' character. This PR makes a small fix to this issue changing the ' ' character to the default '\n' by removing the --roots-sep= argument and changing how the ROOTS environment variable is split.

$ ROOTS=$(pants roots)
$ python3 -c "print('PYTHONPATH=\"./' + ':./'.join('''${ROOTS}'''.split('\n')) + ':\$PYTHONPATH\"')" > .env

Alternatively, if we want to maintain the roots-sep argument, so users know it exists, we can change it from ' ' to a non whitespace character, such as ';' and that also seems to work.

Interpreter Compatibility Doc Issue

Another small issue is in docs/markdown/Python/python/python-interpreter-compatibility.md in the example:

python_sources(
    name="lib",
    overrides={
        "py2.py": {"interpreter_constraints": ["==2.7.*"]},
        # You can use a tuple for multiple files:
        ("common.py", "f.py"): {"interpreter_constraints": ["==2.7.*"]},
)

This example is missing an }. This PR also addresses this small issue.

…bility` docs (#19624)

## Setting Up IDE Doc Issue

Currently, in the `docs/markdown/Using Pants/setting-up-an-ide.md` page,
the project instructs users to run

```shell
$ ROOTS=$(pants roots --roots-sep=' ')
$ python3 -c "print('PYTHONPATH=\"./' + ':./'.join(\"${ROOTS}\".split()) + ':\$PYTHONPATH\"')" > .env
```

However, for some reason, the command `pants roots --roots-sep=' '` is
not working for the `' '` character. This PR makes a small fix to this
issue changing the `' '` character to the default `'\n'` by removing the
`--roots-sep=` argument and changing how the `ROOTS` environment
variable is split.

```bash
$ ROOTS=$(pants roots)
$ python3 -c "print('PYTHONPATH=\"./' + ':./'.join('''${ROOTS}'''.split('\n')) + ':\$PYTHONPATH\"')" > .env
```

Alternatively, if we want to maintain the `roots-sep` argument, so users
know it exists, we can change it from `' '` to a non whitespace
character, such as `';'` and that also seems to work.

## Interpreter Compatibility Doc Issue

Another small issue is in
`docs/markdown/Python/python/python-interpreter-compatibility.md` in the
example:

```python
python_sources(
    name="lib",
    overrides={
        "py2.py": {"interpreter_constraints": ["==2.7.*"]},
        # You can use a tuple for multiple files:
        ("common.py", "f.py"): {"interpreter_constraints": ["==2.7.*"]},
)
```

This example is missing an `}`. This PR also addresses this small issue.
@benjyw benjyw merged commit 97a5a96 into 2.17.x Aug 22, 2023
24 checks passed
@benjyw benjyw deleted the cherry-pick-19624-to-2.17.x branch August 22, 2023 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants