fastws-cli 0.0.23__tar.gz → 0.0.24__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.23
3
+ Version: 0.0.24
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -14,6 +14,7 @@ Requires-Dist: fastcore>=2.2.33
14
14
  Requires-Dist: fastgit>=0.1.2
15
15
  Requires-Dist: ghapi>=2.0.6
16
16
  Requires-Dist: packaging
17
+ Requires-Dist: maturin<2.0,>=1.9.4
17
18
  Requires-Dist: tomli; python_version < "3.11"
18
19
  Provides-Extra: dev
19
20
  Requires-Dist: fastship; extra == "dev"
@@ -214,7 +215,11 @@ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an
214
215
 
215
216
  Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
216
217
 
217
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
218
+ `cargo develop` also copies the `data/` subdirectory of `[tool.maturin].data` into the active venv, as a wheel install does. For example, `data/share/jupyter/kernels/<name>/kernel.json` is installed as `share/jupyter/kernels/<name>/kernel.json`, where Jupyter finds the kernel. `cargo develop` installs the binaries it builds, not the staged copies in `scripts/`.
219
+
220
+ For distribution wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
221
+
222
+ Editable builds through this backend install only Python metadata and the source path. `ws-sync` then runs `cargo develop` to build and install the extension, the binaries and the wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
218
223
 
219
224
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
220
225
 
@@ -254,7 +259,7 @@ An optional tracked `package.json.shared` is merged into the root `package.json`
254
259
 
255
260
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`. Leave global build isolation enabled for other projects.
256
261
 
257
- After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. These projects should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo rather than triggering a separate maturin editable build. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
262
+ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
258
263
 
259
264
  Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
260
265
 
@@ -189,7 +189,11 @@ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an
189
189
 
190
190
  Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
191
191
 
192
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
192
+ `cargo develop` also copies the `data/` subdirectory of `[tool.maturin].data` into the active venv, as a wheel install does. For example, `data/share/jupyter/kernels/<name>/kernel.json` is installed as `share/jupyter/kernels/<name>/kernel.json`, where Jupyter finds the kernel. `cargo develop` installs the binaries it builds, not the staged copies in `scripts/`.
193
+
194
+ For distribution wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
195
+
196
+ Editable builds through this backend install only Python metadata and the source path. `ws-sync` then runs `cargo develop` to build and install the extension, the binaries and the wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
193
197
 
194
198
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
195
199
 
@@ -229,7 +233,7 @@ An optional tracked `package.json.shared` is merged into the root `package.json`
229
233
 
230
234
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`. Leave global build isolation enabled for other projects.
231
235
 
232
- After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. These projects should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo rather than triggering a separate maturin editable build. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
236
+ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
233
237
 
234
238
  Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
235
239
 
@@ -1,4 +1,5 @@
1
- __version__ = "0.0.23"
1
+ __version__ = "0.0.24"
2
+
2
3
 
3
4
 
4
5
 
@@ -1,6 +1,8 @@
1
1
  r"Maturin build backend that includes Cargo binaries in Python wheels."
2
- import argparse
2
+ import argparse, base64, csv, hashlib, io
3
3
  from pathlib import Path
4
+ from tempfile import TemporaryDirectory
5
+ from zipfile import ZipFile, ZIP_DEFLATED
4
6
  import maturin
5
7
  from .cargo import settings, stage_binaries
6
8
 
@@ -22,8 +24,25 @@ def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
22
24
 
23
25
 
24
26
  def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
25
- _stage(config_settings)
26
- return maturin.build_editable(wheel_directory, config_settings, metadata_directory)
27
+ r"Build an editable wheel containing metadata and the Python source path, without compiling Rust."
28
+ with TemporaryDirectory() as tmp:
29
+ info = Path(metadata_directory) if metadata_directory else Path(tmp)/prepare_metadata_for_build_editable(tmp, config_settings)
30
+ name = info.name.removesuffix('.dist-info')
31
+ tag = next(line.removeprefix('Tag: ') for line in (info/'WHEEL').read_text().splitlines() if line.startswith('Tag: '))
32
+ files = {p.relative_to(info.parent).as_posix(): p.read_bytes() for p in info.rglob('*') if p.is_file() and p != info/'RECORD'}
33
+ root = Path.cwd()
34
+ source = (root/settings(root)['maturin']['python-source']).resolve()
35
+ files[f'{name}.pth'] = f'{source}\n'.encode()
36
+ record = f'{info.name}/RECORD'
37
+ rows = [(path, 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode(), len(data))
38
+ for path, data in files.items()]
39
+ buffer = io.StringIO()
40
+ csv.writer(buffer).writerows([*rows, (record, '', '')])
41
+ files[record] = buffer.getvalue().encode()
42
+ filename = f'{name}-{tag}.whl'
43
+ with ZipFile(Path(wheel_directory)/filename, 'w', ZIP_DEFLATED) as wheel:
44
+ for path, data in files.items(): wheel.writestr(path, data)
45
+ return filename
27
46
 
