This repository includes tools and scripts that install python locally in as consistent and benign as way as possible. Supports side-by-side installations for different versions of python and minimizes overhead through the use of virtual environments.
- Ensures that micromamba is available locally.
- Ensures that Python is available locally.
- Ensures that virtualenv is installed.
- Creates a python virtual environment for your cloned repository.
- Creates Activate and Decativate scripts for your cloned repository.
- Invokes custom bootstrapping functionality defined in your repository.
...details removed...
- Activates micromamba.
- Activates the python virtual environment.
- Invokes custom activation functionality defined in your repository.
- Invokes custom deactivation functionality defined in your repository.
- Deactivates the python virtual environment.
- Deactivates micromamba.
All changes to this repository are validated GitHub runners across the MacOS, Ubuntu, and Windows operating systems using the Python versions:
Python Version | First Released | End of Support |
---|---|---|
3.12 | October 2023 | October 2028 |
3.11 | October 2022 | October 2027 |
3.10 | October 2021 | October 2026 |
3.9 | October 2020 | October 2025 |
3.8 | October 2019 | October 2024 |
To begin using a git repository leveraging PythonBootstrapper functionality, run the scripts defined here in the following sections.
Operating System | Scripts |
---|---|
Linux / MacOS | ./Bootstrap.sh . ./Activate.sh . ./Deactivate.sh |
Windows | Bootstrap.cmd Activate.cmd Deactivate.cmd |
The bootstrap process prepares your local machine for development activities. Once the process is complete, your local machine will have micromamba
and python
installed, a virtual python environment created under the ./Generated
directory, and any custom bootstrap activities defined by the repository will have been run.
A repository will generally only need to be bootstrapped once after its is cloned.
Operating System | Script |
---|---|
Linux / MacOS | Bootstrap.sh [--python-version <version>] [--force] [--debug] [<any repository-specific arguments>] |
Windows | Bootstrap.cmd [--python-version <version>] [--force] [--debug] [<any repository-specific arguments>] |
The activation process prepares your local terminal environment for development activities. Once the process is complete, your terminal environment will have micromamba
and python
activated, and any custom activation activities defined by the repository will have been run.
Each terminal environment will need to be activated.
Operating System | Script |
---|---|
Linux / MacOS | Activate.sh [--verbose] [--debug] [<any repository-specific arguments>] |
Windows | Activate.cmd [--verbose] [--debug] [<any repository-specific arguments>] |
The deactivation process restores your local terminal environment to its state prior to activation. Once the process is complete, any custom deactivation activities defined by the repository will have been run, and your terminal will have micromamba
and python
deactivated.
A terminal environment can either be explicitly deactivated or simply closed.
Operating System | Script |
---|---|
Linux / MacOS | Deactivate.sh [--verbose] [--debug] [<any repository-specific arguments>] |
Windows | Deactivate.cmd [--verbose] [--debug] [<any repository-specific arguments>] |
Any repository can leverage the functionality provided by PythonBootstrapper, including the creation of custom steps invoked during the bootstrap, activation, or deactivation processes.
To use PythonBootstrapper functionality in your repository:
- Copy
./Templates/Bootstrap.sh
to the root of your repository (for Linux / MacOS support). - Copy
./Templates/Bootstrap.cmd
to the root of your repository (for Windows support). - Copy
./Templates/.gitignore
to the root of your repository (for git support).
Complete the steps in the following sections to customize the bootstrap, activation, or deactivation processes.
There are 2 ways to customize the bootstrap, activation, or deactivation processes:
- Add operating-system-specific functionality to
<Bootstrap|Activate|Deactivate>Epilog<.sh|.cmd>
. - Implement custom functionality in
<Bootstrap|Activate|Deactivate>Epilog.py
.
Examples for each of these methods for each event can be found in the files:
./Templates/BootstrapEpilog.sh
./Templates/BootstrapEpilog.cmd
./Templates/BootstrapEpilog.py
./Templates/ActivateEpilog.sh
./Templates/ActivateEpilog.cmd
./Templates/ActivateEpilog.py
./Templates/DeactivateEpilog.sh
./Templates/DeactivateEpilog.cmd
./Templates/DeactivateEpilog.py
The events to customize and the means by which they are customized are based on the needs of your repository and the operating systems that it supports.
- Python files are invoked within an activated environment.
- Python files may optionally write operating-system-specific functionality to a temporary file whose name is provided as the first argument when invoking the python script. These instructions are invoked within the current terminal environment once the python script is complete.
The following examples all use pip to install requirements defined in a requirements.txt
file.
BootstrapEpilog.sh
#!/usr/bin/env bash
pip install -r requirements.txt
BootstrapEpilog.cmd
pip install -r requirements.txt
BootstrapEpilog.py
import os
os.system("pip install -r requirements.txt")
Please visit Contributing and Development for information on contributing to this project.
Additional information can be found at these locations.
Title | Document | Description |
---|---|---|
Code of Conduct | CODE_OF_CONDUCT.md | Information about the the norms, rules, and responsibilities we adhere to when participating in this open source community. |
Contributing | CONTRIBUTING.md | Information about contributing code changes to this project. |
Development | DEVELOPMENT.md | Information about development activities involved in making changes to this project. |
Governance | GOVERNANCE.md | Information about how this project is governed. |
Maintainers | MAINTAINERS.md | Information about individuals who maintain this project. |
Security | SECURITY.md | Information about how to privately report security issues associated with this project. |
PythonBootstrapper is licensed under the MIT license.