Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from setup.py to pyproject.toml #315

Merged
merged 10 commits into from
Jan 30, 2025
Merged

Conversation

danyeaw
Copy link
Contributor

@danyeaw danyeaw commented Jan 27, 2025

This PR is part of #307 to replace the setup.py with a pyproject.toml.

  • Initial update was automated using https://github.com/jupyterlab/hatch-jupyter-builder
  • JavaScript and CSS Python build scripts were migrated to npm scripts in the package.json
  • Artifact collection Python scripts were changed to a list of globbed artifacts in the pyproject.toml
  • Updates the minimum Python to 3.8 to be compatible with hatch-jupyter-builder

Since I have never done a release with Jupyter Releaser, I could use some guidance on how to test this.

I used wheeldiff to compare the wheels created by the setup.py build and this new one. Both wheels are 25.6MB:

Only in ../nbclassic-original/dist/nbclassic-1.3.0.dev0-py3-none-any.whl: nbclassic-$VERSION/nbclassic-$VERSION.dist-info/top_level.txt
Only in dist/nbclassic-1.3.0.dev0-py3-none-any.whl: nbclassic-$VERSION/nbclassic-$VERSION.dist-info/licenses
--- ../nbclassic-original/dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/METADATA
+++ dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/METADATA
@@ -1,18 +1,43 @@
-Metadata-Version: 2.2
+Metadata-Version: 2.4
 Name: nbclassic
 Version: 1.3.0.dev0
 Summary: Jupyter Notebook as a Jupyter Server extension.
-Home-page: https://github.com/jupyter/nbclassic
-Author: Jupyter Development Team
-Author-email: [email protected]
-License: BSD-3-Clause
-Keywords: ipython,jupyter,interactive,interpreter,shell,web
-Platform: Linux
-Platform: Mac OS X
-Platform: Windows
+Project-URL: Homepage, https://github.com/jupyter/nbclassic
+Author-email: Jupyter Development Team <[email protected]>
+License: BSD 3-Clause License
+        
+        Copyright (c) 2020 Project Jupyter Contributors
+        All rights reserved.
+        
+        Redistribution and use in source and binary forms, with or without
+        modification, are permitted provided that the following conditions are met:
+        
+        1. Redistributions of source code must retain the above copyright notice, this
+           list of conditions and the following disclaimer.
+        
+        2. Redistributions in binary form must reproduce the above copyright notice,
+           this list of conditions and the following disclaimer in the documentation
+           and/or other materials provided with the distribution.
+        
+        3. Neither the name of the copyright holder nor the names of its
+           contributors may be used to endorse or promote products derived from
+           this software without specific prior written permission.
+        
+        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+License-File: LICENSE
+Keywords: interactive,interpreter,ipython,jupyter,shell,web
 Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Science/Research
 Classifier: Intended Audience :: System Administrators
-Classifier: Intended Audience :: Science/Research
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3.7
@@ -20,31 +45,30 @@
 Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: 3.10
 Requires-Python: >=3.7
+Requires-Dist: ipykernel
+Requires-Dist: ipython-genutils
+Requires-Dist: nest-asyncio>=1.5
+Requires-Dist: notebook-shim>=0.2.3
+Provides-Extra: docs
+Requires-Dist: myst-parser; extra == 'docs'
+Requires-Dist: nbsphinx; extra == 'docs'
+Requires-Dist: sphinx; extra == 'docs'
+Requires-Dist: sphinx-rtd-theme; extra == 'docs'
+Requires-Dist: sphinxcontrib-github-alt; extra == 'docs'
+Provides-Extra: json-logging
+Requires-Dist: json-logging; extra == 'json-logging'
+Provides-Extra: test
+Requires-Dist: coverage; extra == 'test'
+Requires-Dist: nbval; extra == 'test'
+Requires-Dist: pytest; extra == 'test'
+Requires-Dist: pytest-cov; extra == 'test'
+Requires-Dist: pytest-jupyter; extra == 'test'
+Requires-Dist: pytest-playwright; extra == 'test'
+Requires-Dist: pytest-tornasync; extra == 'test'
+Requires-Dist: requests; extra == 'test'
+Requires-Dist: requests-unixsocket; (sys_platform != 'win32') and extra == 'test'
+Requires-Dist: testpath; extra == 'test'
 Description-Content-Type: text/markdown
