Skip to content

Commit

Permalink
Further emphasize virtual environments during installation
Browse files Browse the repository at this point in the history
  • Loading branch information
avanwinkle committed Jun 29, 2024
1 parent f8f7908 commit f638da3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 21 deletions.
11 changes: 9 additions & 2 deletions docs/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ As of MPF 0.80 we are providing precompiled binaries for new users to get up and
* Not (yet) available for all platforms
* No option to customize MPF or use bleeding-edge features

!!! note "No, it's not actually precompiled"
!!! note ""

MPF is written in Python, which is an interpreted language, and therefore cannot be truly "compiled" into a binary. The provided binaries are special applications that bundle a copy of Python, the MPF framework modules, and all dependency packages into a single file.
Okay, it's not technically "pre-compiled". MPF is written in Python, which is an interpreted language, and therefore cannot be truly "compiled" into a binary. The provided binaries are special applications that bundle a copy of Python, the MPF framework modules, and all dependency packages into a single file.

The point is, you can download a single file and run it and have a working copy of MPF!

Expand All @@ -53,6 +53,13 @@ As of MPF 0.80 we are providing precompiled binaries for new users to get up and
Regardless of your platform or Python version, a [virtual environment](virtual-environments.md) is
strongly recommended when working with MPF unless you are using a precompiled binary.

!!! danger "Do not skip the Virtual Environment"

Virtual environments are important for keeping your computer clean and preventing different packages from
conflicting. Without virtual environments, you may encounter dependency conflicts and stale packages that
will prevent MPF from running. Troubleshooting and manually cleaning up packages is a pain—do your future
self a favor and setup an MPF virtual environment now!

After creating your Python 3.8-3.12 virtual environment and activating it, install MPF 0.80.

``` console
Expand Down
7 changes: 7 additions & 0 deletions docs/install/mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ which will keep the installed packages from conflicting with other
applications on your computer. Before proceeding, follow the steps on
the [virtual environment installation guide](virtual-environments.md)

!!! danger "Do not skip the Virtual Environment"

Virtual environments are important for keeping your computer clean and preventing different packages from
conflicting. Without virtual environments, you may encounter dependency conflicts and stale packages that
will prevent MPF from running. Troubleshooting and manually cleaning up packages is a pain—do your future
self a favor and setup an MPF virtual environment now!

## Install MPF

First, activate the virtual environment you setup in the previous step.
Expand Down
46 changes: 27 additions & 19 deletions docs/install/virtual-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@ but can still be helpful for keeping packages organized and cleanly upgrading.
To keep itself isolated from other programs, your virtual enviroment only
activates when you tell it to.

!!! note

If you defined a specific path in the above step, replace mpfenv with the
path to the given folder, e.g., ``C:\Users\Rudy\venvs\mpf``.
!!! note Make note of this activation command

You can enable the virtual environment with the dot command from the terminal:
You may want to write this step down, as you'll run it every time you open up
a terminal window to work on MPF. If you are on a dedicated MPF machine, you
could add this line to your bash/zsh profile to automatically run it at login.

``` console
. ~/mpfenv/bin/activate
```

Note that the first character is a period, followed by a space, then the path
to your virtual environment and "/bin/activate".
If you defined a specific path when creating your virtual environment, replace
`mpfenv` below with the path to the given folder, e.g., ``C:\Users\Rudy\venvs\mpf``.

For Windows users, you well activate with a bat/ps1 script depending on whether you're using the Command Prompt or the PowerShell.
**Windows:**
For Windows users, you will activate with a bat/ps1 script depending on whether
you're using the Command Prompt or the PowerShell. The script lives in the "Scripts"
folder under where you created your virtual environment.

``` console
# Command Prompt:
Expand All @@ -76,20 +75,29 @@ For Windows users, you well activate with a bat/ps1 script depending on whether
PS > mpfenv/Scripts/Activate.ps1
```

For users on Mac OSX, you will use `source` instead:
**Mac:**

For users on Mac OSX, you will use the `source` command with the path to your venv:

``` console
source ~/mpfenv/bin/activate
```

!!! note Make note of this activation command
**Linux:**

You may want to write this step down, as you'll run it every time you open up
a terminal window to work on MPF. If you are on a dedicated MPF machine, you
could add this line to your bash/zsh profile to automatically run it at login.
Linux users can enable the virtual environment with the dot command from the terminal:
``` console
. ~/mpfenv/bin/activate
```

Note that the first character is a period, followed by a space, then the path
to your virtual environment and "/bin/activate".


**All Platforms:**

You'll know you're in the virtual environment because the console prompt will include
the name of your venv in parenthesis.
After you run the activation, you'll know you're in the virtual environment
because the console prompt will include the name of your venv in parenthesis.

``` console
My-Mac:~ python --version
Expand All @@ -100,7 +108,7 @@ the name of your venv in parenthesis.
(mpfenv) My-Mac:~
```

!!! note Virtual environments set a default "python"
!!! note "Virtual environments set a default python"

The python you used to create the virtual environment will now be the
default python. Outside the virtual environment "python" may be Python 2 or 3, and
Expand Down
7 changes: 7 additions & 0 deletions docs/install/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ which will keep the installed packages from conflicting with other
applications on your computer. Before proceeding, follow the steps on
the [virtual environment installation guide](virtual-environments.md)

!!! danger "Do not skip the Virtual Environment"

Virtual environments are important for keeping your computer clean and preventing different packages from
conflicting. Without virtual environments, you may encounter dependency conflicts and stale packages that
will prevent MPF from running. Troubleshooting and manually cleaning up packages is a pain—do your future
self a favor and setup an MPF virtual environment now!

## Install MPF

Now you're ready to install MPF. Open a new command window (cmd.exe),
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ nav:
- Quickstart: start/quickstart.md
- 'Migrating to 0.80': install/0.80.md
- 'Big changes in 0.57': install/0.57.md
- Virtual Environments: install/virtual-environments.md
- Mac: install/mac.md
- Windows: install/windows.md
- Linux:
Expand Down

0 comments on commit f638da3

Please sign in to comment.