diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2de3014 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,44 @@ +All of the necessary commands to get the project running are in the +[Taskfile](https://taskfile.dev/). + +### Linting and formatting + +We use [Ruff](https://github.com/astral-sh/ruff) for linting and formatting. + +To run ruff, you can use the following command: + +```bash +task lint +``` + +### Running tests + +To run the tests, you can use the following command: + +```bash +task test +``` + +### Adding tests + +If you add a new feature, or fix a bug, please add a test to ensure that the feature works as expected. + +The pattern for creating tests is to use the example streamlit app, and use +[playwright](https://playwright.dev/python/docs/intro) to create and +run tests on the app. + +These tests are primarily located in the `tests/frontend.py` file. + +If you are making a change that only affects the python code, you can +run the playwright [codegen](https://playwright.dev/python/docs/codegen) tool to +help generate the tests by running `task generate-tests`. + +If you are making a change that affects the javascript code, you need to set up +folium to use your local frontend code. This can be done by: + +1. Edit `streamlit_folium/__init__.py` to set `_RELEASE = False` +2. Run `task generate-tests-frontend` +3. Add tests as appropriate in `tests/frontend.py` +4. Run `task test-frontend` to run the tests + * Note that `test_release` will fail while `_RELEASE = False` -- this is expected +5. Set `_RELEASE = True` in `streamlit_folium/__init__.py` before opening a PR \ No newline at end of file diff --git a/README.md b/README.md index 7b5ba76..1cdb186 100644 --- a/README.md +++ b/README.md @@ -38,46 +38,4 @@ Currently, there are two functions defined: ## Contributing -All of the necessary commands to get the project running are in the [Taskfile](https://taskfile.dev/). - -### Linting and formatting - -We use [Ruff](https://github.com/astral-sh/ruff) for linting and formatting. - -To run ruff, you can use the following command: - -```bash -task lint -``` - -### Running tests - -To run the tests, you can use the following command: - -```bash -task test -``` - -### Adding tests - -If you add a new feature, or fix a bug, please add a test to ensure that the feature works as expected. - -The pattern for creating tests is to use the example streamlit app, and use -[playwright](https://playwright.dev/python/docs/intro) to create and -run tests on the app. - -These tests are primarily located in the `tests/frontend.py` file. - -If you are making a change that only affects the python code, you can -run the playwright [codegen](https://playwright.dev/python/docs/codegen) tool to -help generate the tests by running `task generate-tests`. - -If you are making a change that affects the javascript code, you need to set up -folium to use your local frontend code. This can be done by: - -1. Edit `streamlit_folium/__init__.py` to set `_RELEASE = False` -2. Run `task generate-tests-frontend` -3. Add tests as appropriate in `tests/frontend.py` -4. Run `task test-frontend` to run the tests - * Note that `test_release` will fail while `_RELEASE = False` -- this is expected -5. Set `_RELEASE = True` in `streamlit_folium/__init__.py` before opening a PR +See [CONTRIBUTING.md](CONTRIBUTING.md) for more details. \ No newline at end of file