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) #19695

Merged
merged 1 commit into from
Aug 29, 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.
@huonw huonw merged commit ca79eda into 2.18.x Aug 29, 2023
@huonw huonw deleted the cherry-pick-19624-to-2.18.x branch August 29, 2023 22:18
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.

3 participants