| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A ready-to-use Python 3.13 development environment using VS Code DevContainers. This project demonstrates best practices for Python package development with modern tooling, testing, and dependency management.
Option A: Using VS Code
Option B: Using GitHub Codespaces
Once the container builds, the postCreateCommand automatically:
Verify the setup:
# Check Python version
python --version # Should show Python 3.13.x
# Check that the virtual environment is active
which python # Should point to .venv/bin/python
# Test the example CLI
helloworld# Run the CLI with default greeting
helloworld
# Enter your name: World
# Output: Hello, World!
# Run with a name option
helloworld --name Alice
# Output: Hello, Alice!
# Run tests
cd helloworld
pytest
# Run tests with coverage
pytest --cov=helloworld --cov-report=term-missing
# Lint the code
ruff check .
# Format the code
ruff format .. ├── .devcontainer/ │ └── devcontainer.json # DevContainer configuration ├── helloworld/ # Example Python package │ ├── pyproject.toml # Package metadata and dependencies │ ├── helloworld/ # Source code │ │ ├── __init__.py │ │ ├── __main__.py # CLI entry point │ │ └── hello.py # Core functionality │ └── tests/ # Test suite │ ├── test_hello.py │ └── test_entrypoints.py ├── freeze_version.py # Version management helper ├── LICENSE └── README.md # This file
cd helloworld
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run specific test file
pytest tests/test_hello.py
# Run with coverage
pytest --cov=helloworld --cov-report=htmlcd helloworld
# Check for linting issues
ruff check .
# Auto-fix linting issues
ruff check --fix .
# Format code
ruff format .# Activate virtual environment (if not already active)
source .venv/bin/activate
# Install a new package
pip install package-name
# Add to pyproject.toml dependencies
# Then reinstall in editable mode
pip install -e helloworld[dev]This project uses setuptools-scm for automatic version management based on Git tags:
# Check current version
python -c "from setuptools_scm import get_version; print(get_version())"
# Freeze version to JSON file
python freeze_version.pyThe included helloworld package demonstrates:
# Interactive mode
helloworld
# With arguments
helloworld --name "Python Developer"
# Get help
helloworld --helpfrom helloworld.hello import hello
message = hello("Developer")
print(message) # Output: Hello, Developer!# Remove the example package
rm -rf helloworld/
# Create your own package structure
mkdir -p myproject
cd myproject[project]
name = "myproject"
version = "0.1.0"
description = "My awesome project"
requires-python = ">=3.13"
dependencies = [
# Add your dependencies here
]
[project.optional-dependencies]
dev = [
"pytest",
"ruff",
]Edit .devcontainer/devcontainer.json:
{
"name": "My Project",
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"postCreateCommand": "python -m venv .venv && .venv/bin/pip install -e myproject[dev]",
...
}source .venv/bin/activatepip install -e helloworld[dev]Ensure you're in the virtual environment and the package is installed in editable mode:
which python # Should show .venv/bin/python
pip list | grep helloworldMIT License - see LICENSE file for details.
This is a template project. Feel free to fork and customize for your needs!
| Back | FazBrowse Home | New Git URL |