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

Disutils is deprecated in Python 3.12 #307

Open
Zsailer opened this issue Oct 10, 2024 · 5 comments
Open

Disutils is deprecated in Python 3.12 #307

Zsailer opened this issue Oct 10, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@Zsailer
Copy link
Member

Zsailer commented Oct 10, 2024

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

nbclassic depends on distutils to build:

nbclassic/setup.py

Lines 72 to 97 in 9ae4cb1

from distutils.command.build_py import build_py
from distutils.command.sdist import sdist
from setuptools.command.bdist_egg import bdist_egg
from setuptools.command.develop import develop
class bdist_egg_disabled(bdist_egg):
"""Disabled version of bdist_egg
Prevents setup.py install from performing setuptools' default easy_install,
which it should never ever do.
"""
def run(self):
sys.exit("Aborting implicit building of eggs. Use `pip install .` to install from source.")
setup_args['cmdclass'] = {
'build_py': css_js_prerelease(
check_package_data_first(build_py)),
'sdist' : css_js_prerelease(sdist, strict=True),
'develop': css_js_prerelease(develop),
'css' : CompileCSS,
'backendtranslations': CompileBackendTranslation,
'js' : CompileJS,
'jsdeps' : Bower,
'jsversion' : JavascriptVersion,
'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
}

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?
@danyeaw
Copy link
Contributor

danyeaw commented Jan 16, 2025

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

@RRosio
Copy link
Collaborator

RRosio commented Jan 17, 2025

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!

@danyeaw
Copy link
Contributor

danyeaw commented Jan 21, 2025

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

  • Migrate from Distutils to Setuptools using the guide here: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
  • Maybe optionally, migrate from setup.py to pyproject.toml using the similar build backend (hatch) as notebook
  • 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
Copy link
Contributor

danyeaw commented Jan 27, 2025

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
Copy link
Contributor

danyeaw commented Jan 29, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants