For all updates and changes, please refer to the Releases.
This tool allows you to create portable Python environments that can be easily distributed as archives. It streamlines the process of setting up and sharing Python projects with minimal configuration.
See the Demo or Demo_RU.MD for a step-by-step guide on creating a portable environment based on the stable-diffusion-webui-amdgpu project.
-
Download the Python Portable Project Creator:
- Download the latest release from Releases
-
Extract the downloaded archive to your desired location.
-
Copy your project files into the
your-projectfolder within the extracted structure.
project-root/
│
├── system/
│ ├── python/
│ ├── git/
│ ├── ffmpeg/
│ ├── ssh/
│ └── user/
│
├── your-project/
│
├── tmp/
│
├── activate.bat
├── clone.bat
├── env.bat
├── run.bat
├── update.bat
-
Configure
env.bat: Edit the following variables:APP_FOLDER: Name of your project folderREPO_URL: URL of your Git repositoryRESET_WHEN_UPDATE: Set to "true" to reset changes on updatePRIVATE_REPO: Set to "true" for private repositoriesGITHUB_SSH_PATH: Path to your SSH key (default isid_ed, change if different)CLEAR_TEMP_EVERY_RUN: Set to "true" to clear temporary files before each run (default)
-
For private repositories:
- Create the
system/sshfolder if it doesn't exist. - Add your SSH key to
system/ssh. - Ensure
PRIVATE_REPO=trueinenv.bat. - Update
REPO_URLinenv.batto use the SSH URL.
- Create the
-
Run
activate.batto set up the Python environment. -
Install dependencies: In the activated environment, run:
pip install -r requirements.txtNote: Always use
python -m pipnotpip.Update: In the latest update, you can use the standard
pip. You can download the latest version of the code from GitHub. -
Configure
run.bat: Specify your main Python file and any command-line arguments. -
Test the setup: Run your project using
run.bat. -
Prepare for distribution:
- Delete
activate.batandclone.bat. - Compress the entire folder into an archive.
- Delete
- This setup uses a portable Python installation instead of a traditional
venv. - To change the Python version, refer to
system/README.md. - The project includes a portable Git installation for version control.
- You can customize
env.batwith additional variables as needed. - If you realize that you've messed up your environment, you can go to the
systemfolder and reinstall Python using thereinstall_python.batfile. This will reset your environment.
This semi-automated setup allows for quick deployment of portable Python environments while providing flexibility for project-specific configurations.