Py-Manager is a comprehensive toolkit for Python development environment management. It provides two main utilities:
-
Python Package Manager - Automates the process of updating Python packages while intelligently handling dependency conflicts, maintaining logs, and respecting package blacklists.
-
Virtual Environment Manager - Simplifies the creation, activation, and management of multiple Python virtual environments with tools for generating requirements files and installing dependencies across environments.
Designed to streamline Python development workflows, this project helps maintain clean, organized, and conflict-free Python environments.
- Automatically creates a
logs/directory and maintains timestamped logs. - Loads configuration from
package_config.json, allowing package blacklisting and specific version enforcement. - Upgrades
pipto the latest version. - Lists all outdated packages.
- Checks for dependency conflicts before upgrading.
- Upgrades packages while considering blacklists and specific version constraints.
- Detects and suggests packages to add to the blacklist based on recurring dependency issues.
- Provides a detailed summary after upgrades.
- Create and manage multiple Python virtual environments
- Generate and update requirements files for each environment
- Install dependencies from one environment to another
- Quick activation with Windows batch file aliases
- Clean removal of environments and their associated batch files
- Python 3.x
pip(installed by default with Python)
All dependencies are listed in the requirements.txt file. Most are standard libraries included with Python.
Clone this repository and navigate to the directory:
git clone https://github.com/simone-contorno/py-manager
cd py-managerNo additional installation is required as the project primarily uses standard Python libraries. If needed, you can install the few external dependencies with:
pip install -r requirements.txtpy-manager/
├── py_packages_update.py # Package update script
├── py_env_manager.py # Virtual environment management script
├── create_venv_alias.py # Script to create batch file aliases for environments
├── package_config.json # Configuration for package updates
├── requirements.txt # Project dependencies
├── venv/ # Directory containing all virtual environments
│ ├── environments/ # Individual virtual environments
│ └── requirements/ # Requirements files for each environment
├── bat/ # Directory containing batch file aliases
└── logs/ # Logs from package update operations
Edit the package_config.json file to specify blacklisted packages and version-specific requirements:
{
"blacklist": [
"package_name_1",
"...",
"package_name_k"
],
"specific_versions": {
"package_name_k+1": "x.x.x",
"...": "x.x.x",
"package_name_n": "x.x.x",
}
}blacklist: Packages in this list will not be upgraded.specific_versions: Specifies exact versions for certain packages.
Run the package update script with:
python py_packages_update.py- Logging: All actions are logged in a timestamped file inside the logs/ directory.
- Upgrade pip: Ensures pip is at the latest version.
- Check outdated packages: Lists outdated packages using pip list --outdated.
- Check dependency conflicts: Uses pip check to identify dependency issues.
- Upgrade packages: Upgrades packages, skipping blacklisted ones and respecting specific version constraints.
- Handle dependency issues: Detects and suggests adding problematic packages to the blacklist.
- Summary report: Displays and logs a detailed report of successful, failed, and skipped upgrades.
Run the virtual environment management script to access the interactive menu:
python py_env_manager.pyThis will display a menu with the following options:
- Create a new virtual environment
- Activate a virtual environment
- Deactivate the active virtual environment
- Generate/Update requirements.txt file
- Install dependencies from requirements.txt
- Install dependencies from one environment to another
- Delete a virtual environment (also removes associated bat file)
- List virtual environments
- Exit
To create batch file aliases for quick activation of your environments:
python create_venv_alias.pyThis will create .bat files in the bat directory that you can use to quickly activate environments by simply running the batch file.
Example:
.\bat\activate_myenv.bat🔍 Checking for outdated packages...
📦 Found 5 outdated packages.
⬆️ Upgrading pip...
✅ pip upgraded to the latest version.
🔄 Updating: numpy (1/5)
✅ Successfully upgraded numpy
...
✅ Upgrade process completed!
- If a package upgrade fails, the error message is logged.
- If dependency conflicts are detected, the user is prompted with options to resolve them.
- If the
package_config.jsonfile is missing, a default one is created. - If logs cannot be written due to permission errors, the script provides troubleshooting suggestions.
This project is open-source under the MIT License.