Skip to content

Commit

Permalink
Merge pull request #705 from blink1073/use-flit
Browse files Browse the repository at this point in the history
Switch to flit build backend
  • Loading branch information
minrk authored May 6, 2022
2 parents 6396793 + cf9dbdf commit ccc5476
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 1,274 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Install Python dependencies
- name: Install ipyparallel itself
run: |
pip install --upgrade pip
pip install --pre --upgrade .[test] distributed joblib codecov
pip install --no-deps .
- name: Install Python dependencies
run: |
pip install --pre --upgrade ipyparallel[test] distributed joblib codecov
pip install --only-binary :all: matplotlib || echo "no matplotlib"
- name: Show environment
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ lib
ipyparallel/labextension
tsconfig.tsbuildinfo
dask-worker-space
jupyter-data/share
34 changes: 0 additions & 34 deletions MANIFEST.in

This file was deleted.

79 changes: 79 additions & 0 deletions buildapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""A build backend that handles installing the template files.
See https://peps.python.org/pep-0517/#in-tree-build-backends
"""
import glob
import os
import shutil
import subprocess

from flit_core.buildapi import build_editable # noqa
from flit_core.buildapi import build_sdist # noqa
from flit_core.buildapi import build_wheel # noqa
from flit_core.buildapi import (
get_requires_for_build_editable as get_requires_for_build_editable_orig,
)
from flit_core.buildapi import (
get_requires_for_build_sdist as get_requires_for_build_sdist_orig,
)
from flit_core.buildapi import (
get_requires_for_build_wheel as get_requires_for_build_wheel_orig,
)

osp = os.path
here = osp.abspath(osp.dirname(__file__))
share_dir = osp.join(here, "jupyter-data", "share", "jupyter")
nbclassic_path = osp.join(share_dir, "nbextensions", "ipyparallel")
lab_path = osp.join(share_dir, "labextensions", "ipyparallel-labextension")


def _handle_labextension(cmd="build:prod"):
if os.environ.get("IPP_DISABLE_JS") == "1":
print("Skipping js installation")
return

# this tells us if labextension is built at all, not if it's up-to-date
labextension_built = glob.glob(os.path.join(lab_path, "*"))
needs_js = True
if not os.path.isdir(os.path.join(here, ".git")):
print("Installing from a dist, not a repo")
# not in a repo, probably installing from sdist
# could be git-archive, though!
# skip rebuilding js if it's already present
if labextension_built:
print(f"Not regenerating labextension in {lab_path}")
needs_js = False

if needs_js:
subprocess.check_call(['jlpm'], cwd=here)
subprocess.check_call(['jlpm', 'run', cmd], cwd=here)

source = osp.join(here, 'ipyparallel', 'labextension')
if labextension_built:
shutil.rmtree(lab_path)
shutil.copytree(source, lab_path)


def _handle_nbextension():
source = osp.join(here, 'ipyparallel', 'nbextension', 'static')
if osp.exists(nbclassic_path):
shutil.rmtree(nbclassic_path)
shutil.copytree(source, nbclassic_path)


def get_requires_for_build_wheel(config_settings=None):
_handle_labextension()
_handle_nbextension()
return get_requires_for_build_wheel_orig(config_settings=config_settings)


def get_requires_for_build_sdist(config_settings=None):
_handle_labextension()
_handle_nbextension()
return get_requires_for_build_sdist_orig(config_settings=config_settings)


def get_requires_for_build_editable(config_settings=None):
_handle_labextension(cmd="build")
_handle_nbextension()
return get_requires_for_build_editable_orig(config_settings=config_settings)
111 changes: 107 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,114 @@
[build-system]
requires = [
"jupyterlab>=3.0.0,==3.*",
"packaging",
"setuptools>=40.8.0",
"wheel",
"flit_core >=3.2,<4"
]
build-backend = "setuptools.build_meta"
build-backend = "buildapi"
backend-path = ["."]

[project]
name = "ipyparallel"
authors = [{name = "IPython Development Team", email = "[email protected]"}]
license = {file = "COPYING.md"}
readme = "README.md"
description = "Interactive Parallel Computing with IPython"
keywords = [
"Interactive",
"Interpreter",
"Shell",
"Parallel",
]
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
urls = {Homepage = "https://ipython.org"}
requires-python = ">=3.7"
dependencies = [
"entrypoints",
"decorator",
"pyzmq>=18",
"traitlets>=4.3",
"ipython>=4",
"jupyter_client",
"ipykernel>=4.4",
"tornado>=5.1",
"psutil",
"python-dateutil>=2.1",
"tqdm",
]
dynamic = ["version"]

[project.entry-points."ipyparallel.controller_launchers"]
batch = "ipyparallel.cluster.launcher:BatchControllerLauncher"
htcondor = "ipyparallel.cluster.launcher:HTCondorControllerLauncher"
local = "ipyparallel.cluster.launcher:LocalControllerLauncher"
lsf = "ipyparallel.cluster.launcher:LSFControllerLauncher"
mpi = "ipyparallel.cluster.launcher:MPIControllerLauncher"
pbs = "ipyparallel.cluster.launcher:PBSControllerLauncher"
sge = "ipyparallel.cluster.launcher:SGEControllerLauncher"
ssh = "ipyparallel.cluster.launcher:SSHControllerLauncher"
slurm = "ipyparallel.cluster.launcher:SlurmControllerLauncher"
winhpc = "ipyparallel.cluster.launcher:WindowsHPCControllerLauncher"

[project.entry-points."ipyparallel.engine_launchers"]
batch = "ipyparallel.cluster.launcher:BatchEngineSetLauncher"
htcondor = "ipyparallel.cluster.launcher:HTCondorEngineSetLauncher"
local = "ipyparallel.cluster.launcher:LocalEngineSetLauncher"
lsf = "ipyparallel.cluster.launcher:LSFEngineSetLauncher"
mpi = "ipyparallel.cluster.launcher:MPIEngineSetLauncher"
pbs = "ipyparallel.cluster.launcher:PBSEngineSetLauncher"
sge = "ipyparallel.cluster.launcher:SGEEngineSetLauncher"
slurm = "ipyparallel.cluster.launcher:SlurmEngineSetLauncher"
ssh = "ipyparallel.cluster.launcher:SSHEngineSetLauncher"
sshproxy = "ipyparallel.cluster.launcher:SSHProxyEngineSetLauncher"
winhpc = "ipyparallel.cluster.launcher:WindowsHPCEngineSetLauncher"

[project.optional-dependencies]
nbext = ["notebook", "jupyter_server"]
serverextension = ["jupyter_server"]
labextension = ["jupyter_server", "jupyterlab>=3"]
retroextension = ["jupyter_server", "retrolab"]
benchmark = ["asv"]
test = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"pytest-tornado",
"ipython[test]",
"testpath",
]

[project.scripts]
ipcluster = "ipyparallel.cluster.app:main"
ipcontroller = "ipyparallel.controller.app:main"
ipengine = "ipyparallel.engine.app:main"

[tool.flit.sdist]
include = [
"benchmarks/",
"docs/",
"*.json",
"yarn.lock",
"jupyter-data/",
"lab/",
"buildapi.py",
]
exclude = ["lab/lib/"]

[tool.flit.external-data]
directory = "jupyter-data"

[tool.black]
skip-string-normalization = true
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit ccc5476

Please sign in to comment.