|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for considering contributing to the Bling ERP API SDK! |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +1. Clone the repository: |
| 8 | + |
| 9 | + ```bash |
| 10 | + git clone https://github.com/tempont/bling-erp-api-python.git |
| 11 | + cd bling-erp-api-python |
| 12 | + ``` |
| 13 | + |
| 14 | +2. Install dependencies with `uv`: |
| 15 | + |
| 16 | + ```bash |
| 17 | + uv sync --all-groups |
| 18 | + ``` |
| 19 | + |
| 20 | +3. Run the full check suite to verify everything works: |
| 21 | + |
| 22 | + ```bash |
| 23 | + make check |
| 24 | + ``` |
| 25 | + |
| 26 | +## Code Style |
| 27 | + |
| 28 | +This project uses: |
| 29 | + |
| 30 | +- **Ruff** for linting and formatting (see `pyproject.toml` for configuration) |
| 31 | +- **basedpyright** for type checking (strict mode) |
| 32 | + |
| 33 | +Run linting and formatting before committing: |
| 34 | + |
| 35 | +```bash |
| 36 | +uv run ruff check . && uv run ruff format --check . |
| 37 | +``` |
| 38 | + |
| 39 | +Or let pre-commit handle it: |
| 40 | + |
| 41 | +```bash |
| 42 | +uv run pre-commit run --all-files |
| 43 | +``` |
| 44 | + |
| 45 | +## Code Generation |
| 46 | + |
| 47 | +Some models and contracts are generated from the Bling OpenAPI specification: |
| 48 | + |
| 49 | +```bash |
| 50 | +make codegen |
| 51 | +``` |
| 52 | + |
| 53 | +This runs the scripts under `scripts/`: |
| 54 | + |
| 55 | +- `generate_openapi_contracts.py` — generates resource contracts |
| 56 | +- `generate_models.py` — generates Pydantic models |
| 57 | + |
| 58 | +Generated files live in: |
| 59 | + |
| 60 | +- `src/bling_erp_api/contracts/generated/` |
| 61 | +- `src/bling_erp_api/models/generated/` |
| 62 | +- `docs/resources/` |
| 63 | + |
| 64 | +## Testing |
| 65 | + |
| 66 | +Run the test suite: |
| 67 | + |
| 68 | +```bash |
| 69 | +uv run python -m pytest |
| 70 | +``` |
| 71 | + |
| 72 | +Or with coverage: |
| 73 | + |
| 74 | +```bash |
| 75 | +uv run python -m pytest --cov=bling_erp_api |
| 76 | +``` |
| 77 | + |
| 78 | +**Important**: Tests must not make real API calls unless explicitly gated behind environment variables. Use `pytest-httpx` for HTTP mocking. |
| 79 | + |
| 80 | +## Adding a New Endpoint |
| 81 | + |
| 82 | +Follow the checklist in `AGENTS.md` (located in the repository root) for adding new endpoints. The key steps are: |
| 83 | + |
| 84 | +1. Find the operation in `specs/bling-openapi-reference.json` |
| 85 | +2. Add resource/action mappings to `scripts/generate_openapi_contracts.py` |
| 86 | +3. Run contract generation |
| 87 | +4. Create or update the resource class in `src/bling_erp_api/resources/` |
| 88 | +5. Add the resource namespace to the client |
| 89 | +6. Add tests (contract tests, resource mapping tests, model tests) |
| 90 | + |
| 91 | +## Pull Request Workflow |
| 92 | + |
| 93 | +1. Fork the repository |
| 94 | +2. Create a feature branch (`git checkout -b feat/my-feature`) |
| 95 | +3. Make your changes |
| 96 | +4. Run `make check` to verify |
| 97 | +5. Commit with a clear message |
| 98 | +6. Push and open a pull request |
| 99 | + |
| 100 | +## Project Conventions |
| 101 | + |
| 102 | +For deep conventions on naming, docstrings, model structure, and resource implementation, see the `AGENTS.md` file in the repository root. It documents the complete project design decisions and per-endpoint checklist. |
| 103 | + |
| 104 | +## License |
| 105 | + |
| 106 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
0 commit comments