Thank you for your interest in contributing to the PwP project! This document provides guidelines and instructions for contributing to the project.
- Setting Up Development Environment
- Project Structure
- Adding New Features
- Code Style Guidelines
- Documentation
- Pull Request Process
- Reporting Issues
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/pwp.git cd pwp - Install the package in development mode:
pip install -e . - Build the base Docker image:
cd src/pwp/docker/ docker build -t pwp_env .
The PwP project follows this structure:
pwp/
├── examples/ # Example scripts demonstrating usage
├── pwp_bench/ # Benchmark tasks
├── src/ # Source code
│ └── pwp/ # Main package
│ ├── agents/ # Agent implementations
│ ├── bench/ # Benchmark module
│ ├── docker/ # Docker configuration files
│ ├── env/ # Environment module
│ ├── functions/ # Function implementations
│ ├── prompts/ # Prompt templates
│ ├── tools/ # Tool implementations
│ └── utils/ # Utility functions
├── README.md # Main documentation
└── setup.py # Package setup
To add a new benchmark to the PwP-Bench suite:
-
Create a new directory in
pwp_bench/with your benchmark name:mkdir -p pwp_bench/your_benchmark/setup_files
-
Create the necessary files:
data.jsonordata.jsonlwith your task examplessetup_files/setup.pyfor environment setupsetup_files/eval.pyfor evaluationfirst_time.shfor initializationDockerfileif you need a custom environment
-
Add your benchmark to
task_configsinsrc/pwp/bench/benchmark.py:task_configs = { # ... existing benchmarks ... 'your_benchmark': { 'dataset': 'pwp_bench/your_benchmark/data.json', 'split': 'train', 'docker_path': 'pwp_bench/your_benchmark/' }, }
-
Verify your benchmark:
from pwp.bench import PwPBench bench = PwPBench('your_benchmark') dataset = bench.get_dataset() # Verify that your benchmark loads correctly
setup.py:
def setup(env, task):
"""
Set up the environment for a specific task.
Args:
env: PwP environment instance
task: Task data dictionary
"""
# Set up files, directories, etc.
env.run_command(f"mkdir -p /home/devuser/task_{task['task_id']}")
# Create task-specific files
if 'files' in task:
for filename, content in task['files'].items():
env.file_write(f"/home/devuser/task_{task['task_id']}/{filename}", content)
# Any additional setup
env.step("cd /home/devuser/task_{task['task_id']}")eval.py:
def eval(env, task):
"""
Evaluate the agent's solution.
Args:
env: PwP environment instance
task: Task data dictionary
Returns:
float: Score between 0.0 and 1.0
"""
# Implement your evaluation logic
# For example, comparing output with expected result
output, _ = env.run_command("cat /home/devuser/solution.txt")
if output.strip() == task['reference_solution'].strip():
return 1.0
else:
return 0.0To add new functionality to the PwP environment:
- Modify the appropriate file in
src/pwp/env/. - Add your new methods to the
PwPclass inenvironment.py. - Document your changes with docstrings and update the README if necessary.
- Verify that your changes work as expected.
To add a new agent implementation:
-
Create a new file in
src/pwp/agents/:# src/pwp/agents/your_agent.py from pwp.env import PwP class YourAgent: def __init__(self, params): self.params = params def run(self, env, task): # Implement your agent logic pass
-
Add any necessary prompts to
src/pwp/prompts/. -
Add any necessary tools to
src/pwp/tools/. -
Document your agent in the README.
To add new tools for agents:
-
Add your tool implementation to
src/pwp/tools/:# src/pwp/tools/your_tool.py def your_tool_function(env, params): # Implement your tool pass
-
Add function implementation to
src/pwp/functions/if needed. -
Update the tool mapping in the appropriate agent file.
- Follow PEP 8 for Python code style.
- Use descriptive variable and function names.
- Write comprehensive docstrings in Google or NumPy format.
- Keep functions focused and single-purpose.
- Add type hints when possible.
- Use consistent indentation (4 spaces for Python).
- Keep line length to 88 characters or fewer (Black formatter standard).
- Write meaningful commit messages following conventional commits format.
The project uses Black and isort for code formatting. Run the following before submitting your changes:
pip install black isort
black src/
isort src/- Document all public functions, classes, and methods with docstrings.
- Update README.md and related documentation when adding new features.
- Consider adding examples to the
examples/directory.
- Fork the repository and create a new branch for your feature.
- Make your changes following the guidelines above.
- Update the documentation to reflect your changes.
- Ensure your code follows the style guidelines.
- Submit a pull request with a clear description of your changes.
- Wait for a review from the maintainers.
- Use the GitHub issue tracker to report bugs or request features.
- Provide a clear description of the issue.
- Include steps to reproduce the issue when applicable.
- Mention your environment details (OS, Python version, etc.).
Thank you for contributing to the PwP project! Your efforts help make this tool better for everyone.