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: Document virtualenv for docs project #989

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

xmudrii
Copy link
Contributor

@xmudrii xmudrii commented Jul 4, 2024

Summary

The Development Environment document for the Documentation project suggests running pip to install the needed dependencies. However, starting with Python 3.11, it's not possible to run plain pip install because it fails with the following error:

error: externally-managed-environment

with the recommendation to use virtualenv or pipx. See this StackOverflow answer for more details about this change.

To conform to this requirement, the Development Environment document has been extended to cover creating and activating virtualenv.

Location

https://docs.flybywiresim.com/dev-corner/development-projects/documentation-project/documentation/#required-tools

Discord username (if different from GitHub): xmudrii

Copy link

vercel bot commented Jul 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 4, 2024 6:54pm

Copy link
Member

@Valastiri Valastiri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only one thing and this will be good to merge.

There's some other changes i'd like on this page but of scope for PR can be done later.

Comment on lines 58 to 62
```
!!! info "Using `virtualenv`"
Starting with Python 3.11, the `pip` tool will fail to install dependencies and packages globally, instead it's recommended to use `virtualenv`. If you desire to install packages globally, you must use another tool, such as [`pipx`](https://github.com/pypa/pipx). We recommend using `virtualenv` because it's easier and the recommended way to work on Python projects.
!!! danger "Activating `virtualenv`"
It's important to note that `virtualenv` activation is not persisted. If you restart your terminal/command prompt and want to work on the documentation project again, you have to reactivate your `virutalenv` using the appropriate activation command that was shown earlier in this guide.
- Install dependencies with this single line command:
```title="Run In Terminal"
pip install -r requirements.txt
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
!!! info "Using `virtualenv`"
Starting with Python 3.11, the `pip` tool will fail to install dependencies and packages globally, instead it's recommended to use `virtualenv`. If you desire to install packages globally, you must use another tool, such as [`pipx`](https://github.com/pypa/pipx). We recommend using `virtualenv` because it's easier and the recommended way to work on Python projects.
!!! danger "Activating `virtualenv`"
It's important to note that `virtualenv` activation is not persisted. If you restart your terminal/command prompt and want to work on the documentation project again, you have to reactivate your `virutalenv` using the appropriate activation command that was shown earlier in this guide.
- Install dependencies with this single line command:
```title="Run In Terminal"
pip install -r requirements.txt
```
```
- Install dependencies with this single line command:
```title="Run In Terminal"
pip install -r requirements.txt
```
!!! info "Using `virtualenv`"
Starting with Python 3.11, the `pip` tool will fail to install dependencies and packages globally, instead it's recommended to use `virtualenv`. If you desire to install packages globally, you must use another tool, such as [`pipx`](https://github.com/pypa/pipx). We recommend using `virtualenv` because it's easier and the recommended way to work on Python projects.
!!! danger "Activating `virtualenv`"
It's important to note that `virtualenv` activation is not persisted. If you restart your terminal/command prompt and want to preview your work on the documentation project again, you have to reactivate your `virutalenv` using the appropriate activation command that was shown earlier in this guide.

Ideally i'd like to move this step below the rest of the instructions and have the admonitions follow as "extra information" so the flow is neater when "reading".

Additionally, in the second admonition "Activiation virtual env" just a small change as spinning up the server isn't technically required when working on docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Valastiri pushed a commit to fix this. Just to confirm, should Create and activate a Python Virtual Environment stay as it is right now?

Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
@xmudrii xmudrii force-pushed the docs-python-venv branch from fdb012a to 7d38893 Compare July 4, 2024 18:53
@github-actions github-actions bot removed the Review Required PR Check Label label Jul 4, 2024
@github-actions github-actions bot merged commit c5d6e4f into flybywiresim:primary Jul 4, 2024
6 of 7 checks passed
@xmudrii xmudrii deleted the docs-python-venv branch July 4, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants