A Python project in a dev container.
Project description
Vibe Farm
Vibe Farm lets you write normal Python modules that have missing
implementations. Mark any function with the :func:vibe_farm.farm decorator and
raise :class:vibe_farm.code inside the body. The compiler reads those .py
files and generates corresponding .vibe.py modules containing the actual
implementation. At runtime, :func:farm hot swaps the definitions with their
generated counterparts if present.
The project is designed to run inside a devcontainer, but the CLI works on any Python 3.12+ environment.
Quick Start
Install the package (the OpenAI and Anthropic client libraries are installed as
dependencies) and compile a Python file that uses :func:farm:
pip install vibe-farm
vibe_farm compile examples/hello_world/hello_world.py
The resulting .vibe.py module will appear alongside the source file.
Design Decisions
Why @farm and raise code()? An early decision in the exploration is a desire for a few outcomes in the client code:
- Make the client script directly executable. By decorating, we can hot swap with an LLM-generated implementation at runtime.
- By raising an exception that extends
NotImplementedError, the original scripts will still type check "correctly" in IDEs and with static tools such asmypy.
Project Standards & Contribution Guide
Getting Started
- Fork the repository and clone your fork
- Open in a devcontainer (recommended for consistent tooling)
- Wait for the devcontainer to finish setup - all dependencies are installed automatically
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following the development practices below
Development Environment
- Devcontainer Ready: The project includes a complete devcontainer setup with all tools pre-configured
- Virtual Environment: Automatically activated in the terminal (
pytestcommand works directly) - Pre-configured Tools: Python 3.12+, Poetry, nox, mypy, black, pytest
Development Workflow
Making Changes
- Write tests first - we maintain 100% test coverage
- Format your code: Code is automatically formatted on save, or run
black . - Run quality checks locally:
nox -s lint # Type checking with mypy + black formatting check nox -s tests # Run full test suite with coverage nox # Run all sessions (tests + lint for all Python versions)
- Commit with conventional commit format:
git commit -m "feat: add new feature description" git commit -m "fix: resolve issue with component" git commit -m "docs: update API documentation"
Commit Message Format
We use Conventional Commits. Valid types:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringperf:- Performance improvementstest:- Adding or updating testschore:- Maintenance tasksci:- CI/CD changesbuild:- Build system changes
Pull Request Process
- Push your branch to your fork
- Open a Pull Request against the
mainbranch - PR Title: Must follow conventional commit format (e.g., "feat: add new compiler feature")
- Automated Checks: The following will run automatically:
- CI Tests: Full test suite on Python 3.12
- Code Quality: mypy type checking and black formatting validation
- Security: Dependency vulnerability scanning
- Coverage: Must maintain 100% test coverage
- PR Validation: Title and commit message format checking
Continuous Integration
Automated Testing
Every pull request and push to main triggers:
- Multi-Python Testing: Tests run on Python 3.12
- Full Test Suite: All unit and integration tests via nox
- Code Quality Checks: mypy type checking and black formatting
- Security Scanning: Automated dependency vulnerability checks
- Coverage Reporting: Results uploaded to Codecov
Required Checks
Before merging, all PRs must pass:
- ✅ Tests pass on both Python versions
- ✅ 100% test coverage maintained
- ✅ No mypy type errors
- ✅ Code formatted with black
- ✅ No security vulnerabilities
- ✅ Conventional commit format
- ✅ Code review approved
Release Process
Automated Releases
Releases are automated via GitHub Actions:
-
Create a version tag:
git tag v1.2.3 git push origin v1.2.3
-
Automatic workflow:
- Full test suite runs on both Python versions
- Package is built with Poetry
- Automatically published to PyPI
- GitHub Release is created
Version Management
- Update version in
pyproject.tomlbefore tagging - Follow Semantic Versioning
- Tag format:
v1.2.3(with 'v' prefix)
Maintenance
Automated Updates
- Dependabot: Automatically creates PRs for dependency updates weekly
- Scheduled Tests: Full test suite runs daily to catch integration issues
- Security Monitoring: Automated scanning for known vulnerabilities
Manual Tasks
- Review and merge Dependabot PRs
- Update Python version support as needed
- Maintain documentation and examples
Tooling
- Python 3.12+ (managed by devcontainer)
- Poetry for dependency management and packaging
- pytest for testing
- pytest-cov for coverage
- mypy for static type checking
- black for code formatting
- nox for automation of test and lint tasks
- ESLint, Node, npm (available in devcontainer for JS/Node interop if needed)
Development Practices
- 100% Test Coverage: All code must be covered by tests
- Type Safety: Use modern type hints for all public APIs
- Code Quality: Format with black, validate with mypy
- Documentation: Document public APIs and complex logic
- Conventional Commits: Required for all commits and PR titles
Local Development Commands
# Format code (done automatically on save in devcontainer)
black .
# Run type checking and formatting validation
nox -s lint
# Run tests with coverage (must maintain 100%)
nox -s tests
# Run everything (tests + lint for all Python versions)
nox
# Run specific Python version
nox -s tests-3.12
nox -s lint-3.12
Testing Requirements
- Unit Tests: Test individual functions and classes
- Integration Tests: Test CLI commands and workflows
- Coverage: Must maintain 100% - no exceptions
- Mock External Services: Use mocks for OpenAI/Anthropic APIs
- Fast Execution: Tests should complete quickly for CI
Code Style
- Formatting: Black with default settings (line length 88)
- Type Hints: Required for all function signatures
- Imports: Organized and minimal
- Documentation: Docstrings for public APIs using Google style
Running Tests & Linting
black . # Format code
nox -s lint # Type checking and lint
nox -s tests # Run unit tests with coverage
nox # Run all automation sessions
CLI Usage
Vibe Farm provides a small CLI with two main commands:
vibe_farm compile path/to/file.py # generate a .vibe.py implementation
vibe_farm analyze path/to/module.py # inspect code for vibe placeholders
Run vibe_farm --help for a full list of options.
Environment Variables
Vibe Farm automatically loads variables from a .env file if present. Set the
following keys for each supported provider:
# OpenAI
OPENAI_API_KEY=your-openai-key
# Anthropic Claude
ANTHROPIC_API_KEY=your-anthropic-key
Keep the .env file outside version control (it's ignored by .gitignore).
License
This project is distributed under the MIT License.
Publishing
- Update version in
pyproject.toml - Build and publish with Poetry:
poetry build poetry publish
For more details, see the code and comments, or open an issue/discussion!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vibe_farm-0.1.3.tar.gz.
File metadata
- Download URL: vibe_farm-0.1.3.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fba0105b6c837ad1091870f774a098d2c06338012c63837635e811d8369d366
|
|
| MD5 |
3f6a900e847e63d7569691f5aad0cfe3
|
|
| BLAKE2b-256 |
09bebd70ed2aaa44e9136edfab8e4e3281f47c4a4753e1a2718da4cd8f214eb6
|
File details
Details for the file vibe_farm-0.1.3-py3-none-any.whl.
File metadata
- Download URL: vibe_farm-0.1.3-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a8c493bc19802e945b8c703b74e6c9d20b31ba5e5158e00ff23d438b52162c6
|
|
| MD5 |
3899fcb63deeb367996fff5176622dcb
|
|
| BLAKE2b-256 |
efaee91c6580d9ac41839053ae4ad7cd69e608c081c615d2b3d75851a7762160
|