jupyter-builder 0.1.0a2__tar.gz → 0.1.0a3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.pre-commit-config.yaml +4 -4
  2. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/CHANGELOG.md +16 -2
  3. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/PKG-INFO +2 -2
  4. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/__init__.py +1 -1
  5. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/base_extension_app.py +1 -3
  6. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/commands.py +2 -1
  7. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/debug_log_file_mixin.py +7 -7
  8. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/extension_commands/build.py +4 -4
  9. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/extension_commands/develop.py +2 -2
  10. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/extension_commands/watch.py +4 -4
  11. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/federated_extensions.py +22 -25
  12. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/federated_extensions_requirements.py +12 -12
  13. jupyter_builder-0.1.0a3/jupyter_builder/jupyterlab_semver.py +647 -0
  14. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/pyproject.toml +21 -9
  15. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/tests/test_tpl.py +2 -6
  16. jupyter_builder-0.1.0a2/jupyter_builder/jupyterlab_semver.py +0 -252
  17. jupyter_builder-0.1.0a2/jupyter_builder/jupyterlab_server_req.py +0 -66
  18. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.copier-answers.yml +0 -0
  19. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.gitignore +0 -0
  20. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.licenserc.yaml +0 -0
  21. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.prettierignore +0 -0
  22. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/.yarnrc.yml +0 -0
  23. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/LICENSE +0 -0
  24. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/README.md +0 -0
  25. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/RELEASE.md +0 -0
  26. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/core_path.py +0 -0
  27. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/extension_commands/__init__.py +0 -0
  28. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/jlpm.py +0 -0
  29. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/main.py +0 -0
  30. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/jupyter_builder/yarn.js +0 -0
  31. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/package.json +0 -0
  32. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/src/index.ts +0 -0
  33. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/tsconfig.json +0 -0
  34. {jupyter_builder-0.1.0a2 → jupyter_builder-0.1.0a3}/yarn.lock +0 -0
@@ -57,11 +57,11 @@ repos:
57
57
  ["traitlets>=5.13"]
58
58
 
59
59
  - repo: https://github.com/astral-sh/ruff-pre-commit
60
- rev: v0.3.4
60
+ rev: v0.5.5
61
61
  hooks:
62
- # - id: ruff
63
- # types_or: [python, jupyter]
64
- # args: ["--fix", "--show-fixes"]
62
+ - id: ruff
63
+ types_or: [python, jupyter]
64
+ args: ["--fix", "--show-fixes"]
65
65
  - id: ruff-format
66
66
  types_or: [python, jupyter]
67
67
 
@@ -2,6 +2,22 @@
2
2
 
3
3
  <!-- <START NEW CHANGELOG ENTRY> -->
4
4
 
