All of the necessary commands to get the project running are in the
Taskfile. You can install task with Homebrew:
brew install go-task. See Installation
for more details.
We use Ruff for linting and formatting, and mypy for type checking.
To run ruff and mypy, you can use the following command:
task lintTo run the tests, you can use the following command:
task testIf 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 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 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:
- Edit
streamlit_folium/__init__.pyto set_RELEASE = False - Run
task generate-tests-frontend - Add tests as appropriate in
tests/frontend.py - Run
task test-frontendto run the tests- Note that
test_releasewill fail while_RELEASE = False-- this is expected
- Note that
- Set
_RELEASE = Trueinstreamlit_folium/__init__.pybefore opening a PR