-
-
Notifications
You must be signed in to change notification settings - Fork 69
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 to hatch #217
Migrate to hatch #217
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,32 +1,107 @@ | ||||
[build-system] | ||||
requires = [ | ||||
"jupyter_packaging~=0.12,<2", | ||||
"jupyterlab==4.0.0" | ||||
"hatchling", | ||||
"jupyterlab==4.0.0", | ||||
] | ||||
build-backend = "jupyter_packaging.build_api" | ||||
build-backend = "hatchling.build" | ||||
|
||||
[tool.jupyter-packaging.options] | ||||
skip-if-exists = [ | ||||
"jupyterlab_latex/labextension/static/style.js" | ||||
[project] | ||||
name = "jupyterlab-latex" | ||||
description = "JupyterLab extension for running LaTeX" | ||||
readme = "README.md" | ||||
requires-python = ">=3.8" | ||||
authors = [ | ||||
{ name = "Jupyter Development Team", email = "[email protected]" }, | ||||
] | ||||
keywords = [ | ||||
"Jupyter", | ||||
"JupyterLab", | ||||
"LaTeX", | ||||
] | ||||
classifiers = [ | ||||
"Framework :: Jupyter", | ||||
"Intended Audience :: Developers", | ||||
"Intended Audience :: Science/Research", | ||||
"Intended Audience :: System Administrators", | ||||
"License :: OSI Approved :: BSD License", | ||||
"Programming Language :: Python", | ||||
"Programming Language :: Python :: 3", | ||||
"Programming Language :: Python :: 3.8", | ||||
"Programming Language :: Python :: 3.9", | ||||
"Programming Language :: Python :: 3.10", | ||||
"Programming Language :: Python :: 3.11", | ||||
] | ||||
dependencies = [ | ||||
"jupyter_server>=2,<3", | ||||
"jupyterlab>=4,<5", | ||||
] | ||||
version = "4.0.0" | ||||
|
||||
[project.license] | ||||
file = "LICENSE" | ||||
|
||||
[project.urls] | ||||
Homepage = "https://github.com/jupyterlab/jupyterlab-latex" | ||||
|
||||
[tool.hatch.build.targets.wheel.shared-data] | ||||
"jupyterlab_latex/labextension/static" = "share/jupyter/labextensions/@jupyterlab/latex/static" | ||||
"install.json" = "share/jupyter/labextensions/@jupyterlab/latex/install.json" | ||||
"jupyterlab_latex/labextension/build_log.json" = "share/jupyter/labextensions/@jupyterlab/latex/build_log.json" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not check for this log file.
Suggested change
|
||||
"jupyterlab_latex/labextension/package.json" = "share/jupyter/labextensions/@jupyterlab/latex/package.json" | ||||
"jupyterlab_latex/labextension/schemas/@jupyterlab/latex" = "share/jupyter/labextensions/@jupyterlab/latex/schemas/@jupyterlab/latex" | ||||
"jupyter-config/server-config" = "etc/jupyter/jupyter_server_config.d" | ||||
"jupyter-config/nb-config" = "etc/jupyter/jupyter_notebook_config.d" | ||||
|
||||
[tool.hatch.build.targets.sdist] | ||||
exclude = [ | ||||
".github", | ||||
] | ||||
|
||||
[tool.hatch.build.hooks.jupyter-builder] | ||||
dependencies = [ | ||||
"hatch-jupyter-builder>=0.8.3", | ||||
] | ||||
build-function = "hatch_jupyter_builder.npm_builder" | ||||
ensured-targets = [ | ||||
"jupyterlab_latex/labextension/package.json", | ||||
"jupyterlab_latex/labextension/static/style.js", | ||||
"jupyterlab_latex/labextension/static/style.js", | ||||
] | ||||
skip-if-exists = [ | ||||
"jupyterlab_latex/labextension/static/style.js", | ||||
] | ||||
|
||||
[tool.jupyter-packaging.builder] | ||||
factory = "jupyter_packaging.npm_builder" | ||||
[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs] | ||||
build_dir = "jupyterlab_latex/labextension" | ||||
source_dir = "src" | ||||
build_cmd = "install:extension" | ||||
npm = [ | ||||
"jlpm", | ||||
] | ||||
|
||||
[tool.jupyter-packaging.build-args] | ||||
[tool.hatch.build.hooks.jupyter-builder.build-kwargs] | ||||
build_cmd = "build:prod" | ||||
npm = [ | ||||
"jlpm" | ||||
"jlpm", | ||||
] | ||||
|
||||
[tool.check-manifest] | ||||
ignore = [ | ||||
".*", | ||||
"jupyterlab_latex/labextension/**", | ||||
"package-lock.json", | ||||
"yarn.lock" | ||||
[tool.tbump] | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you switch to the new extension template, this will switch to using hatch directly aligning NPM and Python package version using: https://github.com/agoose77/hatch-nodejs-version |
||||
field = [ | ||||
{ name = "channel", default = "" }, | ||||
{ name = "release", default = "" }, | ||||
] | ||||
|
||||
[tool.tbump.version] | ||||
current = "4.0.0" | ||||
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?" | ||||
|
||||
[tool.tbump.git] | ||||
message_template = "Bump to {new_version}" | ||||
tag_template = "v{new_version}" | ||||
|
||||
[[tool.tbump.file]] | ||||
src = "pyproject.toml" | ||||
version_template = "version = \"{major}.{minor}.{patch}{channel}{release}\"" | ||||
|
||||
[[tool.tbump.file]] | ||||
src = "package.json" | ||||
version_template = "\"version\": \"{major}.{minor}.{patch}{channel}{release}\"" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,2 @@ | ||
""" | ||
Setup module for the jupyterlab-latex | ||
""" | ||
import json | ||
from pathlib import Path | ||
|
||
import setuptools | ||
try: | ||
from jupyter_packaging import ( | ||
wrap_installers, | ||
npm_builder, | ||
get_data_files | ||
) | ||
try: | ||
import jupyterlab | ||
except ImportError as e: | ||
print("`jupyterlab` is missing. Install it with pip or conda.") | ||
raise e | ||
except ImportError as e: | ||
print("`jupyter-packaging` is missing. Install it with pip or conda.") | ||
raise e | ||
|
||
HERE = Path(__file__).parent.resolve() | ||
|
||
# The name of the project | ||
name = "jupyterlab_latex" | ||
|
||
lab_path = (HERE / name.replace("-", "_") / "labextension") | ||
|
||
# Representative files that should exist after a successful build | ||
ensured_targets = [ | ||
str(lab_path / "package.json"), | ||
str(lab_path / "static/style.js") | ||
] | ||
|
||
labext_name = "@jupyterlab/latex" | ||
|
||
data_files_spec = [ | ||
("share/jupyter/labextensions/%s" % labext_name, str(lab_path.relative_to(HERE)), "**"), | ||
("share/jupyter/labextensions/%s" % labext_name, str('.'), "install.json"),("etc/jupyter/jupyter_server_config.d", | ||
"jupyter-config/server-config", "jupyterlab_latex.json"), | ||
# For backward compatibility with notebook server | ||
("etc/jupyter/jupyter_notebook_config.d", | ||
"jupyter-config/nb-config", "jupyterlab_latex.json"), | ||
|
||
] | ||
|
||
long_description = (HERE / "README.md").read_text() | ||
|
||
# Get the package info from package.json | ||
pkg_json = json.loads((HERE / "package.json").read_bytes()) | ||
|
||
post_develop = npm_builder( | ||
build_cmd="install:extension", source_dir="src", build_dir=lab_path | ||
) | ||
|
||
setup_dict = dict( | ||
name=name, | ||
version=pkg_json["version"], | ||
description=pkg_json["description"], | ||
packages=setuptools.find_packages(), | ||
data_files=get_data_files(data_files_spec), | ||
author=pkg_json["author"]["name"], | ||
author_email=pkg_json["author"]["email"], | ||
url=pkg_json["homepage"], | ||
license=pkg_json["license"], | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
zip_safe=False, | ||
include_package_data=True, | ||
keywords= ['Jupyter', 'JupyterLab', 'LaTeX'], | ||
python_requires = '>=3.8', | ||
classifiers = [ | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: System Administrators', | ||
'Intended Audience :: Science/Research', | ||
'License :: OSI Approved :: BSD License', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Framework :: Jupyter', | ||
], | ||
install_requires=[ | ||
'jupyterlab>=4,<5', | ||
'jupyter_server>=2,<3' | ||
], | ||
cmdclass=wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets) | ||
) | ||
|
||
if __name__ == "__main__": | ||
setuptools.setup(**setup_dict) | ||
# setup.py shim for use with applications that require it. | ||
__import__("setuptools").setup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would drop the dependency on JupyterLab itself (except if you call a specific endpoint). This will allow to install this extension in Notebook v7 without installing JupyterLab as I guess this extension does not depend directly on the JupyterLab layout.