diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 0c341f496d..854eb67263 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,7 +2,6 @@ ```python # Your code here - ``` #### Problem description diff --git a/.github/workflows/save_coverage.yml b/.github/workflows/save_coverage.yml deleted file mode 100644 index 11b3afc605..0000000000 --- a/.github/workflows/save_coverage.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Upload coverage - -on: - workflow_run: - workflows: ['Code Tests', 'Geopandas tests', 'Code Tests with Latest branca', 'Selenium Tests', 'Run Snapshot Tests', 'Run Streamlit Folium Tests'] - types: [completed] - -jobs: - run: - runs-on: ubuntu-latest - - steps: - - name: Download coverage files from previous steps - id: download-artifacts - uses: actions/download-artifact@v4 - with: - path: combined-coverage - pattern: coverage-* - merge-multiple: true - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install coverage - run: pip install coverage - - - name: Combine coverage - run: coverage combine - - - name: Generate report - run: coverage html --skip-covered - - - name: Upload coverage report - if: always() - uses: actions/upload-artifact@v4 - with: - name: combined-coverage - path: htmlcov/** diff --git a/.github/workflows/test_code.yml b/.github/workflows/test_code.yml index ab966c9e29..6026d8bb9c 100644 --- a/.github/workflows/test_code.yml +++ b/.github/workflows/test_code.yml @@ -36,17 +36,19 @@ jobs: run: python -m pip install -e . --no-deps --force-reinstall - name: Install pixelmatch - shell: bash -l {0} run: | pip install pixelmatch - name: Code tests - run: coverage run -p -m pytest -vv --ignore=tests/selenium --ignore=tests/playwright --ignore=tests/snapshots + run: | + coverage run -p -m pytest -vv --ignore=tests/selenium --ignore=tests/playwright --ignore=tests/snapshots + pwd + ls -la - name: Upload coverage if: always() uses: actions/upload-artifact@v4 with: - name: coverage-test-code - path: | - .coverage* + name: coverage-test-code-${{ matrix.os }}-${{ matrix.python-version }} + path: .coverage* + include-hidden-files: true diff --git a/.github/workflows/test_geopandas.yml b/.github/workflows/test_geopandas.yml index 219b3db194..d921235cbd 100644 --- a/.github/workflows/test_geopandas.yml +++ b/.github/workflows/test_geopandas.yml @@ -11,6 +11,9 @@ on: jobs: run: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - name: Checkout Folium @@ -55,3 +58,4 @@ jobs: name: coverage-test-geopandas path: | .coverage* + include-hidden-files: true diff --git a/.github/workflows/test_latest_branca.yml b/.github/workflows/test_latest_branca.yml index 0f0f4ea70e..43be4369df 100644 --- a/.github/workflows/test_latest_branca.yml +++ b/.github/workflows/test_latest_branca.yml @@ -11,6 +11,9 @@ on: jobs: run: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v4 @@ -25,11 +28,9 @@ jobs: --file requirements-dev.txt - name: Install folium from source - shell: bash -l {0} run: python -m pip install -e . --no-deps --force-reinstall - name: Tests with latest branca - shell: bash -l {0} run: | micromamba remove branca --yes --force python -m pip install git+https://github.com/python-visualization/branca.git @@ -42,3 +43,4 @@ jobs: name: coverage-test-branca path: | .coverage* + include-hidden-files: true diff --git a/.github/workflows/test_mypy.yml b/.github/workflows/test_mypy.yml index d2504e0fcc..8b1ad260c6 100644 --- a/.github/workflows/test_mypy.yml +++ b/.github/workflows/test_mypy.yml @@ -11,6 +11,9 @@ on: jobs: run: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v4 @@ -25,11 +28,9 @@ jobs: --file requirements-dev.txt - name: Install folium from source - shell: bash -l {0} run: | python -m pip install -e . --no-deps --force-reinstall - name: Mypy test - shell: bash -l {0} run: | mypy folium diff --git a/.github/workflows/test_selenium.yml b/.github/workflows/test_selenium.yml index e1d876d33c..b8a3225760 100644 --- a/.github/workflows/test_selenium.yml +++ b/.github/workflows/test_selenium.yml @@ -15,6 +15,9 @@ jobs: matrix: python-version: [ "3.9", "3.13" ] fail-fast: false + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v4 @@ -29,17 +32,16 @@ jobs: --file requirements-dev.txt - name: Install folium from source - shell: bash -l {0} run: python -m pip install -e . --no-deps --force-reinstall - name: Selenium tests - shell: bash -l {0} run: coverage run -p -m pytest tests/selenium -vv - name: Upload coverage if: always() uses: actions/upload-artifact@v4 with: - name: coverage-test-selenium + name: coverage-test-selenium-${{ matrix.python-version }} path: | .coverage* + include-hidden-files: true diff --git a/.github/workflows/test_snapshots.yml b/.github/workflows/test_snapshots.yml index 14cac92028..8a21c7cc57 100644 --- a/.github/workflows/test_snapshots.yml +++ b/.github/workflows/test_snapshots.yml @@ -9,6 +9,9 @@ on: jobs: run: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - name: Checkout Folium @@ -24,17 +27,14 @@ jobs: --file requirements-dev.txt - name: Install pytest plugins and pixelmatch - shell: bash -l {0} run: | pip install pixelmatch pytest-github-actions-annotate-failures pytest-rerunfailures - name: Install folium from source - shell: bash -l {0} run: | python -m pip install -e . --no-deps --force-reinstall - name: Test with pytest - shell: bash -l {0} run: | coverage run -p -m pytest tests/snapshots -s --junit-xml=test-results.xml @@ -61,3 +61,4 @@ jobs: name: coverage-test-snapshots path: | .coverage* + include-hidden-files: true diff --git a/.github/workflows/test_streamlit_folium.yml b/.github/workflows/test_streamlit_folium.yml index bf7821743d..10ebeb486f 100644 --- a/.github/workflows/test_streamlit_folium.yml +++ b/.github/workflows/test_streamlit_folium.yml @@ -11,6 +11,9 @@ on: jobs: run: runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} steps: - name: Set up Python @@ -29,27 +32,23 @@ jobs: path: streamlit_folium # Checkout into a subdirectory - name: Build streamlit_folium javascript - shell: bash -l {0} run: | cd streamlit_folium/streamlit_folium/frontend/ npm install npm run build - name: Install streamlit_folium dev dependencies - shell: bash -l {0} run: | cd streamlit_folium python -m pip install --upgrade pip pip install -r tests/requirements.txt - name: Install streamlit-folium - shell: bash -l {0} run: | cd streamlit_folium pip install -e . - name: Install playwright dependencies - shell: bash -l {0} run: | playwright install --with-deps @@ -57,12 +56,10 @@ jobs: run: pip install pytest-github-actions-annotate-failures coverage - name: Install folium from source - shell: bash -l {0} run: | python -m pip install -e . --force-reinstall - name: Test with pytest and retry flaky tests up to 3 times - shell: bash -l {0} run: | cd streamlit_folium python -m pytest tests/test_frontend.py --browser chromium -s --reruns 3 -k "not test_layer_control_dynamic_update" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27ce4ea7f5..83a0724de7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: files: requirements-dev.txt - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.12 + rev: v0.12.2 hooks: - id: ruff @@ -28,7 +28,7 @@ repos: language_version: python3 - repo: https://github.com/keewis/blackdoc - rev: v0.3.9 + rev: v0.4.1 hooks: - id: blackdoc diff --git a/docs/_static/switcher.json b/docs/_static/switcher.json index 601d81a7a8..dd94201e11 100644 --- a/docs/_static/switcher.json +++ b/docs/_static/switcher.json @@ -4,10 +4,14 @@ "url": "https://python-visualization.github.io/folium/dev/" }, { - "name": "latest (0.19.7)", - "version": "0.19.7", + "name": "latest (0.20.0)", + "version": "0.20.0", "url": "https://python-visualization.github.io/folium/latest/" }, + { + "version": "0.19.7", + "url": "https://python-visualization.github.io/folium/v0.19.7/" + }, { "version": "0.19.6", "url": "https://python-visualization.github.io/folium/v0.19.6/" diff --git a/folium/plugins/geoman.py b/folium/plugins/geoman.py index dc4c05be4c..a427961191 100644 --- a/folium/plugins/geoman.py +++ b/folium/plugins/geoman.py @@ -64,6 +64,18 @@ class GeoMan(JSCSSMixin, MacroElement): {%- endfor %} }); + {{ this._parent.get_name() }}.on("pm:cut", function(e) { + var layer = e.layer, + type = e.layerType; + + {%- for event, handler in this.on.items() %} + layer.on( + "{{event}}", + {{handler}} + ); + {%- endfor %} + }); + {% endmacro %} """ )