-License-File: LICENSE
-Requires-Dist: ipython_genutils
-Requires-Dist: notebook_shim>=0.2.3
-Requires-Dist: nest-asyncio>=1.5
-Requires-Dist: ipykernel
-Provides-Extra: test
-Requires-Dist: pytest; extra == "test"
-Requires-Dist: coverage; extra == "test"
-Requires-Dist: requests; extra == "test"
-Requires-Dist: testpath; extra == "test"
-Requires-Dist: nbval; extra == "test"
-Requires-Dist: pytest-playwright; extra == "test"
-Requires-Dist: pytest-cov; extra == "test"
-Requires-Dist: pytest_jupyter; extra == "test"
-Requires-Dist: pytest_tornasync; extra == "test"
-Requires-Dist: requests-unixsocket; sys_platform != "win32" and extra == "test"
-Provides-Extra: docs
-Requires-Dist: sphinx; extra == "docs"
-Requires-Dist: nbsphinx; extra == "docs"
-Requires-Dist: sphinxcontrib_github_alt; extra == "docs"
-Requires-Dist: sphinx_rtd_theme; extra == "docs"
-Requires-Dist: myst-parser; extra == "docs"
-Provides-Extra: json-logging
-Requires-Dist: json-logging; extra == "json-logging"
 
 # The Classic Jupyter Notebook as a Jupyter Server Extension
 
--- ../nbclassic-original/dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/RECORD
+++ dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/RECORD
@@ -1,7 +1,7 @@
 nbclassic/__init__.py,sha256=egK0mfEoAAvN3teCx7P3iiXBortlQRAzb-L-hrgN_5k,2641
 nbclassic/__main__.py,sha256=9Mf6rSJYixdHtPfnR9KQeQiCGSEkQi5jtr7C0tqAwxI,69
 nbclassic/_sysinfo.py,sha256=JYNkaMv9zdgtw9jN6o9X4KD6Jc1d8jgtugm-vklPTx8,2554
-nbclassic/_version.py,sha256=2owoa7ps5MW5vYzn2mKDDEf3UGnebaqL1P-M8aD7Jkg,678
+nbclassic/_version.py,sha256=15_tdd6Ibru4rwrNP4xmCMOW0q59PZNPJRuWbILNaLw,671
 nbclassic/config_manager.py,sha256=3E0nvNuNCVCS3q3Fpc2uJMIznV8hDmq32fsBYDKWHag,4564
 nbclassic/extensions.py,sha256=DIQBf4h16RX-SQM36eZmMpnqloa67gTM-K-9NQMqDdE,3348
 nbclassic/jstest.py,sha256=qez59rnjuPrQvsaVkdRk59XfXqOhazIKqqLfR7tHaEE,20559
@@ -30414,7 +30414,7 @@
 nbclassic/static/components/requirejs-text/bower.json,sha256=ZjPJN3q-S5sRgOgnbCylg3A1cuzeaWZnnJwLuXM7uEM,84
 nbclassic/static/components/requirejs-text/package.json,sha256=c1fg46AzPMEFqSGFRidNVHva2rJyMp3Ym7wH_akJjbE,545
 nbclassic/static/components/requirejs-text/text.js,sha256=C-r8VH3__WVJEluZWTpIRL4PhkRkPdTfHyxiEVFf3d4,16400
-nbclassic/static/components/sanitizer/index.js,sha256=T7vMciDmMEJcEZzrRxlLA7pqlRuSpHmWCSo3uNjAuKI,764512
+nbclassic/static/components/sanitizer/index.js,sha256=4k9kojzDX_Y136e9c1sqx7M7e3BzM3E9QJAOKmCT938,764500
 nbclassic/static/components/text-encoding/.bower.json,sha256=Yvlsp3j49ldecQWYg0N9DtNqhKARRKzLN3DhJjLzJiE,770
 nbclassic/static/components/text-encoding/LICENSE.md,sha256=L_NzuIOTyKDXraIEI1f1tOxpUzqwIC71sy7-7FqYVXc,11358
 nbclassic/static/components/text-encoding/README.md,sha256=nR_ogqbSegtc-gqyYHBmlgfcSiVGJyd_rawfDbl9bh4,2872
