Skip to content

Commit

Permalink
Use jupyter-packaging for npm build
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Sep 1, 2021
1 parent 4ffd009 commit bcf9873
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jupyter_packaging>=0.10
six
pytest
pytest-cov
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = [
"build",
"jupyter_packaging>=0.10",
"setuptools",
]
build-backend = "setuptools.build_meta"
20 changes: 16 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
from jupyter_packaging import wrap_installers, npm_builder
from setuptools import find_packages, setup
from distutils.util import convert_path
import subprocess
import os.path

HERE = os.path.abspath(os.path.dirname(__file__))

# Representative files that should exist after a successful build
jstargets = [
os.path.join(HERE, "nbgitpuller", "static", "dist", "bundle.js"),
]

# https://github.com/jupyter/jupyter-packaging/blob/0.10.4/README.md#as-a-build-requirement
jsdeps = npm_builder(build_cmd="webpack")
cmdclass = wrap_installers(
pre_develop=jsdeps, pre_dist=jsdeps,
ensured_targets=jstargets, skip_if_exists=jstargets)

# Imports __version__, reference: https://stackoverflow.com/a/24517154/2220152
ns = {}
Expand All @@ -9,16 +23,14 @@
exec(ver_file.read(), ns)
__version__ = ns['__version__']

subprocess.check_call(['npm', 'install'])
subprocess.check_call(['npm', 'run', 'webpack'])

setup(
name='nbgitpuller',
version=__version__,
url='https://github.com/jupyterhub/nbgitpuller',
license='3-clause BSD',
author='Peter Veerman, YuviPanda',
author_email='[email protected]',
cmdclass=cmdclass,
description='Notebook Extension to do one-way synchronization of git repositories',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
Expand Down

0 comments on commit bcf9873

Please sign in to comment.