You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**DebugPlus** (v1.5.1+) (optional) - Required for test endpoints
21
21
22
+
## Development Environment Setup
23
+
24
+
### direnv (Recommended)
25
+
26
+
We use [direnv](https://direnv.net/) to automatically manage environment variables and virtual environment activation. When you `cd` into the project directory, direnv automatically loads settings from `.envrc`.
27
+
28
+
!!! warning "Contains Secrets"
29
+
30
+
The `.envrc` file may contain API keys and tokens. **Never commit this file**.
**Setup:** Install [direnv](https://direnv.net/), then create `.envrc` in the project root with the above configuration, updating paths for your system.
55
+
56
+
### Lua LSP Configuration
57
+
58
+
The `.luarc.json` file should be placed at the root of the balatrobot repository. It configures the Lua Language Server for IDE support (autocomplete, diagnostics, type checking).
59
+
60
+
!!! info "Update Library Paths"
61
+
62
+
You **must** update the `workspace.library` paths in `.luarc.json` to match your system:
@@ -78,7 +139,7 @@ For detailed CLI options, see the [CLI Reference](cli.md).
78
139
79
140
### 5. Running Tests
80
141
81
-
Tests use Python + pytest to communicate with the Lua API.
142
+
Tests use Python + pytest to communicate with the Lua API. You don't need to have balatrobot running—the tests automatically start the required Balatro instances.
The project includes a Makefile with convenient targets for common development tasks. Run `make help` to see all available commands.
178
+
179
+
```bash
180
+
make help# Show all available commands with descriptions
181
+
make install # Install all dependencies (dev + test groups)
182
+
make lint # Run ruff linter with auto-fix
183
+
make format # Format code (Python, Markdown, Lua)
184
+
make typecheck # Run type checker (ty)
185
+
make quality # Run all code quality checks
186
+
make fixtures # Generate test fixtures (starts Balatro)
187
+
make test# Run all tests (CLI + Lua suites)
188
+
make all # Run quality checks + tests
189
+
```
190
+
191
+
!!! note "Test Fixtures"
192
+
193
+
The `make fixtures` command is only required if you need to explicitly generate fixtures. When running tests, missing fixtures are automatically generated if required.
194
+
114
195
## Code Structure
115
196
116
197
```
@@ -120,6 +201,7 @@ src/lua/
120
201
│ ├── dispatcher.lua # Request routing
121
202
│ └── validator.lua # Schema validation
122
203
├── endpoints/ # API endpoints
204
+
│ ├── tests/ # Test-only endpoints
123
205
│ ├── health.lua
124
206
│ ├── gamestate.lua
125
207
│ ├── play.lua
@@ -163,10 +245,44 @@ return {
163
245
164
246
- Update `docs/api.md` with the new method
165
247
248
+
## Code Quality
249
+
250
+
Before committing, always run:
251
+
252
+
```bash
253
+
make quality # Runs lint, typecheck, and format
254
+
```
255
+
256
+
**Test markers:**
257
+
258
+
-`@pytest.mark.dev`: Run only tests under development with `-m dev`
259
+
-`@pytest.mark.integration`: Tests that start Balatro (skip with `-m "not integration"`)
260
+
166
261
## Pull Request Guidelines
167
262
168
263
1.**One feature per PR** - Keep changes focused
169
264
2.**Add tests** - New endpoints need test coverage
170
265
3.**Update docs** - Update api.md and openrpc.json for API changes
171
-
4.**Follow conventions** - Match existing code style
266
+
4.**Run code quality checks** - Execute `make quality` before committing (see [Code Quality Tools](#code-quality-tools))
172
267
5.**Test locally** - Ensure both `pytest -n 6 tests/lua` and `pytest tests/cli` pass
268
+
269
+
## CI/CD Pipeline
270
+
271
+
The project uses GitHub Actions for continuous integration and deployment.
272
+
273
+
### Workflows
274
+
275
+
-**code_quality.yml**: Runs linting, type checking, and formatting on every PR (equivalent to `make quality`)
276
+
-**deploy_docs.yml**: Deploys documentation to GitHub Pages when a release is published
277
+
-**release_please.yml**: Automated version management and changelog generation
278
+
-**release_pypi.yml**: Publishes the package to PyPI on release
279
+
280
+
### For Contributors
281
+
282
+
You don't need to worry about most CI/CD workflows—just ensure your PR passes the **code quality checks**:
283
+
284
+
```bash
285
+
make quality # Run this before pushing
286
+
```
287
+
288
+
If CI fails on your PR, check the workflow logs on GitHub for details. Most issues can be fixed by running `make quality` locally.
0 commit comments