@@ -30462,8 +30462,8 @@
 nbclassic/static/notebook/js/kernelselector.js,sha256=EgsLnxsz4fD2MpXgSq0AKjsf1QKg4GP8cdxbzwMvPzI,13650
 nbclassic/static/notebook/js/keyboardmanager.js,sha256=-fVOAmf--KCRt9AmjrDpLk2vzM1hB-pIBoW__D_H2s8,10513
 nbclassic/static/notebook/js/main.js,sha256=H6G8IgAD7kw3-hztEtZYdYjiU1To4JItXggn_PeQ7Rw,7893
-nbclassic/static/notebook/js/main.min.js,sha256=QaZbg9gySIIaw6vIKChfXptgbIH7fVcOdW0s1h8RVmo,3201808
-nbclassic/static/notebook/js/main.min.js.map,sha256=JWn1n_rb27tKQsZ3zq4iOWjha6kmLrVAdK6Lrx2YjZw,3699752
+nbclassic/static/notebook/js/main.min.js,sha256=60ydwq3je0M3hgeVjiNbIsuJsYcr6RDfx_2strc6MAg,3201796
+nbclassic/static/notebook/js/main.min.js.map,sha256=kRhJb5ozmW7w0DcLQ_xmMnl8-Ax9xaEVqkD_U0dTYuo,3699740
 nbclassic/static/notebook/js/maintoolbar.js,sha256=E6YdMArqzmTRsPTH5ws08bTP-gxcGxy_1ijHXAcHL84,4632
 nbclassic/static/notebook/js/mathjaxutils.js,sha256=n8xUp2mSSOMdu7KrQw85VcBZLQdTbSv8SGHaAApHeDc,112
 nbclassic/static/notebook/js/menubar.js,sha256=nrnRk44V1svljlECWvgoGAMs3-kfSzkNx0AVyEeFolw,18402
@@ -30523,10 +30523,10 @@
 nbclassic/static/services/sessions/session.js,sha256=mroTADVnUvnLS2UURTt3OxUm2mljnvk0HRs7pBZMdjs,10586
 nbclassic/static/style/ipython.less,sha256=y151vxLGvBETIFYQYnD9I1rMJVONSdDqa3BAg1hzGcQ,367
 nbclassic/static/style/ipython.min.css,sha256=_72hdIP_Maxh2XqKTEN2vueXscpL0UoVZy4rajS-lY4,29412
-nbclassic/static/style/ipython.min.css.map,sha256=LMwWzL1G2ywKDpEM1LgBEfWOCNExZ_NhPhMgqOZMvhE,13173
+nbclassic/static/style/ipython.min.css.map,sha256=INo8gODFS6QxLVUxjZtWVJbkDm56ImgrxRLhUu7dgzM,13038
 nbclassic/static/style/style.less,sha256=ODUWac3wkod4YChz4-pRlyby07jaDdvEt1IEuFBtjLE,677
 nbclassic/static/style/style.min.css,sha256=35CMv9belho6hPqr8clqAaZantEgvBWXlysLlpDhhqc,266850
-nbclassic/static/style/style.min.css.map,sha256=-22XjrmmvSC5yIHeKqAgfl06bXuMTrSFjl0acZYlD9M,153918
+nbclassic/static/style/style.min.css.map,sha256=Ey3Ddc6yNJ5xxGrHkTziEO7q-1IcIakyIPrRu2m7Fw8,152874
 nbclassic/static/terminal/css/override.css,sha256=GkRFeAm-4MSPvZtKt1i_v6YzBg00DLurjm7Ba4zm4FE,310
 nbclassic/static/terminal/js/main.js,sha256=imb86FNRk36PuIylggVcXi_ZiiLj9UIEh_c-dVfeivc,2049
 nbclassic/static/terminal/js/main.min.js,sha256=XHNaDgelwPQtZhz2EYMeBFdKGX9ltVeNFiEV6Be2cC4,1468184
@@ -30620,12 +30620,11 @@
 nbclassic/tree/handlers.py,sha256=x-pT1fDIorV4uzqC5bc-_WZI95Mz1a8zWVwU3hPz0mQ,3455
 nbclassic/view/__init__.py,sha256=M6A91ZhEcWMzvHb4fN909ZjTNWXf9Hdjw7WmePzHcvY,46
 nbclassic/view/handlers.py,sha256=pvPpJPKMaOQYHo9k1dJh8lSmtUQ__TbZS7BOupl_cMs,1141
