# ๐ Requirement Loader
[](https://python.org)
[](https://pypi.org/project/requirement-loader/)
[](LICENSE)
[](https://github.com/Ivole32/requirement-loader/issues)
**Automatically fetch and install Python dependencies from remote sources for enhanced security and deployment flexibility.**
When working on production servers, there's always a risk that zero-day vulnerabilities may be discovered in packages listed in your `requirements.txt` file. With Requirement Loader, you can update your requirements file hosted online (e.g., on GitHub) or local, and it will automatically download and install the updated dependencies. The system can either restart your application immediately or defer updates until the next scheduled restart.
## โจ Key Features
- ๐ **Automatic Updates**: Continuously monitor and install dependency updates from remote sources
- ๐ **Multiple Sources**: Support for GitHub, HTTPS/HTTP URLs, and local files
- ๐ **Security Focused**: Quickly patch zero-day vulnerabilities by updating remote requirements
- โก **Auto Restart**: Automatically restart applications after dependency updates
- ๐ **Silent Mode**: Install packages without verbose output for clean logs
- โ๏ธ **Configurable**: Customize update intervals, restart behavior, and more
- ๐ **Python 3.11+**: Modern Python support with type hints
## ๐ Quick Start
### Installation
```bash
pip install requirement-loader
```
### Basic Usage
```python
from requirement_loader import RequirementLoader
# Automatically manage dependencies from GitHub
loader = RequirementLoader(
requirement_url="https://github.com/yourusername/yourproject/blob/main/requirements.txt",
update_at_startup=True,
auto_reload=True,
sleep_time=300 # Check every 5 minutes
)
# Your application code here
print("Application running with automatic dependency management!")
```
### Advanced Configuration
```python
from requirement_loader import RequirementLoader
# Production setup with custom configuration
loader = RequirementLoader(
requirement_url="https://your-server.com/secure/requirements.txt",
requirement_temp_file="secure_temp_reqs.txt", # Custom temporary file
update_at_startup=True, # Install dependencies on startup
silent_mode=True, # Quiet installation(s)
sleep_time=600, # Check every 10 minutes
auto_reload=True # Auto-restart on updates
)
```
## ๐ Documentation
For comprehensive documentation, examples, and best practices, visit our [Wiki](https://github.com/Ivole32/requirement-loader/wiki/home):
- **[Installation Guide](https://github.com/Ivole32/requirement-loader/wiki/installation)** - Detailed installation instructions and setup
- **[Usage Guide](https://github.com/Ivole32/requirement-loader/wiki/usage)** - Complete usage examples and configuration options
- **[Home](https://github.com/Ivole32/requirement-loader/wiki/home)** - Overview and getting started
## ๐ก๏ธ Use Cases
### Production Security
Quickly patch zero-day vulnerabilities by updating your remote requirements file. No need to redeploy - just update the file and let Requirement Loader handle the rest.
```python
# Update requirements.txt on GitHub when a vulnerability is discovered
# Requirement Loader will automatically detect and install the fix
loader = RequirementLoader("https://github.com/company/configs/blob/main/prod-requirements.txt")
```
### Centralized Dependency Management
Manage dependencies across multiple deployments from a single source.
```python
# All your services can use the same requirements source
loader = RequirementLoader("https://internal-repo.company.com/shared-requirements.txt")
```
### Automated Deployments
Ensure all instances have the latest approved dependencies without manual intervention.
```python
# Staging environment with frequent updates
loader = RequirementLoader(
requirement_url="https://github.com/company/project/blob/staging/requirements.txt",
sleep_time=60 # Check every minute
)
```
### Authentication & Private Repositories
Access private requirements files using custom sessions in manual updates:
```python
import requests
from requirement_loader import RequirementLoader
# Setup loader for private repository (will fail without auth)
loader = RequirementLoader(
requirement_url="https://github.com/private-org/private-repo/blob/main/requirements.txt",
auto_reload=False # Use manual updates for authentication
)
# Create authenticated session
session = requests.Session()
session.headers.update({
'Authorization': 'token ghp_your_github_token',
'Accept': 'application/vnd.github.v3.raw'
})
# Update with authentication
loader.update(reload=True, request_session=session)
# Different auth methods for different updates
basic_auth_session = requests.Session()
basic_auth_session.auth = ('username', 'password')
loader.update(reload=False, request_session=basic_auth_session)
```
### Manual Updates
For scenarios where you need full control over when updates occur, disable automatic updates and trigger them manually:
```python
from requirement_loader import RequirementLoader
# Disable automatic updates for manual control
loader = RequirementLoader(
requirement_url="https://github.com/company/project/blob/main/requirements.txt",
update_at_startup=False, # Don't update on startup
auto_reload=False # Disable background updates
)
# Manually trigger updates when needed
loader.update(reload=True) # Update and restart application
loader.update(reload=False) # Update without restarting
# Custom authentication for specific updates
import requests
auth_session = requests.Session()
auth_session.headers.update({'Authorization': 'Bearer your-token'})
auth_session.proxies = {'https': 'proxy.company.com:8080'}
# Use custom session for this specific update
loader.update(reload=False, request_session=auth_session)
```
**Note**: When `auto_reload=False`, you have full control over when updates occur and whether to restart the application.
## ๐ง Supported URL Types
| Type | Example | Description |
|------|---------|-------------|
| **GitHub** | `https://github.com/user/repo/blob/main/requirements.txt` | Automatically converts to raw URL |
| **Raw GitHub** | `https://raw.githubusercontent.com/user/repo/main/requirements.txt` | Direct raw file access |
| **HTTPS** | `https://example.com/requirements.txt` | Any HTTPS URL |
| **HTTP** | `http://internal-server.com/requirements.txt` | HTTP URLs (use with caution) |
| **Local File** | `file:///path/to/requirements.txt` | Local file system |
## โ๏ธ Configuration Options
### Constructor Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `requirement_url` | `str` | `"requirements.txt"` | URL or path to requirements file |
| `requirement_temp_file` | `str` | `"requirements_temp.txt"` | Local temporary file path for downloaded requirements |
| `update_at_startup` | `bool` | `True` | Download and install requirements on initialization |
| `silent_mode` | `bool` | `True` | Install packages without verbose output |
| `sleep_time` | `int` | `5` | Seconds between update checks |
| `auto_reload` | `bool` | `True` | Enable automatic update checking and restart |
### Manual Update Method
```python
loader.update(reload=True) # Update and restart
loader.update(reload=False) # Update without restart
# With custom session for authentication
import requests
session = requests.Session()
session.auth = ('username', 'password')
loader.update(reload=False, request_session=session)
```
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `reload` | `bool` | `False` | Whether to restart the application after update |
| `request_session` | `requests.Session` | `None` | Custom session for authentication/proxies (optional) |
**Important**: Manual updates are only possible when `auto_reload=False` to prevent conflicts with automatic updates.
## ๐ Temporary File Management
Requirement Loader uses a temporary file to store downloaded requirements before installation. This allows for better control and error handling during the update process.
### Default Behavior
By default, downloaded requirements are saved to `requirements_temp.txt` in your current working directory:
```python
# Uses default temporary file 'requirements_temp.txt'
loader = RequirementLoader(
requirement_url="https://github.com/user/repo/blob/main/requirements.txt"
)
```
### Custom Temporary File Location
You can specify a custom location for the temporary requirements file:
```python
# Custom temporary file location
loader = RequirementLoader(
requirement_url="https://github.com/user/repo/blob/main/requirements.txt",
requirement_temp_file="./temp/my_requirements.txt" # Custom path
)
```
### Use Cases for Custom Temp Files
```python
# Different environments with separate temp files
if os.environ.get('ENVIRONMENT') == 'production':
temp_file = "/var/tmp/prod_requirements.txt"
elif os.environ.get('ENVIRONMENT') == 'staging':
temp_file = "/tmp/staging_requirements.txt"
else:
temp_file = "dev_requirements_temp.txt"
loader = RequirementLoader(
requirement_url="https://github.com/company/configs/blob/main/requirements.txt",
requirement_temp_file=temp_file
)
```
### Security Considerations
- **Temporary files** contain your requirements and should be treated securely
- **File permissions** should be restricted to prevent unauthorized access
- **Cleanup** - temp files are overwritten on each update but not automatically deleted
- **Path traversal** - validate temp file paths to prevent directory traversal attacks
```python
import os
# Secure temporary file handling
def get_secure_temp_path(filename):
"""Ensure temp file is in a secure location"""
temp_dir = "/secure/temp/path"
if not os.path.exists(temp_dir):
os.makedirs(temp_dir, mode=0o700) # Restricted permissions
return os.path.join(temp_dir, filename)
loader = RequirementLoader(
requirement_url="https://private-repo.com/requirements.txt",
requirement_temp_file=get_secure_temp_path("requirements.txt")
)
```
## ๐จ Error Handling
Requirement Loader defines specific exception types for different error scenarios:
### Exception Types
- **`ArgumentConflict`**: Raised when trying to manually update while `auto_reload=True`
- **`RestrictedArgumentError`**: Raised when attempting to use internal-only parameters
### Error Handling Examples
```python
from requirement_loader import RequirementLoader, ArgumentConflict, RestrictedArgumentError
try:
# This will work - auto_reload disabled for manual control
loader = RequirementLoader(
requirement_url="https://github.com/user/repo/blob/main/requirements.txt",
auto_reload=False # Disable automatic updates
)
# Manual update - this works
loader.update(reload=True)
except ArgumentConflict as e:
print(f"Configuration conflict: {e}")
# This happens when trying manual updates with auto_reload=True
except RestrictedArgumentError as e:
print(f"Restricted argument usage: {e}")
# This happens when trying to use internal-only parameters
except Exception as e:
print(f"Unexpected error: {e}")
# Example of what causes ArgumentConflict:
try:
loader_auto = RequirementLoader(auto_reload=True)
loader_auto.update() # This will raise ArgumentConflict when auto_reload=True
except ArgumentConflict as e:
print("Can't manually update when auto_reload is enabled!")
# Example of what causes RestrictedArgumentError:
# Note: This would only happen if you try to access internal parameters
# The public API (loader.update(reload=True/False)) doesn't expose these
try:
loader = RequirementLoader(auto_reload=False)
# Don't try to use undocumented parameters - they're internal only
# loader.update(reload=True, manual_update=False) # This would cause RestrictedArgumentError
except RestrictedArgumentError as e:
print("Attempted to use internal-only parameter!")
```
## ๐ณ Docker Example
```dockerfile
FROM python:3.11-slim
# Install requirement-loader
RUN pip install requirement-loader
# You can use it in your code now
```
## ๐ Security Considerations
- **Use HTTPS URLs** for secure transmission
- **Verify source authenticity** - only use trusted requirement sources
- **Monitor remote files** for unauthorized changes
- **Test updates** in staging before production
- **Implement access controls** on your requirements repositories
## ๐งช Testing
Run the included tests:
```bash
# Clone the repository
git clone https://github.com/Ivole32/requirement-loader.git
cd requirement-loader
# Install development dependencies
pip install -e .
# Run tests
python -m pytest tests/
```
## ๐ค Contributing
We welcome contributions! Here's how you can help:
1. **Fork** the repository
2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
3. **Commit** your changes (`git commit -m 'Add amazing feature'`)
4. **Push** to the branch (`git push origin feature/amazing-feature`)
5. **Open** a Pull Request
### Development Setup
```bash
# Clone your fork
git clone https://github.com/yourusername/requirement-loader.git
cd requirement-loader
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
```
## ๐ Requirements
- **Python 3.11+**
- **requests >= 2.25.0**
## ๐ Changelog
### v1.0.0 (Current)
- Initial stable release
- Support for GitHub, HTTPS, HTTP, and local file URLs
- Automatic application restart functionality
- Configurable update intervals
- Silent and verbose installation modes
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Support
- **Issues**: [GitHub Issues](https://github.com/Ivole32/requirement-loader/issues)
- **Email**: ivo.theis@posteo.de
- **Documentation**: [Wiki](https://github.com/Ivole32/requirement-loader/wiki/home)
## ๐ Acknowledgments
- Thanks to all contributors who help make this project better
- Inspired by the need for better dependency management in production environments
- Built with โค๏ธ for the Python community
---
**โญ Star this repository if you find it useful!**
Raw data
{
"_id": null,
"home_page": null,
"name": "requirement-loader",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "requirements, dependencies, security, automation, package-management",
"author": null,
"author_email": "Ivole32 <ivo.theis@posteo.de>",
"download_url": "https://files.pythonhosted.org/packages/af/be/ca69ddf4cb663a240ba4f96bf2f8dfdf8009e3f8c6a4da348b36941a12dd/requirement_loader-1.0.0.tar.gz",
"platform": null,
"description": "# \ud83d\ude80 Requirement Loader\r\n\r\n[](https://python.org)\r\n[](https://pypi.org/project/requirement-loader/)\r\n[](LICENSE)\r\n[](https://github.com/Ivole32/requirement-loader/issues)\r\n\r\n**Automatically fetch and install Python dependencies from remote sources for enhanced security and deployment flexibility.**\r\n\r\nWhen working on production servers, there's always a risk that zero-day vulnerabilities may be discovered in packages listed in your `requirements.txt` file. With Requirement Loader, you can update your requirements file hosted online (e.g., on GitHub) or local, and it will automatically download and install the updated dependencies. The system can either restart your application immediately or defer updates until the next scheduled restart.\r\n\r\n## \u2728 Key Features\r\n\r\n- \ud83d\udd04 **Automatic Updates**: Continuously monitor and install dependency updates from remote sources\r\n- \ud83c\udf10 **Multiple Sources**: Support for GitHub, HTTPS/HTTP URLs, and local files\r\n- \ud83d\udd12 **Security Focused**: Quickly patch zero-day vulnerabilities by updating remote requirements\r\n- \u26a1 **Auto Restart**: Automatically restart applications after dependency updates\r\n- \ud83d\udd07 **Silent Mode**: Install packages without verbose output for clean logs\r\n- \u2699\ufe0f **Configurable**: Customize update intervals, restart behavior, and more\r\n- \ud83d\udc0d **Python 3.11+**: Modern Python support with type hints\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### Installation\r\n\r\n```bash\r\npip install requirement-loader\r\n```\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom requirement_loader import RequirementLoader\r\n\r\n# Automatically manage dependencies from GitHub\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/yourusername/yourproject/blob/main/requirements.txt\",\r\n update_at_startup=True,\r\n auto_reload=True,\r\n sleep_time=300 # Check every 5 minutes\r\n)\r\n\r\n# Your application code here\r\nprint(\"Application running with automatic dependency management!\")\r\n```\r\n\r\n### Advanced Configuration\r\n\r\n```python\r\nfrom requirement_loader import RequirementLoader\r\n\r\n# Production setup with custom configuration\r\nloader = RequirementLoader(\r\n requirement_url=\"https://your-server.com/secure/requirements.txt\",\r\n requirement_temp_file=\"secure_temp_reqs.txt\", # Custom temporary file\r\n update_at_startup=True, # Install dependencies on startup\r\n silent_mode=True, # Quiet installation(s)\r\n sleep_time=600, # Check every 10 minutes\r\n auto_reload=True # Auto-restart on updates\r\n)\r\n```\r\n\r\n## \ud83d\udcd6 Documentation\r\n\r\nFor comprehensive documentation, examples, and best practices, visit our [Wiki](https://github.com/Ivole32/requirement-loader/wiki/home):\r\n\r\n- **[Installation Guide](https://github.com/Ivole32/requirement-loader/wiki/installation)** - Detailed installation instructions and setup\r\n- **[Usage Guide](https://github.com/Ivole32/requirement-loader/wiki/usage)** - Complete usage examples and configuration options\r\n- **[Home](https://github.com/Ivole32/requirement-loader/wiki/home)** - Overview and getting started\r\n\r\n## \ud83d\udee1\ufe0f Use Cases\r\n\r\n### Production Security\r\nQuickly patch zero-day vulnerabilities by updating your remote requirements file. No need to redeploy - just update the file and let Requirement Loader handle the rest.\r\n\r\n```python\r\n# Update requirements.txt on GitHub when a vulnerability is discovered\r\n# Requirement Loader will automatically detect and install the fix\r\nloader = RequirementLoader(\"https://github.com/company/configs/blob/main/prod-requirements.txt\")\r\n```\r\n\r\n### Centralized Dependency Management\r\nManage dependencies across multiple deployments from a single source.\r\n\r\n```python\r\n# All your services can use the same requirements source\r\nloader = RequirementLoader(\"https://internal-repo.company.com/shared-requirements.txt\")\r\n```\r\n\r\n### Automated Deployments\r\nEnsure all instances have the latest approved dependencies without manual intervention.\r\n\r\n```python\r\n# Staging environment with frequent updates\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/company/project/blob/staging/requirements.txt\",\r\n sleep_time=60 # Check every minute\r\n)\r\n```\r\n\r\n### Authentication & Private Repositories\r\nAccess private requirements files using custom sessions in manual updates:\r\n\r\n```python\r\nimport requests\r\nfrom requirement_loader import RequirementLoader\r\n\r\n# Setup loader for private repository (will fail without auth)\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/private-org/private-repo/blob/main/requirements.txt\",\r\n auto_reload=False # Use manual updates for authentication\r\n)\r\n\r\n# Create authenticated session\r\nsession = requests.Session()\r\nsession.headers.update({\r\n 'Authorization': 'token ghp_your_github_token',\r\n 'Accept': 'application/vnd.github.v3.raw'\r\n})\r\n\r\n# Update with authentication\r\nloader.update(reload=True, request_session=session)\r\n\r\n# Different auth methods for different updates\r\nbasic_auth_session = requests.Session()\r\nbasic_auth_session.auth = ('username', 'password')\r\nloader.update(reload=False, request_session=basic_auth_session)\r\n```\r\n\r\n### Manual Updates\r\nFor scenarios where you need full control over when updates occur, disable automatic updates and trigger them manually:\r\n\r\n```python\r\nfrom requirement_loader import RequirementLoader\r\n\r\n# Disable automatic updates for manual control\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/company/project/blob/main/requirements.txt\",\r\n update_at_startup=False, # Don't update on startup\r\n auto_reload=False # Disable background updates\r\n)\r\n\r\n# Manually trigger updates when needed\r\nloader.update(reload=True) # Update and restart application\r\nloader.update(reload=False) # Update without restarting\r\n\r\n# Custom authentication for specific updates\r\nimport requests\r\nauth_session = requests.Session()\r\nauth_session.headers.update({'Authorization': 'Bearer your-token'})\r\nauth_session.proxies = {'https': 'proxy.company.com:8080'}\r\n\r\n# Use custom session for this specific update\r\nloader.update(reload=False, request_session=auth_session)\r\n```\r\n\r\n**Note**: When `auto_reload=False`, you have full control over when updates occur and whether to restart the application.\r\n\r\n## \ud83d\udd27 Supported URL Types\r\n\r\n| Type | Example | Description |\r\n|------|---------|-------------|\r\n| **GitHub** | `https://github.com/user/repo/blob/main/requirements.txt` | Automatically converts to raw URL |\r\n| **Raw GitHub** | `https://raw.githubusercontent.com/user/repo/main/requirements.txt` | Direct raw file access |\r\n| **HTTPS** | `https://example.com/requirements.txt` | Any HTTPS URL |\r\n| **HTTP** | `http://internal-server.com/requirements.txt` | HTTP URLs (use with caution) |\r\n| **Local File** | `file:///path/to/requirements.txt` | Local file system |\r\n\r\n## \u2699\ufe0f Configuration Options\r\n\r\n### Constructor Parameters\r\n\r\n| Parameter | Type | Default | Description |\r\n|-----------|------|---------|-------------|\r\n| `requirement_url` | `str` | `\"requirements.txt\"` | URL or path to requirements file |\r\n| `requirement_temp_file` | `str` | `\"requirements_temp.txt\"` | Local temporary file path for downloaded requirements |\r\n| `update_at_startup` | `bool` | `True` | Download and install requirements on initialization |\r\n| `silent_mode` | `bool` | `True` | Install packages without verbose output |\r\n| `sleep_time` | `int` | `5` | Seconds between update checks |\r\n| `auto_reload` | `bool` | `True` | Enable automatic update checking and restart |\r\n\r\n### Manual Update Method\r\n\r\n```python\r\nloader.update(reload=True) # Update and restart\r\nloader.update(reload=False) # Update without restart\r\n\r\n# With custom session for authentication\r\nimport requests\r\nsession = requests.Session()\r\nsession.auth = ('username', 'password')\r\nloader.update(reload=False, request_session=session)\r\n```\r\n\r\n| Parameter | Type | Default | Description |\r\n|-----------|------|---------|-------------|\r\n| `reload` | `bool` | `False` | Whether to restart the application after update |\r\n| `request_session` | `requests.Session` | `None` | Custom session for authentication/proxies (optional) |\r\n\r\n**Important**: Manual updates are only possible when `auto_reload=False` to prevent conflicts with automatic updates.\r\n\r\n## \ud83d\udcc1 Temporary File Management\r\n\r\nRequirement Loader uses a temporary file to store downloaded requirements before installation. This allows for better control and error handling during the update process.\r\n\r\n### Default Behavior\r\n\r\nBy default, downloaded requirements are saved to `requirements_temp.txt` in your current working directory:\r\n\r\n```python\r\n# Uses default temporary file 'requirements_temp.txt'\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/user/repo/blob/main/requirements.txt\"\r\n)\r\n```\r\n\r\n### Custom Temporary File Location\r\n\r\nYou can specify a custom location for the temporary requirements file:\r\n\r\n```python\r\n# Custom temporary file location\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/user/repo/blob/main/requirements.txt\",\r\n requirement_temp_file=\"./temp/my_requirements.txt\" # Custom path\r\n)\r\n```\r\n\r\n### Use Cases for Custom Temp Files\r\n\r\n```python\r\n# Different environments with separate temp files\r\nif os.environ.get('ENVIRONMENT') == 'production':\r\n temp_file = \"/var/tmp/prod_requirements.txt\"\r\nelif os.environ.get('ENVIRONMENT') == 'staging':\r\n temp_file = \"/tmp/staging_requirements.txt\"\r\nelse:\r\n temp_file = \"dev_requirements_temp.txt\"\r\n\r\nloader = RequirementLoader(\r\n requirement_url=\"https://github.com/company/configs/blob/main/requirements.txt\",\r\n requirement_temp_file=temp_file\r\n)\r\n```\r\n\r\n### Security Considerations\r\n\r\n- **Temporary files** contain your requirements and should be treated securely\r\n- **File permissions** should be restricted to prevent unauthorized access\r\n- **Cleanup** - temp files are overwritten on each update but not automatically deleted\r\n- **Path traversal** - validate temp file paths to prevent directory traversal attacks\r\n\r\n```python\r\nimport os\r\n\r\n# Secure temporary file handling\r\ndef get_secure_temp_path(filename):\r\n \"\"\"Ensure temp file is in a secure location\"\"\"\r\n temp_dir = \"/secure/temp/path\"\r\n if not os.path.exists(temp_dir):\r\n os.makedirs(temp_dir, mode=0o700) # Restricted permissions\r\n return os.path.join(temp_dir, filename)\r\n\r\nloader = RequirementLoader(\r\n requirement_url=\"https://private-repo.com/requirements.txt\",\r\n requirement_temp_file=get_secure_temp_path(\"requirements.txt\")\r\n)\r\n```\r\n\r\n## \ud83d\udea8 Error Handling\r\n\r\nRequirement Loader defines specific exception types for different error scenarios:\r\n\r\n### Exception Types\r\n- **`ArgumentConflict`**: Raised when trying to manually update while `auto_reload=True`\r\n- **`RestrictedArgumentError`**: Raised when attempting to use internal-only parameters\r\n\r\n### Error Handling Examples\r\n\r\n```python\r\nfrom requirement_loader import RequirementLoader, ArgumentConflict, RestrictedArgumentError\r\n\r\ntry:\r\n # This will work - auto_reload disabled for manual control\r\n loader = RequirementLoader(\r\n requirement_url=\"https://github.com/user/repo/blob/main/requirements.txt\",\r\n auto_reload=False # Disable automatic updates\r\n )\r\n \r\n # Manual update - this works\r\n loader.update(reload=True)\r\n \r\nexcept ArgumentConflict as e:\r\n print(f\"Configuration conflict: {e}\")\r\n # This happens when trying manual updates with auto_reload=True\r\n \r\nexcept RestrictedArgumentError as e:\r\n print(f\"Restricted argument usage: {e}\")\r\n # This happens when trying to use internal-only parameters\r\n \r\nexcept Exception as e:\r\n print(f\"Unexpected error: {e}\")\r\n\r\n# Example of what causes ArgumentConflict:\r\ntry:\r\n loader_auto = RequirementLoader(auto_reload=True)\r\n loader_auto.update() # This will raise ArgumentConflict when auto_reload=True\r\nexcept ArgumentConflict as e:\r\n print(\"Can't manually update when auto_reload is enabled!\")\r\n\r\n# Example of what causes RestrictedArgumentError:\r\n# Note: This would only happen if you try to access internal parameters\r\n# The public API (loader.update(reload=True/False)) doesn't expose these\r\ntry:\r\n loader = RequirementLoader(auto_reload=False)\r\n # Don't try to use undocumented parameters - they're internal only\r\n # loader.update(reload=True, manual_update=False) # This would cause RestrictedArgumentError\r\nexcept RestrictedArgumentError as e:\r\n print(\"Attempted to use internal-only parameter!\")\r\n```\r\n\r\n## \ud83d\udc33 Docker Example\r\n\r\n```dockerfile\r\nFROM python:3.11-slim\r\n\r\n# Install requirement-loader\r\nRUN pip install requirement-loader\r\n\r\n# You can use it in your code now\r\n```\r\n\r\n## \ud83d\udd12 Security Considerations\r\n\r\n- **Use HTTPS URLs** for secure transmission\r\n- **Verify source authenticity** - only use trusted requirement sources\r\n- **Monitor remote files** for unauthorized changes\r\n- **Test updates** in staging before production\r\n- **Implement access controls** on your requirements repositories\r\n\r\n## \ud83e\uddea Testing\r\n\r\nRun the included tests:\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/Ivole32/requirement-loader.git\r\ncd requirement-loader\r\n\r\n# Install development dependencies\r\npip install -e .\r\n\r\n# Run tests\r\npython -m pytest tests/\r\n```\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nWe welcome contributions! Here's how you can help:\r\n\r\n1. **Fork** the repository\r\n2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)\r\n3. **Commit** your changes (`git commit -m 'Add amazing feature'`)\r\n4. **Push** to the branch (`git push origin feature/amazing-feature`)\r\n5. **Open** a Pull Request\r\n\r\n### Development Setup\r\n\r\n```bash\r\n# Clone your fork\r\ngit clone https://github.com/yourusername/requirement-loader.git\r\ncd requirement-loader\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\r\n\r\n# Install in development mode\r\npip install -e .\r\n```\r\n\r\n## \ud83d\udccb Requirements\r\n\r\n- **Python 3.11+**\r\n- **requests >= 2.25.0**\r\n\r\n## \ud83d\udcdd Changelog\r\n\r\n### v1.0.0 (Current)\r\n- Initial stable release\r\n- Support for GitHub, HTTPS, HTTP, and local file URLs\r\n- Automatic application restart functionality\r\n- Configurable update intervals\r\n- Silent and verbose installation modes\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83c\udd98 Support\r\n\r\n- **Issues**: [GitHub Issues](https://github.com/Ivole32/requirement-loader/issues)\r\n- **Email**: ivo.theis@posteo.de\r\n- **Documentation**: [Wiki](https://github.com/Ivole32/requirement-loader/wiki/home)\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\n- Thanks to all contributors who help make this project better\r\n- Inspired by the need for better dependency management in production environments\r\n- Built with \u2764\ufe0f for the Python community\r\n\r\n---\r\n\r\n**\u2b50 Star this repository if you find it useful!**\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Automatically fetch and install Python dependencies from a remote server.",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/Ivole32/requirement-loader",
"Issues": "https://github.com/Ivole32/requirement-loader/issues",
"Repository": "https://github.com/Ivole32/requirement-loader"
},
"split_keywords": [
"requirements",
" dependencies",
" security",
" automation",
" package-management"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "31f034890f601407e814b6225d81bd981d61499200173faed8c5963227bcccae",
"md5": "c2f677658f01134b5e1323a2fe6541cc",
"sha256": "5d37cfa3bd5ff342bd7835138b01940ae5505a83a5f9a3cee1c5172cfb8d3b99"
},
"downloads": -1,
"filename": "requirement_loader-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c2f677658f01134b5e1323a2fe6541cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 8557,
"upload_time": "2025-08-03T01:33:00",
"upload_time_iso_8601": "2025-08-03T01:33:00.525520Z",
"url": "https://files.pythonhosted.org/packages/31/f0/34890f601407e814b6225d81bd981d61499200173faed8c5963227bcccae/requirement_loader-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "afbeca69ddf4cb663a240ba4f96bf2f8dfdf8009e3f8c6a4da348b36941a12dd",
"md5": "e6b1dab33b45d3e134bf17b707ff873e",
"sha256": "236a78ba76754ca4eae816051d9cdc92978b6bf693d1ef570d3ebfed307591fb"
},
"downloads": -1,
"filename": "requirement_loader-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "e6b1dab33b45d3e134bf17b707ff873e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 9114,
"upload_time": "2025-08-03T01:33:03",
"upload_time_iso_8601": "2025-08-03T01:33:03.366481Z",
"url": "https://files.pythonhosted.org/packages/af/be/ca69ddf4cb663a240ba4f96bf2f8dfdf8009e3f8c6a4da348b36941a12dd/requirement_loader-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-03 01:33:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Ivole32",
"github_project": "requirement-loader",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "requirement-loader"
}