Skip to content

Commit ccc5476

Browse files
authored
Merge pull request #705 from blink1073/use-flit
Switch to flit build backend
2 parents 6396793 + cf9dbdf commit ccc5476

File tree

11 files changed

+193
-1274
lines changed

11 files changed

+193
-1274
lines changed

.github/workflows/test.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ jobs:
113113
with:
114114
python-version: ${{ matrix.python }}
115115

116-
- name: Install Python dependencies
116+
- name: Install ipyparallel itself
117117
run: |
118118
pip install --upgrade pip
119-
pip install --pre --upgrade .[test] distributed joblib codecov
119+
pip install --no-deps .
120+
121+
- name: Install Python dependencies
122+
run: |
123+
pip install --pre --upgrade ipyparallel[test] distributed joblib codecov
120124
pip install --only-binary :all: matplotlib || echo "no matplotlib"
121125
122126
- name: Show environment

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ lib
3232
ipyparallel/labextension
3333
tsconfig.tsbuildinfo
3434
dask-worker-space
35+
jupyter-data/share

MANIFEST.in

-34
This file was deleted.

buildapi.py

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"""A build backend that handles installing the template files.
2+
3+
See https://peps.python.org/pep-0517/#in-tree-build-backends
4+
"""
5+
import glob
6+
import os
7+
import shutil
8+
import subprocess
9+
10+
from flit_core.buildapi import build_editable # noqa
11+
from flit_core.buildapi import build_sdist # noqa
12+
from flit_core.buildapi import build_wheel # noqa
13+
from flit_core.buildapi import (
14+
get_requires_for_build_editable as get_requires_for_build_editable_orig,
15+
)
16+
from flit_core.buildapi import (
17+
get_requires_for_build_sdist as get_requires_for_build_sdist_orig,
18+
)
19+
from flit_core.buildapi import (
20+
get_requires_for_build_wheel as get_requires_for_build_wheel_orig,
21+
)
22+
23+
osp = os.path
24+
here = osp.abspath(osp.dirname(__file__))
25+
share_dir = osp.join(here, "jupyter-data", "share", "jupyter")
26+
nbclassic_path = osp.join(share_dir, "nbextensions", "ipyparallel")
27+
lab_path = osp.join(share_dir, "labextensions", "ipyparallel-labextension")
28+
29+
30+
def _handle_labextension(cmd="build:prod"):
31+
if os.environ.get("IPP_DISABLE_JS") == "1":
32+
print("Skipping js installation")
33+
return
34+
35+
# this tells us if labextension is built at all, not if it's up-to-date
36+
labextension_built = glob.glob(os.path.join(lab_path, "*"))
37+
needs_js = True
38+
if not os.path.isdir(os.path.join(here, ".git")):
39+
print("Installing from a dist, not a repo")
40+
# not in a repo, probably installing from sdist
41+
# could be git-archive, though!
42+
# skip rebuilding js if it's already present
43+
if labextension_built:
44+
print(f"Not regenerating labextension in {lab_path}")
45+
needs_js = False
46+
47+
if needs_js:
48+
subprocess.check_call(['jlpm'], cwd=here)
49+
subprocess.check_call(['jlpm', 'run', cmd], cwd=here)
50+
51+
source = osp.join(here, 'ipyparallel', 'labextension')
52+
if labextension_built:
53+
shutil.rmtree(lab_path)
54+
shutil.copytree(source, lab_path)
55+
56+
57+
def _handle_nbextension():
58+
source = osp.join(here, 'ipyparallel', 'nbextension', 'static')
59+
if osp.exists(nbclassic_path):
60+
shutil.rmtree(nbclassic_path)
61+
shutil.copytree(source, nbclassic_path)
62+
63+
64+
def get_requires_for_build_wheel(config_settings=None):
65+
_handle_labextension()
66+
_handle_nbextension()
67+
return get_requires_for_build_wheel_orig(config_settings=config_settings)
68+
69+
70+
def get_requires_for_build_sdist(config_settings=None):
71+
_handle_labextension()
72+
_handle_nbextension()
73+
return get_requires_for_build_sdist_orig(config_settings=config_settings)
74+
75+
76+
def get_requires_for_build_editable(config_settings=None):
77+
_handle_labextension(cmd="build")
78+
_handle_nbextension()
79+
return get_requires_for_build_editable_orig(config_settings=config_settings)

pyproject.toml

