fastws-cli 0.0.6__tar.gz → 0.0.7__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.
@@ -1,5 +1,12 @@
1
1
  <!-- do not remove -->
2
2
 
3
+ ## 0.0.7
4
+
5
+ ### New Features
6
+
7
+ - Refactor Pyright editable path setup to write pyrightconfig.json instead of .pth files ([#4](https://github.com/AnswerDotAI/fastws/issues/4))
8
+
9
+
3
10
  ## 0.0.6
4
11
 
5
12
  ### New Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License: Apache-2.0
@@ -0,0 +1,5 @@
1
+ __version__ = "0.0.7"
2
+
3
+
4
+ from .core import *
5
+
@@ -3,7 +3,7 @@
3
3
  __all__ = ["ws_clone", "ws_clone_cli", "ws_pull", "ws_pull_cli", "ws_status", "ws_status_cli", "ws_branches", "ws_branches_cli",
4
4
  "ws_sync", "ws_sync_cli", "ws_add", "ws_add_cli"]
5
5
 
6
- import ast, fnmatch, os, re, shutil, subprocess
6
+ import ast, fnmatch, json, os, re, shutil, subprocess
7
7
  from pathlib import Path
8
8
  from concurrent.futures import ThreadPoolExecutor, as_completed
9
9
 
@@ -193,18 +193,17 @@ def _site_packages(root: Path) -> Path|None:
193
193
  if candidates: return candidates[0]
194
194
  return None
195
195
 
196
- def _write_pyright_pth_files(root: Path) -> list[Path]:
196
+ def _write_pyright_config(root: Path):
197
197
  site = _site_packages(root)
198
198
  if not site:
199
199
  print("No site-packages directory found for editable Pyright paths")
200
- return []
201
- created = []
202
- for finder in sorted(site.glob("__editable__*_finder.py")):
203
- for pkg,path in _editable_mapping(finder).items():
204
- pth = site/f"_pyright_editable_{pkg}.pth"
205
- pth.write_text(str(Path(path).parent) + "\n")
206
- created.append(pth)
207
- return created
200
+ return
201
+ paths = sorted({str(Path(p).parent) for f in site.glob("__editable__*_finder.py") for p in _editable_mapping(f).values()})
202
+ cfg_path = root / 'pyrightconfig.json'
203
+ cfg = json.loads(cfg_path.read_text()) if cfg_path.exists() else {}
204
+ cfg['extraPaths'] = paths
205
+ cfg_path.write_text(json.dumps(cfg, indent=2) + '\n')
206
+ for pth in site.glob('_pyright_editable_*.pth'): pth.unlink()
208
207
 
209
208
  def _clone_one(repo: str, root: str = ".") -> str:
210
209
  d = Path(root)/_repo_dir(repo)
@@ -323,7 +322,7 @@ def ws_sync(
323
322
  pyproject_file: str = "pyproject.toml", # Workspace pyproject to update
324
323
  template_file: str = "pyproject.tmpl", # Template copied when pyproject.toml is missing
325
324
  ):
326
- "Sync workspace metadata, run uv sync -U, and refresh Pyright editable paths."
325
+ "Sync workspace metadata, run uv sync -U, and update Pyright config."
327
326
  root = _ws_root(workspace, repos_file, pyproject_file, template_file)
328
327
  repos_path = _resolve_path(root, repos_file)
329
328
  pyproject_path = _resolve_path(root, pyproject_file)
@@ -335,8 +334,8 @@ def ws_sync(
335
334
 
336
335
  if missing_projects := _sync_ws_pyproject(pyproject_path, template_path, _ws_projects(root)): print(f"Added workspace projects: {', '.join(missing_projects)}")
337
336
 
337
+ _write_pyright_config(root)
338
338
  subprocess.run(["uv", "sync", "-U"], check=True, cwd=root)
339
- _write_pyright_pth_files(root)
340
339
 
341
340
  @call_parse
342
341
  def ws_sync_cli(
@@ -345,7 +344,7 @@ def ws_sync_cli(
345
344
  pyproject_file: str = "pyproject.toml", # Workspace pyproject to update
346
345
  template_file: str = "pyproject.tmpl", # Template copied when pyproject.toml is missing
347
346
  ):
348
- "Sync workspace metadata, run uv sync -U, and refresh Pyright editable paths."
347
+ "Sync workspace metadata, run uv sync -U, and update Pyright config."
349
348
  ws_sync(workspace, repos_file, pyproject_file, template_file)
350
349
 
351
350
  def ws_add(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License: Apache-2.0
@@ -1,4 +0,0 @@
1
- __version__ = "0.0.6"
2
-
3
- from .core import *
4
-
File without changes
File without changes
File without changes
File without changes
File without changes