This project is part of the 42 School Common Core and focuses on
real-world Python development practices used in data engineering.
Building on previous modules, this project introduces essential tools for
environment isolation, dependency management, and configuration handling.
The goal of this module is to understand and apply:
- virtual environments (
venv) - dependency management (
pipvsPoetry) - external libraries (pandas, numpy, matplotlib, requests)
- dynamic imports and dependency checks
- environment variables and
.envconfiguration - secure handling of sensitive data
- real-world project structure
Each exercise simulates a real-world scenario, resulting in a
basic but complete data pipeline system.
-
π§± Exercise 0 - Entering the Matrix
Understanding virtual environments and Python runtime isolation -
π¦ Exercise 1 - Loading Programs
Managing dependencies and building a basic data analysis pipeline -
π Exercise 2 - Accessing the Mainframe
Secure configuration using environment variables and .env files
ex0/
βββ construct.py
ex1/
βββ loading.py
βββ requirements.txt
βββ pyproject.toml
ex2/
βββ oracle.py
βββ .env.example
βββ .gitignore
Introduces virtual environments.
- Detects if running inside a virtual environment
- Displays Python environment information
- Shows differences between global and isolated environments
- Provides instructions to create a
venv
Concepts: environment isolation, system paths, Python runtime
π Based on detecting VIRTUAL_ENV and system paths :contentReference[oaicite:0]{index=0}
Focuses on dependency management and data processing.
- Checks installed dependencies dynamically
- Supports both
pipandPoetry - Uses:
numpyβ data generationpandasβ data manipulationmatplotlibβ visualizationrequests(optional)
- Generates a dataset and saves a graph (
matrix_analysis.png)
Concepts: package management, dynamic imports, data pipelines
π Dependency checking implemented via importlib
π Requirements defined in requirements.txt
Introduces environment configuration and security.
- Loads variables from
.env - Uses
python-dotenv - Handles:
MATRIX_MODEDATABASE_URLAPI_KEYLOG_LEVELZION_ENDPOINT
- Demonstrates dev vs production behavior
- Ensures secrets are not hardcoded
Concepts: environment variables, secure config, system design
π Configuration loading handled safely with fallback and validation
- Virtual environments isolate your projects from global Python
- Dependency management is critical in real-world applications
pipandPoetrysolve the same problem differently- External libraries must be handled safely (missing deps, versions)
.envfiles prevent exposing sensitive data- Environment variables override local configuration
- Clean configuration = secure and scalable systems
- Never commit
.envfiles - use.gitignore(this project includes a .env.example for practice purposes only) - Always validate required environment variables
- Avoid hardcoding secrets in your code
- Provide fallback behavior for missing dependencies
- Separate development and production configurations
- Written for Python 3.10+
- Uses type hints and follows flake8
- Designed to work with and without dependencies installed
- Handles errors gracefully (missing packages / config)
- Focus is on real-world practices, not algorithm complexity
- Outputs match the subject expectations