5
+ ## 0.1.0a3
6
+
7
+ ([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/v0.1.0a2...464a12d6a8288e06646f0c364ee1477d643c7261))
8
+
9
+ ### Maintenance and upkeep improvements
10
+
11
+ - Bump ruff from 0.4.7 to 0.5.5 in the pip group across 1 directory [#24](https://github.com/jupyterlab/jupyter-builder/pull/24) ([@dependabot](https://github.com/dependabot))
12
+
13
+ ### Contributors to this release
14
+
15
+ ([GitHub contributors page for this release](https://github.com/jupyterlab/jupyter-builder/graphs/contributors?from=2024-07-29&to=2024-07-30&type=c))
16
+
17
+ [@dependabot](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Adependabot+updated%3A2024-07-29..2024-07-30&type=Issues)
18
+
19
+ <!-- <END NEW CHANGELOG ENTRY> -->
20
+
5
21
  ## 0.1.0a2
6
22
 
7
23
  ([Full Changelog](https://github.com/jupyterlab/jupyter-builder/compare/ac6bb51518d309b96658dc45784f4d47a7cd559c...02764ce51fd919bdb5739e06d545656ee0e5b2c9))
@@ -36,5 +52,3 @@
36
52
  ([GitHub contributors page for this release](https://github.com/jupyterlab/jupyter-builder/graphs/contributors?from=2024-03-04&to=2024-07-29&type=c))
37
53
 
38
54
  [@cronan03](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Acronan03+updated%3A2024-03-04..2024-07-29&type=Issues) | [@dependabot](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Adependabot+updated%3A2024-03-04..2024-07-29&type=Issues) | [@fcollonval](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Afcollonval+updated%3A2024-03-04..2024-07-29&type=Issues) | [@kloczek](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Akloczek+updated%3A2024-03-04..2024-07-29&type=Issues) | [@welcome](https://github.com/search?q=repo%3Ajupyterlab%2Fjupyter-builder+involves%3Awelcome+updated%3A2024-03-04..2024-07-29&type=Issues)
39
-
40
- <!-- <END NEW CHANGELOG ENTRY> -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: jupyter_builder
3
- Version: 0.1.0a2
3
+ Version: 0.1.0a3
4
4
  Summary: JupyterLab build tools
5
5
  Project-URL: Homepage, https://jupyter.org
6
6
  Project-URL: Source, https://github.com/jupyterlab/jupyterlab_builder
@@ -58,7 +58,7 @@ Requires-Dist: build; extra == 'dev'
58
58
  Requires-Dist: hatch; extra == 'dev'
59
59
  Requires-Dist: mypy; extra == 'dev'
60
60
  Requires-Dist: pre-commit; extra == 'dev'
61
- Requires-Dist: ruff==0.4.7; extra == 'dev'
61
+ Requires-Dist: ruff==0.5.5; extra == 'dev'
62
62
  Provides-Extra: test
63
63
  Requires-Dist: copier<10,>=9.2; extra == 'test'
64
64
  Requires-Dist: coverage; extra == 'test'
@@ -9,5 +9,5 @@ except ImportError:
9
9
  # the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
10
10
  import warnings
11
11
 
12
- warnings.warn("Importing 'jupyter_builder' outside a proper installation.")
12
+ warnings.warn("Importing 'jupyter_builder' outside a proper installation.", stacklevel=1)
13
13
  __version__ = "dev"
@@ -4,6 +4,7 @@
4
4
  # Distributed under the terms of the Modified BSD License.
5
5
 
6
6
  from __future__ import annotations
7
+
7
8
  import os
8
9
  from copy import copy
9
10
 
@@ -15,9 +16,6 @@ from .debug_log_file_mixin import DebugLogFileMixin
15
16
 
16
17
  HERE = os.path.dirname(os.path.abspath(__file__))
17
18
 
18
-
19
- # from .federated_labextensions import build_labextension, develop_labextension_py, watch_labextension
20
-
21
19
  flags = dict(base_flags)
22
20
 
23
21
  develop_flags = copy(flags)
@@ -41,7 +41,8 @@ def _compare_ranges(spec1, spec2, drop_prerelease1=False, drop_prerelease2=False
41
41
  # Set return_value to a sentinel value
42
42
  return_value = False
43
43
 
44
- # r1.set may be a list of ranges if the range involved an ||, so we need to test for overlaps between each pair.
44
+ # r1.set may be a list of ranges if the range involved an ||,
45
+ # so we need to test for overlaps between each pair.
45
46
  for r1set, r2set in itertools.product(r1.set, r2.set):
46
47
  x1 = r1set[0].semver
47
48
  x2 = r1set[-1].semver
@@ -47,18 +47,18 @@ class DebugLogFileMixin(Configurable):
47
47
  for line in msg:
48
48
  self.log.debug(line)
49
49
  if isinstance(ex, SystemExit):
50
- warnings.warn(f"An error occurred. See the log file for details: {log_path}")
50
+ warnings.warn(
51
+ f"An error occurred. See the log file for details: {log_path}", stacklevel=1
52
+ )
51
53
  raise
52
- warnings.warn("An error occurred.")
53
- warnings.warn(msg[-1].strip())
54
- warnings.warn(f"See the log file for details: {log_path}")
54
+ warnings.warn("An error occurred.", stacklevel=1)
55
+ warnings.warn(msg[-1].strip(), stacklevel=1)
56
+ warnings.warn(f"See the log file for details: {log_path}", stacklevel=1)
55
57
  self.exit(1)
56
58
  else:
57
59
  log.removeHandler(_debug_handler)
58
60
  _debug_handler.flush()
59
61
  _debug_handler.close()
60
- try:
62
+ with contextlib.suppress(FileNotFoundError):
61
63
  os.remove(log_path)
62
- except FileNotFoundError:
63
- pass
64
64
  log.removeHandler(_debug_handler)
@@ -5,9 +5,9 @@ import os
5
5
 
6
6
  from traitlets import Bool, Unicode
7
7
 
8
- from ..base_extension_app import BaseExtensionApp
9
- from ..core_path import default_core_path
10
- from ..federated_extensions import build_labextension
8
+ from jupyter_builder.base_extension_app import BaseExtensionApp
9
+ from jupyter_builder.core_path import default_core_path
10
+ from jupyter_builder.federated_extensions import build_labextension
11
11
 
12
12
  HERE = os.path.dirname(os.path.abspath(__file__))
13
13
 
@@ -27,7 +27,7 @@ class BuildLabExtensionApp(BaseExtensionApp):
27
27
  help="Directory containing core application package.json file",
28
28
  )
29
29
 
30
- aliases = {
30
+ aliases = { # noqa: RUF012
31
31
  "static-url": "BuildLabExtensionApp.static_url",
32
32
  "development": "BuildLabExtensionApp.development",
33
33
  "source-map": "BuildLabExtensionApp.source_map",
@@ -7,8 +7,8 @@ from copy import copy
7
7
  from jupyter_core.application import base_flags
8
8
  from traitlets import Bool, Unicode
9
9
 
10
- from ..base_extension_app import BaseExtensionApp
11
- from ..federated_extensions import develop_labextension_py
10
+ from jupyter_builder.base_extension_app import BaseExtensionApp
11
+ from jupyter_builder.federated_extensions import develop_labextension_py
12
12
 
13
13
  flags = dict(base_flags)
14
14
  develop_flags = copy(flags)
@@ -5,9 +5,9 @@ import os
5
5
 
6
6
  from traitlets import Bool, Unicode
7
7
 
8
- from ..base_extension_app import BaseExtensionApp
9
- from ..federated_extensions import watch_labextension
10
- from ..core_path import default_core_path
8
+ from jupyter_builder.base_extension_app import BaseExtensionApp
9
+ from jupyter_builder.core_path import default_core_path
10
+ from jupyter_builder.federated_extensions import watch_labextension
11
11
 
12
12
  HERE = os.path.dirname(os.path.abspath(__file__))
13
13
 
@@ -25,7 +25,7 @@ class WatchLabExtensionApp(BaseExtensionApp):
25
25
  help="Directory containing core application package.json file",
26
26
  )
27
27
 
28
- aliases = {
28
+ aliases = { # noqa: RUF012
29
29
  "core-path": "WatchLabExtensionApp.core_path",
30
30
  "development": "WatchLabExtensionApp.development",
31
31
  "source-map": "WatchLabExtensionApp.source_map",
@@ -25,7 +25,6 @@ from jupyter_core.paths import ENV_JUPYTER_PATH, SYSTEM_JUPYTER_PATH, jupyter_da
25
25
  from jupyter_core.utils import ensure_dir_exists
26
26
  from jupyter_server.extension.serverextension import ArgumentConflict
27
27
 
28
- # from jupyterlab_server.config import get_federated_extensions
29
28
  from .federated_extensions_requirements import get_federated_extensions
30
29
 
31
30
  try:
@@ -33,6 +32,8 @@ try:
33
32
  except ImportError:
34
33
  from tomli import load
35
34
 
35
+ from .core_path import default_core_path
36
+
36
37
  # from .commands import _test_overlap TO BE DONE -----------------------------
37
38
 
38
39
  DEPRECATED_ARGUMENT = object()
@@ -95,7 +96,7 @@ def develop_labextension( # noqa
95
96
  ensure_dir_exists(labext)
96
97
 
97
98
  if isinstance(path, (list, tuple)):
98
- msg = "path must be a string pointing to a single extension to install; call this function multiple times to install multiple extensions"
99
+ msg = "path must be a string pointing to a single extension to install; call this function multiple times to install multiple extensions" # noqa: E501
99
100
  raise TypeError(msg)
100
101
 
101
102
  if not destination:
@@ -104,7 +105,7 @@ def develop_labextension( # noqa
104
105
  full_dest = normpath(pjoin(labext, destination))
105
106
  if overwrite and os.path.lexists(full_dest):
106
107
  if logger:
107
- logger.info("Removing: %s" % full_dest)
108
+ logger.info("Removing: %s", full_dest)
108
109
  if os.path.isdir(full_dest) and not os.path.islink(full_dest):
109
110
  shutil.rmtree(full_dest)
110
111
  else:
@@ -124,14 +125,15 @@ def develop_labextension( # noqa
124
125
  if platform.platform().startswith("Windows"):
125
126
  msg = (
126
127
  "Symlinks can be activated on Windows 10 for Python version 3.8 or higher"
127
- " by activating the 'Developer Mode'. That may not be allowed by your administrators.\n"
128
+ " by activating the 'Developer Mode'. That may not be allowed by your administrators.\n" # noqa: E501
128
129
  "See https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development"
129
130
  )
130
131
  raise OSError(msg) from e
131
132
  raise
132
133
 
133
134
  elif not os.path.islink(full_dest):
134
- raise ValueError("%s exists and is not a symlink" % full_dest)
135
+ msg = f"{full_dest} exists and is not a symlink"
136
+ raise ValueError(msg)
135
137
 
136
138
  elif os.path.isdir(path):
137
139
  path = pjoin(os.path.abspath(path), "") # end in path separator
@@ -139,7 +141,7 @@ def develop_labextension( # noqa
139
141
  dest_dir = pjoin(full_dest, parent[len(path) :])
140
142
  if not os.path.exists(dest_dir):
141
143
  if logger:
142
- logger.info("Making directory: %s" % dest_dir)
144
+ logger.info("Making directory: %s", dest_dir)
143
145
  os.makedirs(dest_dir)
144
146
  for file_name in files:
145
147
  src = pjoin(parent, file_name)
@@ -152,7 +154,7 @@ def develop_labextension( # noqa
152
154
  return full_dest
153
155
 
154
156
 
155
- def develop_labextension_py(
157
+ def develop_labextension_py( # noqa: PLR0913
156
158
  module,
157
159
  user=False,
158
160
  sys_prefix=False,
@@ -195,10 +197,7 @@ def develop_labextension_py(
195
197
  return full_dests
196
198
 
197
199
 
198
- from .core_path import default_core_path
199
-
200
-
201
- def build_labextension(
200
+ def build_labextension( # noqa: PLR0913
202
201
  path, logger=None, development=False, static_url=None, source_map=False, core_path=None
203
202
  ):
204
203
  """Build a labextension in the given path"""
@@ -208,7 +207,7 @@ def build_labextension(
208
207
  ext_path = str(Path(path).resolve())
209
208
 
210
209
  if logger:
211
- logger.info("Building extension in %s" % path)
210
+ logger.info("Building extension in %s", path)
212
211
 
213
212
  builder = _ensure_builder(ext_path, core_path)
214
213
 
@@ -223,7 +222,7 @@ def build_labextension(
223
222
  subprocess.check_call(arguments, cwd=ext_path) # noqa S603
224
223
 
225
224
 
226
- def watch_labextension(
225
+ def watch_labextension( # noqa: PLR0913
227
226
  path, labextensions_path, logger=None, development=False, source_map=False, core_path=None
228
227
  ):
229
228
  """Watch a labextension in a given path"""
@@ -231,7 +230,7 @@ def watch_labextension(
231
230
  ext_path = str(Path(path).resolve())
232
231
 
233
232
  if logger:
234
- logger.info("Building extension in %s" % path)
233
+ logger.info("Building extension in %s", path)
235
234
 
236
235
  # Check to see if we need to create a symlink
237
236
  federated_extensions = get_federated_extensions(labextensions_path)
@@ -274,9 +273,8 @@ def _ensure_builder(ext_path, core_path):
274
273
  dep_version2 = ext_data.get("devDependencies", {}).get("@jupyterlab/builder")
275
274
  dep_version2 = dep_version2 or ext_data.get("dependencies", {}).get("@jupyterlab/builder")
276
275
  if dep_version2 is None:
277
- raise ValueError(
278
- "Extensions require a devDependency on @jupyterlab/builder@%s" % dep_version1
279
- )
276
+ msg = f"Extensions require a devDependency on @jupyterlab/builder@{dep_version1}"
277
+ raise ValueError(msg)
280
278
 
281
279
  # if we have installed from disk (version is a path), assume we know what
282
280
  # we are doing and do not check versions.
@@ -310,7 +308,7 @@ def _ensure_builder(ext_path, core_path):
310
308
  # )
311
309
 
312
310
  # if not overlap:
313
- # msg = f"Extensions require a devDependency on @jupyterlab/builder@{dep_version1}, you have a dependency on {dep_version2}"
311
+ # msg = f"Extensions require a devDependency on @jupyterlab/builder@{dep_version1}, you have a dependency on {dep_version2}" # noqa: E501
314
312
  # raise ValueError(msg)
315
313
 
316
314
  return osp.join(
@@ -339,10 +337,10 @@ def _should_copy(src, dest, logger=None):
339
337
  # we add a fudge factor to work around a bug in python 2.x
340
338
  # that was fixed in python 3.x: https://bugs.python.org/issue12904
341
339
  if logger:
342
- logger.warning("Out of date: %s" % dest)
340
+ logger.warning("Out of date: %s", dest)
343
341
  return True
344
342
  if logger:
345
- logger.info("Up to date: %s" % dest)
343
+ logger.info("Up to date: %s", dest)
346
344
  return False
347
345
 
348
346
 
@@ -388,9 +386,8 @@ def _get_labextension_dir(user=False, sys_prefix=False, prefix=None, labextensio
388
386
  ]
389
387
  conflicting_set = [f"{n}={v!r}" for n, v in conflicting if v]
390
388
  if len(conflicting_set) > 1:
391
- msg = "cannot specify more than one of user, sys_prefix, prefix, or labextensions_dir, but got: {}".format(
392
- ", ".join(conflicting_set)
393
- )
389
+ conflict = ", ".join(conflicting_set)
390
+ msg = f"cannot specify more than one of user, sys_prefix, prefix, or labextensions_dir, but got: {conflict}" # noqa: E501
394
391
  raise ArgumentConflict(msg)
395
392
  if user:
396
393
  labext = pjoin(jupyter_data_dir(), "labextensions")
@@ -449,8 +446,8 @@ def _get_labextension_metadata(module): # noqa
449
446
  if not package:
450
447
  try:
451
448
  package = (
452
- subprocess.check_output(
453
- [sys.executable, "setup.py", "--name"], # noqa S603
449
+ subprocess.check_output( # noqa: S603
450
+ [sys.executable, "setup.py", "--name"],
454
451
  cwd=mod_path,
455
452
  )
456
453
  .decode("utf8")
@@ -50,21 +50,21 @@ def get_federated_extensions(labextensions_path: list[str]) -> dict[str, Any]:
50
50
  with open(ext_path, encoding="utf-8") as fid:
51
51
  pkgdata = json.load(fid)
52
52
  if pkgdata["name"] not in federated_extensions:
53
- data = dict(
54
- name=pkgdata["name"],
55
- version=pkgdata["version"],
56
- description=pkgdata.get("description", ""),
57
- url=get_package_url(pkgdata),
58
- ext_dir=ext_dir,
59
- ext_path=osp.dirname(ext_path),
60
- is_local=False,
61
- dependencies=pkgdata.get("dependencies", dict()),
62
- jupyterlab=pkgdata.get("jupyterlab", dict()),
63
- )
53
+ data = {
54
+ "name": pkgdata["name"],
55
+ "version": pkgdata["version"],
56
+ "description": pkgdata.get("description", ""),
57
+ "url": get_package_url(pkgdata),
58
+ "ext_dir": ext_dir,
59
+ "ext_path": osp.dirname(ext_path),
60
+ "is_local": False,
61
+ "dependencies": pkgdata.get("dependencies", {}),
62
+ "jupyterlab": pkgdata.get("jupyterlab", {}),
63
+ }
64
64
 
65
65
  # Add repository info if available
66
66
  if "repository" in pkgdata and "url" in pkgdata.get("repository", {}):
67
- data["repository"] = dict(url=pkgdata.get("repository").get("url"))
67
+ data["repository"] = {"url": pkgdata.get("repository").get("url")}
68
68
 
69
69
  install_path = osp.join(osp.dirname(ext_path), "install.json")
70
70
  if osp.exists(install_path):