Skip to content

Commit

Permalink
generate sdist by hand
Browse files Browse the repository at this point in the history
This updates the perspective-python build to create an sdist tarball by
hand, not going through `maturin sdist`. This bypasses some issues we
have seen with Maturin mispackaging the perspective Cargo workspace in
the sdist.

Maturin is still used as the `build-backend` to build a wheel from the
sdist.  CI still uses `maturin build` to build wheels.  Local
development builds still use `maturin develop`.

The sdist now includes the .data directory so that Maturin will place it
in the wheel correctly.  Building an sdist with PSP_BUILD_SDIST=1 will
now error if it appears the jupyterlab plugin was not built into the
.data directory.

Most of the work is in generating a PKG-INFO file.  Its output matches
what's in the 3.1.2 sdist on pypi, minus a correction to fix the
`Home-page` field miscapitalized by Maturin and some unimportant
whitespace changes in `Require-Dist`.

Signed-off-by: Tom Jakubowski <tom@prospective.dev>
  • Loading branch information
tomjakubowski committed Oct 29, 2024
1 parent 09204c5 commit a8b7bef
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ rustflags = ["-C", "target-feature=+crt-static", "--cfg=web_sys_unstable_apis"]
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static", "--cfg=web_sys_unstable_apis"]

[patch.crates-io]
perspective-client = { path = "rust/perspective-client" }
perspective-server = { path = "rust/perspective-server" }

[future-incompat-report]
frequency = 'never'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ rust/perspective-server/cmake

.pyodide-*/
rust/perspective-python/*.data
rust/perspective-python/PKG-INFO
# rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/package.json
rust/perspective-viewer/docs/exprtk.md
rust/perspective-server/docs/lib_gen.md
Expand Down
7 changes: 2 additions & 5 deletions packages/perspective-jupyterlab/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,8 @@ async function build_all() {
x.replace("-", "").replace(".", "")
);

const psp_dir = `perspective_python-${version}.data`;
await cpy(
["dist/cjs/**/*"],
`../../rust/perspective-python/${psp_dir}/data/share/jupyter/labextensions/@finos/perspective-jupyterlab`
);
const labext_dest = `../../rust/perspective-python/perspective_python-${version}.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab`;
await cpy(["dist/cjs/**/*"], labext_dest);
}

build_all();
100 changes: 100 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions rust/perspective-python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ pyo3-build-config = "0.20.2"
python-config-rs = "0.1.2"

[dependencies]
# NOTE: when building from the git repo, these perspective-* dependencies are
# overridden with path dependencies in .cargo/config.toml. This is done to
# support the sdist, which doesn't include these packages.
perspective-client = { version = "3.1.2" }
perspective-server = { version = "3.1.2" }
async-lock = "2.5.0"
perspective-client = { version = "3.1.2", path = "../perspective-client" }
perspective-server = { version = "3.1.2", path = "../perspective-server" }
pollster = "0.3.0"
extend = "1.1.2"
futures = "0.3.28"
Expand Down
Loading

0 comments on commit a8b7bef

Please sign in to comment.