+nbclassic-1.3.0.dev0.data/data/share/applications/jupyter-nbclassic.desktop,sha256=FpC6jpXOGTpeDJSJOjJcce4s2HxCiNVnpqvIF_JyZ3E,246
 nbclassic-1.3.0.dev0.data/data/etc/jupyter/jupyter_server_config.d/nbclassic.json,sha256=bCdpys0Q4uWMFeSUeq2zpZ8UN9GfJvf73tbmhPj9-_c,101
-nbclassic-1.3.0.dev0.data/data/share/applications/jupyter-nbclassic.desktop,sha256=FpC6jpXOGTpeDJSJOjJcce4s2HxCiNVnpqvIF_JyZ3E,246
 nbclassic-1.3.0.dev0.data/data/share/icons/hicolor/scalable/apps/nbclassic.svg,sha256=ETQYUVVsEH_-RhIdGOVxtFShnli_0xKs06-0rzgS5wE,14487
-nbclassic-1.3.0.dev0.dist-info/LICENSE,sha256=G24jk4dg590AKF4s2fW382SexEXSQV2_cbTY_YWGz5g,1535
-nbclassic-1.3.0.dev0.dist-info/METADATA,sha256=_EJLQ8I848bv4Mhq5dG1JTK6QTEu3sVbzsi1ONlv5vQ,3611
-nbclassic-1.3.0.dev0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
+nbclassic-1.3.0.dev0.dist-info/METADATA,sha256=bdQlf2FDmhDFxBwKauXYtNGD6Lngt4fEfb3iXrlUcYg,5312
+nbclassic-1.3.0.dev0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
 nbclassic-1.3.0.dev0.dist-info/entry_points.txt,sha256=QLeFMijLT62tH-sN6Q87AOiArqje5kLtf2f5y_i4uxM,269
-nbclassic-1.3.0.dev0.dist-info/top_level.txt,sha256=brM-le3CjNVf6mSzHg97xupEEjynzPAddIel1KPBpJ0,10
+nbclassic-1.3.0.dev0.dist-info/licenses/LICENSE,sha256=G24jk4dg590AKF4s2fW382SexEXSQV2_cbTY_YWGz5g,1535
 nbclassic-1.3.0.dev0.dist-info/RECORD,,
--- ../nbclassic-original/dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/WHEEL
+++ dist/nbclassic-1.3.0.dev0-py3-none-any.whl/nbclassic-$VERSION/nbclassic-$VERSION.dist-info/WHEEL
@@ -1,5 +1,4 @@
 Wheel-Version: 1.0
-Generator: setuptools (75.8.0)
+Generator: hatchling 1.27.0
 Root-Is-Purelib: true
 Tag: py3-none-any
-

@danyeaw danyeaw force-pushed the remove-setuppy branch 2 times, most recently from 90252cf to f7e80f5 Compare January 28, 2025 14:20
@RRosio
Copy link
Collaborator

RRosio commented Jan 30, 2025

Hi @danyeaw, thank you for this PR! I took some time to look over the changes and tested it myself and everything was working well on my end. I will go ahead and merge this!

As a side note, I noticed a consistent increase in the build time, even after the initial editable install. This led me to look at hatch-jupyter-builder's HATCH_JUPYTER_BUILDER_SKIP_NPM=1 option to see if skipping npm run build might have helped, but I didn't notice much improvement. I'm wondering if it's worth looking into improving this, but I wanted to share this with you first and get your insight.

@RRosio RRosio merged commit dafc920 into jupyter:main Jan 30, 2025
31 of 32 checks passed
@danyeaw danyeaw deleted the remove-setuppy branch January 30, 2025 13:47
@danyeaw
Copy link
Contributor Author

danyeaw commented Jan 30, 2025

Hi @RRosio, thanks for reviewing, testing, and merging the PR! Great point on the performance. One thing that will slow things down a bit is the new npm scripts are not taking in to account whether a rebuild is needed based on timestamps, and it is just rebuilding everything. However, the building of the JavaScript, CSS, and translations takes less than 10 seconds on my MacBook. We could make this a bit smarter if we wanted.

I have a feeling that the performance issue is because Hatch is traversing all folders and files, and I noticed that there is an option around this here under a performance section:
https://hatch.pypa.io/1.9/config/build/#performance

I added this to the TODO list on the issue, and I'll investigate more if that is the cause and if we can tweak the settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants