nbclassic icon indicating copy to clipboard operation
nbclassic copied to clipboard

Disutils is deprecated in Python 3.12

Open Zsailer opened this issue 1 year ago • 5 comments

See https://docs.python.org/3.10/whatsnew/3.10.html#distutils

nbclassic depends on distutils to build: https://github.com/jupyter/nbclassic/blob/9ae4cb137ea46c9a29cdcf56032dae624f6ff8d8/setup.py#L72-L97

This means, in Python 3.13 (released last week), using the setup.py to build nbclassic will fail.

Can we try:

  • adding Python 3.13 to our test matrix,
  • removing the distutils portion...and possibly replace the setup.py(?) for pyproject.toml?

Zsailer avatar Oct 10 '24 15:10 Zsailer

Hi @RRosio, I would like to start to get involved in some Jupyter work, would this be a good one to take on?

danyeaw avatar Jan 16 '25 18:01 danyeaw

Hi @danyeaw thank you for your interest in taking this on! That would be great! I think this is an important issue for NBClassic, especially with pip 25.1 on the horizon.

I'd be happy to assist with anything you need, whether that is testing, review or if this ends up being a series of changes, I'd be happy to help out with those along the way!

RRosio avatar Jan 17 '25 16:01 RRosio

I'm thinking we can do this in a few steps:

  • [x] Migrate from Distutils to Setuptools using the guide here: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
  • [x] Migrate from setup.py to pyproject.toml using the similar build backend (hatch) as notebook
  • [x] Investigate Hatch build performance, referencing some of the options here: https://hatch.pypa.io/1.9/config/build/#performance
  • [x] Maybe optionally, modernize / commonize the JS build setup from Bower to Yarn, npm, pnpm, or Lerna. Bower is no longer actively developed. It looks like notebook is using Lerna which could help keep things common. I think npm is probably the conservative / boring choice, but I'm less experienced with the JS side of building.

danyeaw avatar Jan 21 '25 19:01 danyeaw

I started looking at his a bit today.

hatch-jupyter-builder can do a lot of the migration automatically from setup.py to pyproject.toml. However, our setup.py has custom setup.py js css commands for our build system that are located in the setupbase module.

It looks like to get rid of those, we could move them in to npm scripts as a build tool. So to build the notebook app, we could run node tools/build-main.js notebook which is defined in a script in the package.json.

danyeaw avatar Jan 27 '25 15:01 danyeaw

I opened a pull request yesterday to migrate to using pyproject.toml. I would appreciate a review when you get a chance. Thanks!

danyeaw avatar Jan 29 '25 13:01 danyeaw

I think this is now complete with #310, #315, and #323 merged.

danyeaw avatar Apr 16 '25 17:04 danyeaw

Thank you Dan! I will go ahead and close this.

RRosio avatar Apr 24 '25 16:04 RRosio