From 42ceffac3c09ffb6eea9a21c4bb67694c6050bb9 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Sun, 6 Aug 2023 12:40:13 +0000 Subject: [PATCH 1/3] refactor: use modern packaging by moving everything to pyproject.toml --- pyproject.toml | 47 ++++++++++++++++++++++++++++++++++++++++++-- setup.cfg | 2 -- setup.py | 42 ++------------------------------------- test.ipynb | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 44 deletions(-) delete mode 100644 setup.cfg create mode 100644 test.ipynb diff --git a/pyproject.toml b/pyproject.toml index fa729c7c8..d1b570e38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,47 @@ [build-system] -# avoid 3.6 so we don't need the rust buildchain -requires = ["jupyter_packaging~=0.12", "jupyterlab>=3.0.0,<3.6", "setuptools>=40.8.0", "wheel"] +requires = ["jupyter_packaging~=0.12", "jupyterlab>=3.0.0,<3.6", "setuptools>=61.2", "wheel"] build-backend = "setuptools.build_meta" + +[project] +name = "ipyleaflet" +version = "0.17.3" +description = "A Jupyter widget for dynamic Leaflet maps" +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", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +requires-python = ">=3.7" +dependencies = [ + "ipywidgets>=7.6.0,<9", + "traittypes>=0.2.1,<3", + "xyzservices>=2021.8.1", + "branca>=0.5.0", +] + +[[project.authors]] +name = "Project Jupyter" +email = "jupyter@googlegroups.com" + +[project.license] +text = "MIT" + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/jupyter-widgets/ipyleaflet" + +[tool.setuptools] +include-package-data = true +license-files = ["LICENSE"] +packages = ["ipyleaflet"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0c9e0fc14..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = LICENSE diff --git a/setup.py b/setup.py index a17037ca6..606786c73 100644 --- a/setup.py +++ b/setup.py @@ -8,19 +8,14 @@ install_npm, ensure_targets, combine_commands, - get_version, - skip_if_exists + skip_if_exists, ) # the name of the package -name = 'ipyleaflet' long_description = 'A Jupyter widget for dynamic Leaflet maps' here = os.path.dirname(os.path.abspath(__file__)) -# Get ipyleaflet version -version = get_version(os.path.join(name, '_version.py')) - js_dir = os.path.join(here, 'js') # Representative files that should exist after a successful build @@ -46,39 +41,6 @@ else: cmdclass['jsdeps'] = skip_if_exists(jstargets, js_command) -setup_args = dict( - name=name, - version=version, - description='A Jupyter widget for dynamic Leaflet maps', - long_description=long_description, - license='MIT License', - python_requires = ">=3.7", - include_package_data=True, - install_requires=[ - 'ipywidgets>=7.6.0,<9', - 'traittypes>=0.2.1,<3', - 'xyzservices>=2021.8.1', - 'branca>=0.5.0' - ], - packages=find_packages(), - zip_safe=False, - cmdclass=cmdclass, - author='Project Jupyter', - author_email='jupyter@googlegroups.com', - url='https://github.com/jupyter-widgets/ipyleaflet', - 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', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10' - ], -) +setup_args = dict(cmdclass=cmdclass) setup(**setup_args) diff --git a/test.ipynb b/test.ipynb new file mode 100644 index 000000000..4e26a2998 --- /dev/null +++ b/test.ipynb @@ -0,0 +1,53 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1c9f4375f9804a1fa73c00758778779b", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[0.0, 0.0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_t…" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from ipyleaflet import Map \n", + "\n", + "Map()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.8" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} From 8d0dfbcf58c736bc6be5f667782d5a2ce53aa6f2 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Sun, 6 Aug 2023 12:43:20 +0000 Subject: [PATCH 2/3] refactor: update version parsing --- ipyleaflet/_version.py | 2 +- test.ipynb | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ipyleaflet/_version.py b/ipyleaflet/_version.py index 66502f308..57ad7c4f6 100644 --- a/ipyleaflet/_version.py +++ b/ipyleaflet/_version.py @@ -4,6 +4,6 @@ version_info = (0, 17, 3) -__version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) +__version__ = '.'.join(map(str, version_info)) EXTENSION_VERSION = '^0.17' diff --git a/test.ipynb b/test.ipynb index 4e26a2998..34ac3157d 100644 --- a/test.ipynb +++ b/test.ipynb @@ -26,6 +26,35 @@ "\n", "Map()" ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0.17.3'" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "version_info = (0, 17, 3)\n", + "\n", + "\".\".join(map(str, version_info))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From d222c25cf2c6d2664d9bace171ad34bb92372e7c Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Sun, 6 Aug 2023 13:23:25 +0000 Subject: [PATCH 3/3] refactor: start correct deprecation notices from jupyter_packaging --- setup.py | 39 ++++++++------------------ test.ipynb | 82 ------------------------------------------------------ 2 files changed, 12 insertions(+), 109 deletions(-) delete mode 100644 test.ipynb diff --git a/setup.py b/setup.py index 606786c73..378caf0a2 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,16 @@ -# -*- coding: utf-8 -*- +from pathlib import Path +from setuptools import setup -import os -from setuptools import setup, find_packages +from jupyter_packaging import * -from jupyter_packaging import ( - create_cmdclass, - install_npm, - ensure_targets, - combine_commands, - skip_if_exists, -) - -# the name of the package -long_description = 'A Jupyter widget for dynamic Leaflet maps' +ROOT = Path(__file__).parent -here = os.path.dirname(os.path.abspath(__file__)) - -js_dir = os.path.join(here, 'js') +js_dir = ROOT / 'js' # Representative files that should exist after a successful build jstargets = [ - os.path.join('ipyleaflet/nbextension', 'index.js'), - os.path.join('ipyleaflet/labextension', 'package.json'), + str(Path('ipyleaflet/nbextension')/'index.js'), + str(Path('ipyleaflet/labextension')/'package.json'), ] data_files_spec = [ @@ -32,15 +21,11 @@ cmdclass = create_cmdclass('jsdeps', data_files_spec=data_files_spec) js_command = combine_commands( - install_npm(js_dir, npm=["yarn"], build_cmd='build'), ensure_targets(jstargets), + install_npm(js_dir, npm=["yarn"], build_cmd='build'), + ensure_targets(jstargets), ) -is_repo = os.path.exists(os.path.join(here, '.git')) -if is_repo: - cmdclass['jsdeps'] = js_command -else: - cmdclass['jsdeps'] = skip_if_exists(jstargets, js_command) - -setup_args = dict(cmdclass=cmdclass) +is_repo = (ROOT / '.git').exists() +cmdclass['jsdeps'] = js_command if is_repo else skip_if_exists(jstargets, js_command) -setup(**setup_args) +setup(cmdclass=cmdclass) diff --git a/test.ipynb b/test.ipynb deleted file mode 100644 index 34ac3157d..000000000 --- a/test.ipynb +++ /dev/null @@ -1,82 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "1c9f4375f9804a1fa73c00758778779b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[0.0, 0.0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_t…" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from ipyleaflet import Map \n", - "\n", - "Map()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'0.17.3'" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "version_info = (0, 17, 3)\n", - "\n", - "\".\".join(map(str, version_info))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.8" - }, - "orig_nbformat": 4 - }, - "nbformat": 4, - "nbformat_minor": 2 -}