Create project and venv
Create a project folder and initialize a virtual environment.
mkdir myapp && cd myapp && python -m venv .venvA common project-start sequence.
Project-level setup patterns for Python virtual environments, pyproject.toml, editable installs, dev tools, and team onboarding.
Create a local environment and prepare a project for work.
Create a project folder and initialize a virtual environment.
mkdir myapp && cd myapp && python -m venv .venvA common project-start sequence.
Add the environment directory to .gitignore.
.venv/
venv/
__pycache__/
*.pyc
You normally commit dependency files, not the environment directory itself.
Install formatter, linter, and test tooling in the venv.
python -m pip install black ruff pytestA typical local developer-tool bootstrap step.
Use modern Python project metadata and local installs with venv.
Basic modern packaging metadata for a local project.
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "myapp"
version = "0.1.0"
dependencies = [
"requests>=2.31",
]
A starting point for modern packaging metadata and editable installs.
Install the current project into the venv in editable mode.
python -m pip install -e .Useful for app and library development using modern metadata.
Install project plus optional development dependencies.
python -m pip install -e ".[dev,test]"Useful when your project defines optional dependency groups for contributors.
Make local setup fast and consistent for teammates.
Copy-paste setup commands for local onboarding.
```bash
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip setuptools wheel
python -m pip install -r requirements.txt
```
A good onboarding pattern for repository documentation.
Automate local environment setup for contributors.
setup:
python -m venv .venv
. .venv/bin/activate && python -m pip install -U pip setuptools wheel
. .venv/bin/activate && python -m pip install -r requirements.txt
A small quality-of-life improvement that helps teams onboard quickly.
Example .envrc for shells that use direnv.
layout python python3
An optional workflow for automatic environment handling in supported shells.