Skip to content

Commit

Permalink
working on fixing #1330
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Mar 24, 2021
1 parent 1b991b6 commit 2666c2a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ junit.xml
python/perspective/python_junit.xml
python/perspective/coverage.xml
python/perspective/bench/stresstest/results
python/perspective/perspective/labextension
rust/perspective-view/target
rust/perspective-view/pkg
rust/perspective-view/target2
rust/perspective-vieux/pkg

rust/perspective-vieux/target
rust/perspective-vieux/target2
.emsdk
.emsdk
5 changes: 5 additions & 0 deletions python/perspective/install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "perspective-python",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package perspective-python"
}
2 changes: 1 addition & 1 deletion python/perspective/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel", "backports.shutil_which ; python_version <'3'", "numpy>=1.13.1"]
requires = ["setuptools", "wheel", "jupyter_packaging", "backports.shutil_which ; python_version <'3'", "numpy>=1.13.1"]
51 changes: 36 additions & 15 deletions python/perspective/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from setuptools.command.sdist import sdist
from distutils.version import LooseVersion
from codecs import open
from jupyter_packaging import create_cmdclass, get_version, combine_commands, ensure_targets


import io
import os
import os.path
import re
Expand Down Expand Up @@ -67,7 +68,6 @@ def which(x):
"flake8>=3.7.8",
"mock",
"pybind11>=2.4.0",
"pyarrow>=0.16.0",
"pytest>=4.3.0",
"pytest-cov>=2.6.1",
"pytest-check-links",
Expand All @@ -83,20 +83,8 @@ def which(x):
] + requires_dev_py2 # for development, remember to install black and flake8-black


def get_version(file, name="__version__"):
"""Get the version of the package from the given file by
executing it and extracting the given `name`.
"""
path = os.path.realpath(file)
version_ns = {}
with io.open(path, encoding="utf8") as f:
exec(f.read(), {}, version_ns)
return version_ns[name]


version = get_version(os.path.join(here, "perspective", "core", "_version.py"))


class PSPExtension(Extension):
def __init__(self, name, sourcedir="dist"):
Extension.__init__(self, name, sources=[])
Expand Down Expand Up @@ -232,7 +220,40 @@ def run_check(self):
path
)
)
for dir in ("labextension",):
path = os.path.abspath(os.path.join(here, "perspective", dir))
if not os.path.exists(path):
raise Exception(
"Path is missing! {}\nMust run `yarn build` before building sdist so js files are installed".format(
path
)
)


lab_path = os.path.join(here, "perspective", "labextension")

package_data_spec = {"perspective": ["labextension/*.tgz"]}

data_files_spec = [
("share/jupyter/labextensions", lab_path, "*.tgz"),
("share/jupyter/labextensions", lab_path, "install.json"),
]

jstargets = [
os.path.join(here, "perspective", "labextension"), # TODO this should match ipyregulartable, for example
]

cmdclass = create_cmdclass(
"jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
)

cmdclass["jsdeps"] = combine_commands(
# install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]), # TODO skip_if_exists(jstargets, js_command)
ensure_targets(jstargets),
)

cmdclass["build_ext"] = PSPBuild
cmdclass["sdist"] = PSPCheckSDist

setup(
name="perspective-python",
Expand Down Expand Up @@ -260,5 +281,5 @@ def run_check(self):
install_requires=requires,
extras_require={"dev": requires_dev, "devpy2": requires_dev_py2},
ext_modules=[PSPExtension("perspective")],
cmdclass=dict(build_ext=PSPBuild, sdist=PSPCheckSDist),
cmdclass=cmdclass,
)

0 comments on commit 2666c2a

Please sign in to comment.