๐ A complete offline and air-gapped Python development environment in VSCode DevContainers with pre-installed packages and Oracle DB support.
๐ Table of Contents
- โจ Features
- ๐ฏ Why This Project
- ๐ Prerequisites
- โก Quick Start
- ๐ง Installation
- ๐ป Usage
- โ๏ธ Configuration
- ๐ Security
- ๐ Changelog
- ๐ Troubleshooting
- ๐ค Contributing
- ๐ License
โจ Features
- ๐ Offline-First: Complete air-gapped development environment
- ๐ณ Container-Based: Isolated development with Podman/Docker support
- ๐ Python 3.13: Latest Python version with runtime image foundation
- ๐๏ธ Oracle Database: Built-in Oracle Instant Client from runtime image
- ๐ VSCode Integration: Seamless development experience
- ๐งช Testing Ready: Pre-configured pytest environment
- ๐๏ธ Runtime Image Base: Built on
ghcr.io/opentechil/offline-python-runtime-docker:v1.1.0-release.0 - ๐ฆ Runtime Wheelhouse: Package management handled at runtime for compatibility
- ๐ง Customizable: Easy to extend with additional packages
- ๐ก๏ธ Security-Focused: Non-root user execution
๐ฏ Why This Project
Traditional development environments require constant internet connectivity for package installation, updates, and VSCode extensions. This becomes problematic in:
- ๐ข Corporate environments with strict network policies
- ๐ญ Industrial settings with air-gapped systems
- ๐๏ธ Remote locations with limited connectivity
- ๐ High-security environments requiring isolation
This project provides a complete, self-contained development environment that works entirely offline, ensuring consistent development experiences across any infrastructure.
๐ Prerequisites
Required Software
- Podman (recommended) or Docker
- VSCode with Dev Containers extension
- Git for cloning the repository
System Requirements
- RAM: 2GB minimum, 4GB recommended
- Storage: 5GB available space
- OS: Linux, macOS, or Windows with WSL2
๐ก Note: This project uses Podman as the primary container runtime, but all commands work with Docker as well.
โก Quick Start
One-Command Setup
git clone https://github.com/OpenTechIL/offline-python-vscode-devcontainer.git cd offline-python-vscode-devcontainer podman build . -t offline-python-vscode-devcontainer:dev-latest-local
VSCode Integration
- Open the project in VSCode
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Select "Dev Containers: Reopen in Container"
- Start coding! ๐
๐ง Installation
Step 1: Clone Repository
git clone https://github.com/OpenTechIL/offline-python-vscode-devcontainer.git
cd offline-python-vscode-devcontainerStep 2: Configure VSCode (Host Side)
Press Ctrl+Shift+P and search for "Open User Settings (JSON)":
{
"dev.containers.dockerPath": "podman",
"dev.containers.dockerComposePath": "podman-compose",
"dev.containers.mountWaylandSocket": false,
"remote.downloadExtensionsLocally": true,
"remote.autoInstallAdditionalExtensions": false,
"dev.containers.copyGitConfig": false
}Step 3: Build Container Image
podman build . -t offline-python-vscode-devcontainer:dev-latest-localStep 4: Configure DevContainer
Create or update .devcontainer/devcontainer.json:
{
"name": "Python Airgapped (Podman)",
"image": "offline-python-vscode-devcontainer:dev-latest-local",
"runArgs": [
"--userns=keep-id",
"--security-opt", "label=disable"
],
"remoteUser": "vscode",
"remoteEnv": {
"PODMAN_USERNS": "keep-id"
},
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"extensions.ignoreRecommendations": true,
"extensions.autoUpdate": false,
"extensions.autoCheckUpdates": false
}
}
},
"updateRemoteUserUID": true,
"overrideCommand": false
}๐ป Usage
Basic Python Execution
# Create a test file echo "print('Hello from offline container!')" > test.py # Run in container podman run \ -v ./test.py:/home/vscode/test.py:Z \ -it offline-python-vscode-devcontainer:dev-latest-local \ python /home/vscode/test.py
Development Workflow
# Create project directory mkdir -p ./my-python-project cd ./my-python-project # Create Python file cat > main.py << 'EOF' import pandas as pd import oracledb print("๐ Python environment ready!") print(f"๐ Pandas version: {pd.__version__}") print(f"๐๏ธ Oracle DB available: {oracledb.__version__}") print(f"๐๏ธ Runtime image foundation active") EOF # Run with mounted volume podman run \ -v $(pwd):/home/vscode/project:Z \ -it offline-python-vscode-devcontainer:dev-latest-local \ python /home/vscode/project/main.py
Running Tests
# Run all tests podman run \ -v $(pwd):/home/vscode/project:Z \ -it offline-python-vscode-devcontainer:dev-latest-local \ pytest -v /home/vscode/project/tests/ # Run specific test file podman run \ -v $(pwd):/home/vscode/project:Z \ -it offline-python-vscode-devcontainer:dev-latest-local \ pytest -v /home/vscode/project/tests/test_specific.py
โ๏ธ Configuration
Runtime Image Architecture
This devcontainer is built on top of the offline Python runtime image which provides:
- Oracle Instant Client: Full database connectivity support
- Core Packages: Essential Python packages pre-installed
- Runtime Wheelhouse: Package management handled at runtime for compatibility
๐ฆ Runtime Image Repository: github.com/OpenTechIL/offline-python-runtime-docker - The base runtime image provides the core Python environment, Oracle drivers, and offline package management capabilities.
Adding Python Packages
Since v1.1.0, package management is handled at runtime through the wheelhouse system:
-
For container runtime: Install packages directly in the running container:
# Inside the devcontainer pip install numpy matplotlib seaborn -
For persistent packages: Add to your project's
requirements.txt:numpy matplotlib seaborn # Your application-specific packages -
Runtime wheelhouse access: All packages are installed from the pre-configured wheelhouse for offline compatibility.
Note: Core packages (pandas, cryptography, oracledb, pytest, ipykernel) are provided by the base runtime image and available immediately.
๐ฆ Adding Packages to Offline Environment
โ ๏ธ Important: For packages to be available in offline environments, they must be added to the runtime image itself:
- Runtime Image Repository: github.com/OpenTechIL/offline-python-runtime-docker
- How to Add: Submit a PR or issue to the runtime image repository with your package requirements
- Why: The runtime image contains the pre-built wheelhouse that enables offline package installation
Process for Adding New Offline Packages:
- Check if the package already exists in the runtime image
- If not, open an issue or PR in the runtime image repository
- Once included in a new runtime release, update this devcontainer to use the new version
This ensures your packages are available for true offline deployment without requiring network access.
Custom VSCode Extensions
Update .devcontainer/devcontainer.json:
{
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-toolsai.jupyter",
"ms-vscode.vscode-json"
]
}
}
}๐ Security
Air-Gapped Deployment
# 1. Pull image (online) podman pull ghcr.io/opentechil/offline-python-vscode-devcontainer:latest # 2. Save for offline transfer podman save -o offline-python-devcontainer.tar \ ghcr.io/opentechil/offline-python-vscode-devcontainer:latest # 3. Transfer to air-gapped system # (Use USB, network transfer, etc.) # 4. Load on offline system podman load -i offline-python-devcontainer.tar # 5. Use offline podman run -v ./project:/home/vscode/project:Z \ -it ghcr.io/opentechil/offline-python-vscode-devcontainer:latest \ python /home/vscode/project/app.py
Security Features
- ๐ Non-root execution: All processes run as
vscodeuser - ๐ก๏ธ SELinux compatible: Proper security contexts
- ๐ No network access: Container runs in isolation
- ๐ Minimal attack surface: Only essential packages installed
๐ Changelog
See CHANGELOG.md for detailed version history and feature updates.
๐ Troubleshooting
Common Issues
Space Issues on Linux
Click to expandProblem: Build fails with "no space left on device"
Solution:
# Create temporary directory with more space mkdir -p ~/podman-tmp export TMPDIR=~/podman-tmp # Then rebuild podman build . -t offline-python-vscode-devcontainer:dev-latest-local
Permission Issues
Click to expandProblem: Permission denied errors with mounted volumes
Solution:
# Ensure proper SELinux context
podman run \
-v ./project:/home/vscode/project:Z \
-it offline-python-vscode-devcontainer:dev-latest-local \
python /home/vscode/project/app.pyVSCode Extension Issues
Click to expandProblem: Extensions not installing or working
Solution:
- Check VSCode settings on host
- Ensure
remote.downloadExtensionsLocally: true - Restart VSCode and container
Getting Help
- ๐ Check AGENTS.md for development guidelines
- ๐ Report issues
- ๐ฌ Start a discussion
๐ค Contributing
We welcome contributions! Please read our CONTRIBUTORS.md for detailed guidelines.
Development Workflow
# 1. Create feature branch git flow feature start your-feature # 2. Make changes # ... edit files ... # 3. Test your changes podman build . -t offline-python-vscode-devcontainer:test podman run -it offline-python-vscode-devcontainer:test pytest -v # 4. Commit and push git add . git commit -m "feat: add your feature" git push origin feature/your-feature # 5. Create Pull Request
Code Style
- Follow Dockerfile best practices
- Use multi-stage builds
- Keep images small and secure
- Test thoroughly before submitting
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Microsoft Dev Containers for the base images
- Podman for container runtime
- Python Software Foundation for Python
- All contributors who make this project better
Made with โค๏ธ for offline Python development