Development - Capsize-Games/airunner GitHub Wiki
Installation
See installation page for detailed instructions.
Environment Variables
- All values must be set in your environment or a
.env
file before running AI Runner. - Be careful not to share sensitive tokens or API keys publicly.
- See Settings documentation for available environment variables
Development Guidelines
AI development tools
The use of AI tools to develop AI Runner is encouraged.
Here are some recommendations and guidelines.
- Try to keep full agent development limited to things like widgets, tests, styles
- Point your agent at existing widgets, tell your agent to use that as a reference while creating a new widget and provide detailed instructions
- Do some manual testing to ensure everything works as expected
- Your code must still be formatted correctly and follow other expected development standards
- Agents tend to fail on large features that span multiple modules - although code assistants will be helpful while editing things like the model manager classes, agents will struggle.
- AI Runner cannot as of yet program itself, but this would be an interesting area to explore.
- Join the Discord server and share some of the things you create and the prompts and techniques you used to create them
Setting Up the Environment
- Clone the repository:
git clone https://github.com/Capsize-Games/airunner.git cd airunner
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables in a
.env
file or export them directly:export AI_RUNNER_DATABASE_URL="sqlite:///path/to/database.db" export AIRUNNER_LOG_LEVEL="DEBUG"
Running the Application in Development Mode
Use the following command to start AI Runner in development mode:
python src/airunner/app.py
Testing
Run all unit tests:
python -m unittest discover -s src/airunner/tests
Run a specific test:
python -m unittest src/airunner/tests/test_file.py
Code Style
- Use spaces for indentation
- Follow PEP 8 guidelines for Python code.
- Use
black
for code formatting:black .
- Check for linting issues with
flake8
: Note: This one is optional, but recommended.
flake8 src/airunner
- Check for linting issues with
Editor Configuration
If you're using VSCode add this to the settings:
{
"black-formatter.args": ["--line-length", "79"],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.rulers": [
{
"column": 72,
"color": "#222"
},
{
"column": 79,
"color": "#888"
},
]
}
}
Contributing
- Fork the repository and create a feature branch.
- Ensure all tests pass before submitting a pull request.
- Include detailed commit messages and documentation for new features.
Docker container maintenance
If you make changes to the build files, be sure to test them locally before doing a PR. For this you can use the act
tool to run the GitHub actions locally.
- Install act
- Create a github personal access token
- Add the personal access token to a
.secrets
file in the root of the project. The file should look like this:CR_PAT=ghp_xxxxxxxx1234567890abcdefg
- Run the build action locally:
act push --secret-file .secrets --verbose