28
47
 
29
48
  def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
@@ -49,7 +49,7 @@ def replace(source, destination):
49
49
 
50
50
 
51
51
  def develop(root):
52
- "Install a Python extension and opted-in binaries from one Cargo build."
52
+ "Install a Python extension, opted-in binaries and wheel data files from one Cargo build."
53
53
  tool = settings(root)
54
54
  cfg = tool['maturin']
55
55
  if 'python-source' not in cfg: raise SystemExit(r'cargo develop requires tool.maturin.python-source')
@@ -60,11 +60,16 @@ def develop(root):
60
60
  module = cfg.get('module-name', artifact['target']['name'])
61
61
  dest = root/cfg['python-source']/Path(*module.split('.'))
62
62
  replace(lib, dest.with_name(dest.name + sysconfig.get_config_var('EXT_SUFFIX')))
63
+ env = Path(os.environ.get('VIRTUAL_ENV', sys.prefix))
63
64
  if binaries:
64
- env = Path(os.environ.get('VIRTUAL_ENV', sys.prefix))
65
65
  scripts = env/('Scripts' if os.name == 'nt' else 'bin')
66
66
  for m in artifacts:
67
67
  if m.get('executable'): replace(m['executable'], scripts/Path(m['executable']).name)
68
+ # Editable builds through `build_backend` don't install the wheel's data files, which a wheel install puts under the prefix.
69
+ if 'data' in cfg:
70
+ data = root/cfg['data']/'data'
71
+ for f in data.rglob('*'):
72
+ if f.is_file(): replace(f, env/f.relative_to(data))
68
73
 
69
74
 
70
75
  def stage_binaries(root, profile=None, target=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastws-cli
3
- Version: 0.0.23
3
+ Version: 0.0.24
4
4
  Summary: Fast workspace tools for multi-repo management
5
5
  Author: Jeremy Howard
6
6
  License-Expression: Apache-2.0
@@ -14,6 +14,7 @@ Requires-Dist: fastcore>=2.2.33
14
14
  Requires-Dist: fastgit>=0.1.2
15
15
  Requires-Dist: ghapi>=2.0.6
16
16
  Requires-Dist: packaging
17
+ Requires-Dist: maturin<2.0,>=1.9.4
17
18
  Requires-Dist: tomli; python_version < "3.11"
18
19
  Provides-Extra: dev
19
20
  Requires-Dist: fastship; extra == "dev"
@@ -214,7 +215,11 @@ For reusable Rust libraries, keep the core crate Python-free and put PyO3 in an
214
215
 
215
216
  Set `native-binaries = true` under `[tool.fastws]` to build and install the binary targets of the workspace's default members into the active venv alongside the extension. A binary can live in its own member crate, such as a `cli/` crate beside `py/`, listed in `default-members`. maturin's sdist keeps only the members that the extension depends on, so a wheel built from the sdist lacks a binary from such a crate. Cargo reports the executable paths; there is no separate list of binary names.
216
217
 
217
- For wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
218
+ `cargo develop` also copies the `data/` subdirectory of `[tool.maturin].data` into the active venv, as a wheel install does. For example, `data/share/jupyter/kernels/<name>/kernel.json` is installed as `share/jupyter/kernels/<name>/kernel.json`, where Jupyter finds the kernel. `cargo develop` installs the binaries it builds, not the staged copies in `scripts/`.
219
+
220
+ For distribution wheels containing these binaries, use `fastws.build_backend` as the build backend and include `fastws-cli>=0.0.20` alongside maturin in `[build-system].requires`. Set `[tool.maturin].data` to a generated wheel-data directory. The backend replaces its `scripts/` subdirectory with the current Python-free binaries, then delegates packaging to maturin. Explicit profile and target arguments from maturin's build settings also apply to the binaries.
221
+
222
+ Editable builds through this backend install only Python metadata and the source path. `ws-sync` then runs `cargo develop` to build and install the extension, the binaries and the wheel data files. After standalone `uv sync`, run `cargo develop` yourself.
218
223
 
219
224
  Direct maturin CLI builds bypass the Python build backend. Stage the binaries first with the shared command:
220
225
 
@@ -254,7 +259,7 @@ An optional tracked `package.json.shared` is merged into the root `package.json`
254
259
 
255
260
  Before `uv sync`, fastws regenerates `tool.uv.no-build-isolation-package` with the sorted package names of projects using `fastws.build_backend`, including external checkouts. These builds use the shared environment's `fastws-cli` and `maturin`. Leave global build isolation enabled for other projects.
256
261
 
257
- After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. These projects should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo rather than triggering a separate maturin editable build. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
262
+ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project. Cargo skips unchanged compilation inputs. Projects using `fastws.build_backend` should keep only packaging inputs in `tool.uv.cache-keys`; Rust source changes are handled by Cargo. Maturin packages with `bindings = "bin"` keep their existing uv installation path.
258
263
 
259
264
  Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
260
265
 
@@ -13,6 +13,7 @@ fastws_cli.egg-info/entry_points.txt
13
13
  fastws_cli.egg-info/requires.txt
14
14
  fastws_cli.egg-info/top_level.txt
15
15
  tests/test_build.py
16
+ tests/test_build_backend.py
16
17
  tests/test_releases.py
17
18
  tests/test_setup.py
18
19
  tests/test_sync.py
@@ -2,6 +2,7 @@ fastcore>=2.2.33
2
2
  fastgit>=0.1.2
3
3
  ghapi>=2.0.6
4
4
  packaging
5
+ maturin<2.0,>=1.9.4
5
6
 
6
7
  [:python_version < "3.11"]
7
8
  tomli
@@ -20,6 +20,7 @@ dependencies = [
20
20
  "fastgit>=0.1.2",
21
21
  "ghapi>=2.0.6",
22
22
  "packaging",
23
+ "maturin>=1.9.4,<2.0",
23
24
  "tomli; python_version < '3.11'",
24
25
  ]
25
26
 
@@ -0,0 +1,26 @@
1
+ import base64, csv, hashlib, io
2
+ from zipfile import ZipFile
3
+ from fastws.build_backend import build_editable
4
+
5
+
6
+ def test_editable_wheel(tmp_path, monkeypatch):
7
+ monkeypatch.chdir(tmp_path)
8
+ (tmp_path/'pyproject.toml').write_text(r'''[tool.maturin]
9
+ python-source = "python"
10
+ data = "wheel"
11
+ ''')
12
+ info = tmp_path/'demo-1.0.dist-info'
13
+ info.mkdir()
14
+ (info/'WHEEL').write_text('Wheel-Version: 1.0\nRoot-Is-Purelib: false\nTag: py3-none-any\n')
15
+ (info/'METADATA').write_text('Metadata-Version: 2.1\nName: demo\nVersion: 1.0\n')
16
+ (info/'entry_points.txt').write_text('[console_scripts]\ndemo = demo:main\n')
17
+ with ZipFile(tmp_path/build_editable(tmp_path, metadata_directory=info)) as wheel:
18
+ assert wheel.read('demo-1.0.pth').decode() == str(tmp_path/'python') + '\n'
19
+ assert wheel.read('demo-1.0.dist-info/entry_points.txt') == (info/'entry_points.txt').read_bytes()
20
+ record = list(csv.reader(io.StringIO(wheel.read('demo-1.0.dist-info/RECORD').decode())))
21
+ assert {row[0] for row in record} == set(wheel.namelist())
22
+ for path, digest, size in record[:-1]:
23
+ data = wheel.read(path)
24
+ assert digest == 'sha256=' + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b'=').decode()
25
+ assert int(size) == len(data)
26
+ assert record[-1] == ['demo-1.0.dist-info/RECORD', '', '']
File without changes
File without changes
File without changes