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

Switch to hatch build backend #1669

Merged
merged 6 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions MANIFEST.in

This file was deleted.

18 changes: 18 additions & 0 deletions buildapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

# Custom build target that bails if NBGRADER_NO_LAB is set
import glob
import json
import os
import subprocess

from hatch_jupyter_builder import npm_builder


def builder(target_name, version, *args, **kwargs):

if os.getenv("NBGRADER_NO_LAB"):
return

npm_builder(target_name, version, *args, **kwargs)
21 changes: 4 additions & 17 deletions nbgrader/docs/source/contributor_guide/installation_developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,11 @@ We recommand using `conda environment <https://docs.conda.io/en/latest/miniconda
Installing Jupyter labextensions
--------------------------------
The labextensions are compiled during installation, and should be in the ``nbgrader/labextension`` directory.
There are 5 of them (*formgrader*, *assignment list*, *course list*, *validate assignment* and *create assignment*),
and with the exception of *create assignment* they must be installed along with the server extensions.
There are 5 of them (*formgrader*, *assignment list*, *course list*, *validate assignment* and *create assignment*).

To install the server extensions all together run::
All of the labextensions and server extensions are automatically installed and
enabled when installing ``nbgrader``.

jupyter server extension enable nbgrader --sys-prefix

It is possible to enable only some of them by running::

jupyter server extension enable nbgrader.server_extensions.formgrader --sys-prefix
jupyter server extension enable nbgrader.server_extensions.assignment_list --sys-prefix
jupyter server extension enable nbgrader.server_extensions.course_list --sys-prefix
jupyter server extension enable nbgrader.server_extensions.validate_assignment --sys-prefix

To install labextensions run::

jupyter labextension install .

or in developer mode::
To install lab extension in developer mode::

jupyter labextension develop --overwrite .
2 changes: 1 addition & 1 deletion nbgrader/tests/labextension_ui-tests/run_jupyter_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
join(root_dir, "nbgrader_config.py"))

subprocess.check_call([sys.executable, "-m", "jupyter", "server", "extension", "enable", "--user", "--py", "nbgrader"], env=env)
subprocess.check_call([sys.executable, "-m", "jupyter", "labextension", "develop", "."])
subprocess.check_call([sys.executable, "-m", "jupyter", "labextension", "develop", "--overwrite", "."])

os.chdir(root_dir)

Expand Down
170 changes: 152 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,159 @@
[build-system]
requires = ["jupyter_packaging~=0.12.0", "jupyterlab<4"]
build-backend = "jupyter_packaging.build_api"

[tool.jupyter-packaging.options]
skip-if-exists = ["nbgrader/labextension/static/style.js"]
ensured-targets = ["nbgrader/labextension/static/style.js", "nbgrader/labextension/package.json"]

[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
requires = [
"hatchling>=1.10.0",
"jupyterlab<4",
]
build-backend = "hatchling.build"

[project]
name = "nbgrader"
description = "A system for assigning and grading notebooks"
readme = "README.md"
requires-python = ">=3.7"
authors = [
{ name = "Jupyter Development Team", email = "jupyter@googlegroups.com" },
]
keywords = [
"Grading",
"Homework",
"Jupyter",
"JupyterLab",
"Notebooks",
]
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
]
dependencies = [
"alembic>=1.7",
"ipywidgets>=7.6",
"Jinja2>=3",
"jsonschema>=3",
"jupyter_client<8",
"jupyter_server>=1.12",
"jupyterlab<4",
"jupyterlab_server",
"MarkupSafe<2.2.0",
"nbclassic<0.4.0",
"nbclient>=0.6.1",
"nbconvert>=6",
"notebook>=6.4,<7",
"python-dateutil>=2.8",
"rapidfuzz>=1.8",
"requests>=2.26",
"sqlalchemy>=1.4,<2",
"traitlets<5.2.0",
]
version = "0.8.0"

[project.license]
file = "LICENSE"

[project.optional-dependencies]
dev = [
"tbump",
"toml",
]
docs = [
"myst-parser",
"sphinx",
"sphinx-autodoc-typehints",
"sphinx_rtd_theme",
]
tests = [
"codecov",
"coverage",
"jupyter_packaging",
"nbval",
"pytest-cov",
"pytest-rerunfailures",
"pytest-tornasync",
"pytest-xdist==2.5.0",
"pytest==7.1.2",
"requests-mock",
"selenium>2.4,<4.3",
"wheel",
]

[project.scripts]
nbgrader = "nbgrader.apps.nbgraderapp:main"

[project.urls]
Homepage = "https://github.com/jupyter/nbgrader"

[tool.hatch.build]
artifacts = [
"nbgrader/labextension/",
"nbgrader/tests/",
"nbgrader/docs/",
"nbgrader/server_extensions/",
]

[tool.hatch.build.targets.sdist]
include = [
"/etc",
"/nbgrader",
"/schema",
"/src",
"/style",
"/*.*"
]
exclude = [
"/.github",
]

[tool.hatch.build.targets.wheel.shared-data]
"etc/jupyter/jupyter_server_config.d" = "etc/jupyter/jupyter_server_config.d"
"etc/jupyter/jupyter_notebook_config.json" = "etc/jupyter/jupyter_notebook_config.json"
"nbgrader/labextension/static" = "share/jupyter/labextensions/nbgrader/static"
"install.json" = "share/jupyter/labextensions/nbgrader/install.json"
"nbgrader/labextension/package.json" = "share/jupyter/labextensions/nbgrader/package.json"
"nbgrader/labextension/schemas/nbgrader" = "share/jupyter/labextensions/nbgrader/schemas/nbgrader"

[tool.hatch.build.hooks.jupyter-builder]
dependencies = [
"hatch-jupyter-builder>=0.6.2",
]
build-function = "buildapi.builder"
ensured-targets = [
"nbgrader/labextension/static/style.js",
"nbgrader/labextension/package.json",
]
skip-if-exists = [
"nbgrader/labextension/static/style.js",
]

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
build_dir = "nbgrader/labextension"
source_dir = "src"
build_cmd = "install:labextension"
npm = [
"jlpm",
]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
npm = ["jlpm"]

[tool.check-manifest]
ignore = ["nbgrader/labextension/**", "yarn.lock"]
npm = [
"jlpm",
]

[tool.jupyter-releaser.hooks]
after-bump-version = ["python tools/post-bump.py"]
before-build-npm = ["python -m pip install 'jupyterlab<4'", "jlpm"]
before-build-python = ["jlpm clean:all"]
after-bump-version = [
"python tools/post-bump.py",
]
before-build-npm = [
"python -m pip install 'jupyterlab<4'",
"jlpm",
]
before-build-python = [
"jlpm clean:all",
]

[tool.tbump.version]
current = "0.8.0"
Expand Down
73 changes: 0 additions & 73 deletions setup.cfg

This file was deleted.

Loading