-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82c78e2
commit d3809b2
Showing
4 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# minimum needed to build jupyter suggestions. | ||
|
||
hatchling>=1.5.0,<2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def execute(cmd: str, cwd=None): | ||
subprocess.run(cmd.split(" "), check=True, cwd=cwd) | ||
|
||
|
||
def build_packages(): | ||
root_path = Path(__file__).parents[1] | ||
requirements_build_path = root_path / "requirements-build.txt" | ||
install_build_deps = f"python -m pip install -r {requirements_build_path}" | ||
|
||
python_package_prefix = "python" | ||
python_packages = ["jupyter_suggestions_core"] | ||
|
||
execute(install_build_deps) | ||
|
||
for py_package in python_packages: | ||
execute("hatch build", cwd=root_path / python_package_prefix / py_package) | ||
|
||
|
||
if __name__ == "__main__": | ||
build_packages() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def execute(cmd: str, cwd=None, env={}): | ||
env_copy = os.environ.copy() | ||
|
||
subprocess.run(cmd.split(" "), check=True, cwd=cwd, env=dict(**env_copy, **env)) | ||
|
||
|
||
def install_dev(): | ||
root_path = Path(__file__).parents[1] | ||
requirements_build_path = root_path / "requirements-build.txt" | ||
install_build_deps = f"python -m pip install -r {requirements_build_path}" | ||
install_js_deps = "jlpm install" | ||
build_js = "jlpm build" | ||
|
||
python_package_prefix = "python" | ||
python_packages = ["jupyter_suggestions_core"] | ||
|
||
execute(install_build_deps) | ||
execute(install_js_deps) | ||
|
||
execute(build_js) | ||
for py_package in python_packages: | ||
execute(f"pip uninstall {py_package} -y") | ||
execute("jlpm clean:all", cwd=root_path / "python" / py_package) | ||
execute(f"pip install -e {python_package_prefix}/{py_package}") | ||
|
||
if py_package in ["jupyter_suggestions_core"]: | ||
execute( | ||
f"jupyter labextension develop {python_package_prefix}/{py_package} --overwrite" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
install_dev() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters