Skip to content

Commit 34a478b

Browse files
authored
Merge pull request #7 from grafana/development-section-in-readme
Add development section to README
2 parents 6587178 + 81fc131 commit 34a478b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,57 @@ Follow the [Grafana documentation][service-account] for details.
7070
To disable a category of tools, set the environment variable `GRAFANA_TOOLS__<CATEGORY>__ENABLED` to `"false"`.
7171
For example, to disable the search tools, set `"GRAFANA_TOOLS__SEARCH__ENABLED": "false"`.
7272

73+
## Development
74+
75+
Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
76+
77+
This project uses [`uv`] to manage dependencies. Install `uv` following the instructions for your platform.
78+
79+
You can then create a virtual environment and install the dependencies with:
80+
81+
```bash
82+
uv sync --all-groups
83+
```
84+
85+
### Testing
86+
87+
TL;DR: start a Grafana instance with `docker-compose up`, run `uv run ruff check .` for lints, and `uv run pytest tests --integration` to run unit and integration tests.
88+
89+
To run unit tests, run:
90+
91+
```bash
92+
uv run pytest tests
93+
```
94+
95+
More comprehensive integration tests will require a Grafana instance to be running locally on port 3000; you can start one with Docker Compose:
96+
97+
```bash
98+
docker-compose up -d
99+
```
100+
101+
The integration tests can be run with:
102+
103+
```bash
104+
uv run pytest --integration tests
105+
```
106+
107+
If you're adding more tools, please add integration tests for them. The existing tests should be a good starting point.
108+
109+
Certain tools use functionality that is only available in Grafana Cloud. Such tests should use the `mark_cloud` Pytest mark; see the [incident_test.py](tests/tools/incident_test.py) file for an example.
110+
Use the `GRAFANA_URL` and `GRAFANA_API_KEY` environment variables to configure the Grafana instance to use for testing, and run these tests with:
111+
112+
```bash
113+
GRAFANA_URL=https://myinstance.grafana.net GRAFANA_API_KEY=my-api-key uv run pytest --cloud tests
114+
```
115+
116+
### Linting
117+
118+
This project uses [ruff](https://github.com/charliermarsh/ruff) for linting.
119+
73120
## License
74121

75122
This project is licensed under the [Apache License, Version 2.0](LICENSE).
76123

77124
[mcp]: https://modelcontextprotocol.io/
78125
[service-account]: https://grafana.com/docs/grafana/latest/administration/service-accounts/
126+
[`uv`]: https://docs.astral.sh/uv/

0 commit comments

Comments
 (0)