Skip to content

Commit

Permalink
Split Python and JavaScript packages (#1168)
Browse files Browse the repository at this point in the history
* Split directory structure

* Too much green

* Rename things

* Split packages

* Update gitignore

* Remove lib dir from git

* Restore examples

* Update install path in workflow

* Update main workflow

* Use the right directory name

* Update working directory for linter CI

* Fix linting CI

* Update ui-tests workflow

* Update python versions and readme paths

* Rename python module

* Remove unnecessary files

* Update build targets

* Update meta build targets

* Update doc environments

* Remove some files

* Update paths in documentation

* Remove MANIFEST

* Update docs environment files

* Update doc environemtns again

* Add ipyleaflet to the lite deployment

---------

Co-authored-by: martinRenou <[email protected]>
  • Loading branch information
gjmooney and martinRenou authored Jan 16, 2024
1 parent 22506af commit 78ba5f7
Show file tree
Hide file tree
Showing 102 changed files with 286 additions and 158 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
- python==${{ matrix.python-version }}
- name: Install ipyleaflet
run: pip install . --no-deps
run: pip install python/jupyter_leaflet python/ipyleaflet_core python/ipyleaflet --no-deps

- name: Check installation files
run: |
test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-leaflet
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-leaflet/extension.js
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-leaflet/index.js
test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-leaflet
test -f $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-leaflet/index.js
test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-leaflet/package.json
- name: Python Linters
Expand All @@ -51,7 +51,7 @@ jobs:
run: |
yarn install
yarn run lint:check
working-directory: js
working-directory: python/jupyter_leaflet

- name: Import check
run: python -c 'import ipyleaflet'
3 changes: 1 addition & 2 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: UI Tests

on: [push, pull_request]


defaults:
run:
shell: bash -l {0}
Expand All @@ -26,7 +25,7 @@ jobs:
channels: conda-forge

- name: Install ipyleaflet
run: pip install . --no-deps
run: pip install python/jupyter_leaflet python/ipyleaflet_core python/ipyleaflet --no-deps

- name: Install browser
run: |
Expand Down
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ build/
*.py[cod]
node_modules/
*package-lock.json
js/.yarn/
python/jupyter_leaflet/.yarn/
ui-tests/.yarn/

# Compiled javascript
ipyleaflet/nbextension/
ipyleaflet/labextension/
js/dist/
js/lib/
python/jupyter_leaflet/nbextension/
python/jupyter_leaflet/labextension/
python/jupyter_leaflet/dist/
python/jupyter_leaflet/lib/

# OS X
.DS_Store
.idea/

js/jupyter-leaflet-*.tgz

# Documentation data files
docs/*.csv
docs/*.json
Expand Down
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

8 changes: 4 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
git clone [email protected]:jupyter-widgets/ipyleaflet.git
```
2. Update the version numbers in the following files (see https://github.com/jupyter-widgets/ipyleaflet/commit/48f3cb68cd07e6c4ae7b353a17861e4e51ca4471)
- `ipyleaflet/_version.py` (two places)
- `js/package.json`
- `ipyleaflet/ipyleaflet_core/ipyleaflet/_version.py` (two places)
- `ipyleaflet/python/jupyter_leaflet/package.json`
- `environment.yml`
3. Make sure the changelog is updated: `CHANGELOG.md`
4. Build and publish to npm (if yarn prompts for the new version, I give the same as what is already in the `package.json`)
```sh
cd js
cd ipyleaflet/python/jupyter_leaflet
yarn install && yarn run build && yarn publish
cd ..
```
Expand All @@ -20,7 +20,7 @@
python -m build
twine upload dist/*
```
6. Update environment environment config with new ipyleaflet pypi download link: `docs/jupyterlite_config.json`
6. Update environment config with new ipyleaflet pypi download link: `docs/jupyterlite_config.json`
7. Commit and push in git
```sh
git commit -am "Release <VERSION>"
Expand Down
6 changes: 5 additions & 1 deletion docs/build-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- jupyterlab~=4.0
- jupyter-packaging~=0.12
- jupyter-sphinx
- build
- scipy
- netcdf4
- geopandas
Expand All @@ -18,4 +19,7 @@ dependencies:
- jupyterlite-sphinx
- jupyterlite-xeus-python >=0.9.2,<0.10
- pip:
- ..
- ../python/jupyter_leaflet
- ../python/ipyleaflet_core
- ../python/ipyleaflet
- ../python/ipyleaflet
5 changes: 4 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ dependencies:
- xyzservices
- branca
- pip:
- ..
- ../python/jupyter_leaflet
- ../python/ipyleaflet_core
- ../python/ipyleaflet
- ../python/ipyleaflet
2 changes: 1 addition & 1 deletion docs/installation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Note for developers:
- the ``-e`` pip option allows one to modify the Python code in-place. Restart the kernel in order to see the changes.
- the ``--symlink`` argument on Linux or OS X allows one to modify the JavaScript code in-place. This feature is not available with Windows.

For automatically building the JavaScript code every time there is a change, run the following command from the ``ipyleaflet/js/`` directory:
For automatically building the JavaScript code every time there is a change, run the following command from the ``ipyleaflet/python/jupyter_leaflet`` directory:

.. code:: bash
Expand Down
3 changes: 0 additions & 3 deletions js/.prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions jupyter-leaflet.json

This file was deleted.

21 changes: 21 additions & 0 deletions python/ipyleaflet/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2018, Project Jupyter Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions python/ipyleaflet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipyleaflet meta package
39 changes: 39 additions & 0 deletions python/ipyleaflet/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[build-system]
requires = [
"hatchling",
"jupyterlab==4.*",
]
build-backend = "hatchling.build"

[project]
name = "ipyleaflet"
version = "0.18.1"
description = "A Jupyter widget for dynamic Leaflet maps"
readme = "../../README.md"
authors = [
{ name = "Project Jupyter", email = "[email protected]" },
]
keywords = [
"ipython", "jupyter", "widgets", "graphics", "GIS",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Multimedia :: Graphics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.10"
dependencies = [
"ipyleaflet_core",
"jupyter_leaflet",
]

[project.urls]
Homepage = "https://github.com/jupyter-widgets/ipyleaflet"

[tool.hatch.build.targets.wheel]
packages = ["ipyleaflet_core", "jupyer_leaflet"]
1 change: 1 addition & 0 deletions python/ipyleaflet/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__("setuptools").setup()
21 changes: 21 additions & 0 deletions python/ipyleaflet_core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2018, Project Jupyter Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions python/ipyleaflet_core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipyleaflet meta package
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,3 @@
from google.colab import output

output.enable_custom_widget_manager()


def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": "jupyter-leaflet"}]


def _jupyter_nbextension_paths():
return [
{
"section": "notebook",
"src": "nbextension",
"dest": "jupyter-leaflet",
"require": "jupyter-leaflet/extension",
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2576,7 +2576,7 @@ class Map(DOMWidget, InteractMixin):
Whether the map can be zoomed in by double clicking on it and zoomed out by double clicking while holding shift.
box_zoom: boolean, default True
Whether the map can be zoomed to a rectangular area specified by dragging the mouse while pressing the shift key
tap_hold: boolean, default True
tap: boolean, default True
Enables mobile hacks for supporting instant taps.
tap_tolerance: int, default 15
The max number of pixels a user can shift his finger during touch for it to be considered a valid tap.
Expand Down Expand Up @@ -2637,7 +2637,7 @@ class Map(DOMWidget, InteractMixin):
scroll_wheel_zoom = Bool(False).tag(sync=True, o=True)
double_click_zoom = Bool(True).tag(sync=True, o=True)
box_zoom = Bool(True).tag(sync=True, o=True)
tap_hold = Bool(True).tag(sync=True, o=True)
tap = Bool(True).tag(sync=True, o=True)
tap_tolerance = Int(15).tag(sync=True, o=True)
world_copy_jump = Bool(False).tag(sync=True, o=True)
close_popup_on_click = Bool(True).tag(sync=True, o=True)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions python/ipyleaflet_core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = [
"hatchling",
"jupyterlab==4.*",
]
build-backend = "hatchling.build"

[project]
name = "ipyleaflet-core"
version = "0.18.1"
description = "A Jupyter widget for dynamic Leaflet maps"
readme = "../../README.md"
authors = [
{ name = "Project Jupyter", email = "[email protected]" },
]
keywords = [
"ipython", "jupyter", "widgets", "graphics", "GIS",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Multimedia :: Graphics",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.10"
dependencies = [
"ipywidgets>=7.6.0,<9",
"traittypes>=0.2.1,<3",
"xyzservices>=2021.8.1",
"branca>=0.5.0",
]

[project.urls]
Homepage = "https://github.com/jupyter-widgets/ipyleaflet"

[tool.hatch.build.targets.wheel]
packages = ["ipyleaflet"]

[tool.ruff]
extend-include = ["*.ipynb"]

[tool.ruff.lint]
select = [
# pycodestyle
"E",
]
ignore = ["E501", "E731"]
1 change: 1 addition & 0 deletions python/ipyleaflet_core/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__("setuptools").setup()
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions python/jupyter_leaflet/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
lib
labextension
nbextension
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions python/jupyter_leaflet/jupyter-leaflet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"load_extensions": {
"jupyter-leaflet/extension": true
}
}
19 changes: 19 additions & 0 deletions python/jupyter_leaflet/jupyter_leaflet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
#



def _jupyter_labextension_paths():
return [{"src": "../labextension", "dest": "jupyter-leaflet"}]


def _jupyter_nbextension_paths():
return [
{
"section": "notebook",
"src": "../nbextension",
"dest": "jupyter-leaflet",
"require": "jupyter-leaflet/extension",
}
]
Loading

0 comments on commit 78ba5f7

Please sign in to comment.