+107-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,114 @@
11
[build-system]
22
requires = [
33
"jupyterlab>=3.0.0,==3.*",
4-
"packaging",
5-
"setuptools>=40.8.0",
6-
"wheel",
4+
"flit_core >=3.2,<4"
75
]
8-
build-backend = "setuptools.build_meta"
6+
build-backend = "buildapi"
7+
backend-path = ["."]
8+
9+
[project]
10+
name = "ipyparallel"
11+
authors = [{name = "IPython Development Team", email = "[email protected]"}]
12+
license = {file = "COPYING.md"}
13+
readme = "README.md"
14+
description = "Interactive Parallel Computing with IPython"
15+
keywords = [
16+
"Interactive",
17+
"Interpreter",
18+
"Shell",
19+
"Parallel",
20+
]
21+
classifiers = [
22+
"Framework :: Jupyter",
23+
"Framework :: Jupyter :: JupyterLab",
24+
"Framework :: Jupyter :: JupyterLab :: 3",
25+
"Framework :: Jupyter :: JupyterLab :: Extensions",
26+
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
27+
"Intended Audience :: Developers",
28+
"Intended Audience :: System Administrators",
29+
"Intended Audience :: Science/Research",
30+
"License :: OSI Approved :: BSD License",
31+
"Programming Language :: Python",
32+
"Programming Language :: Python :: 3.7",
33+
"Programming Language :: Python :: 3.8",
34+
"Programming Language :: Python :: 3.9",
35+
]
36+
urls = {Homepage = "https://ipython.org"}
37+
requires-python = ">=3.7"
38+
dependencies = [
39+
"entrypoints",
40+
"decorator",
41+
"pyzmq>=18",
42+
"traitlets>=4.3",
43+
"ipython>=4",
44+
"jupyter_client",
45+
"ipykernel>=4.4",
46+
"tornado>=5.1",
47+
"psutil",
48+
"python-dateutil>=2.1",
49+
"tqdm",
50+
]
51+
dynamic = ["version"]
52+
53+
[project.entry-points."ipyparallel.controller_launchers"]
54+
batch = "ipyparallel.cluster.launcher:BatchControllerLauncher"
55+
htcondor = "ipyparallel.cluster.launcher:HTCondorControllerLauncher"
56+
local = "ipyparallel.cluster.launcher:LocalControllerLauncher"
57+
lsf = "ipyparallel.cluster.launcher:LSFControllerLauncher"
58+
mpi = "ipyparallel.cluster.launcher:MPIControllerLauncher"
59+
pbs = "ipyparallel.cluster.launcher:PBSControllerLauncher"
60+
sge = "ipyparallel.cluster.launcher:SGEControllerLauncher"
61+
ssh = "ipyparallel.cluster.launcher:SSHControllerLauncher"
62+
slurm = "ipyparallel.cluster.launcher:SlurmControllerLauncher"
63+
winhpc = "ipyparallel.cluster.launcher:WindowsHPCControllerLauncher"
64+
65+
[project.entry-points."ipyparallel.engine_launchers"]
66+
batch = "ipyparallel.cluster.launcher:BatchEngineSetLauncher"
67+
htcondor = "ipyparallel.cluster.launcher:HTCondorEngineSetLauncher"
68+
local = "ipyparallel.cluster.launcher:LocalEngineSetLauncher"
69+
lsf = "ipyparallel.cluster.launcher:LSFEngineSetLauncher"
70+
mpi = "ipyparallel.cluster.launcher:MPIEngineSetLauncher"
71+
pbs = "ipyparallel.cluster.launcher:PBSEngineSetLauncher"
72+
sge = "ipyparallel.cluster.launcher:SGEEngineSetLauncher"
73+
slurm = "ipyparallel.cluster.launcher:SlurmEngineSetLauncher"
74+
ssh = "ipyparallel.cluster.launcher:SSHEngineSetLauncher"
75+
sshproxy = "ipyparallel.cluster.launcher:SSHProxyEngineSetLauncher"
76+
winhpc = "ipyparallel.cluster.launcher:WindowsHPCEngineSetLauncher"
77+
78+
[project.optional-dependencies]
79+
nbext = ["notebook", "jupyter_server"]
80+
serverextension = ["jupyter_server"]
81+
labextension = ["jupyter_server", "jupyterlab>=3"]
82+
retroextension = ["jupyter_server", "retrolab"]
83+
benchmark = ["asv"]
84+
test = [
85+
"pytest",
86+
"pytest-cov",
87+
"pytest-asyncio",
88+
"pytest-tornado",
89+
"ipython[test]",
90+
"testpath",
91+
]
92+
93+
[project.scripts]
94+
ipcluster = "ipyparallel.cluster.app:main"
95+
ipcontroller = "ipyparallel.controller.app:main"
96+
ipengine = "ipyparallel.engine.app:main"
97+
98+
[tool.flit.sdist]
99+
include = [
100+
"benchmarks/",
101+
"docs/",
102+
"*.json",
103+
"yarn.lock",
104+
"jupyter-data/",
105+
"lab/",
106+
"buildapi.py",
107+
]
108+
exclude = ["lab/lib/"]
109+
110+
[tool.flit.external-data]
111+
directory = "jupyter-data"
9112

10113
[tool.black]
11114
skip-string-normalization = true

setup.cfg

-2
This file was deleted.

0 commit comments

Comments
 (0)