Skip to content

Commit

Permalink
Fix the science binary URL in provenance. (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirois authored May 17, 2023
1 parent a2d4719 commit 4568bd3
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## 0.1.1

Fix provenance (`science lift --include-provenance ...`) to include the correct download URL for
the science binary used to build the scie.

## 0.1.0

The 1st public release of the project.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,43 @@
[![Github Actions CI (x86_64 Linux / MacOS / Windows)](https://github.com/a-scie/lift/actions/workflows/ci.yml/badge.svg)](https://github.com/a-scie/lift/actions/workflows/ci.yml)
[![CircleCI (Linux aarch64)](https://circleci.com/gh/a-scie/lift.svg?style=svg)](https://circleci.com/gh/a-scie/lift)

Delivers science, a high level tool to build scies with.
Delivers `science`, a high level tool to build scies with.

The `science` tool is intended to be the primary tool used by applications to build scies. Although
the [`scie-jump`](https://github.com/a-scie/jump) provides everything needed to build a scie, it is
low-level and will always have some sharp corners, including its JSON lift manifest format.

The `science` binary is itself a scie built with `science` using the application manifest at
[lift.toml](lift.toml).

## Installing

You'll need to download the correct binary for your system, mark it as executable and place it on
your $PATH somewhere.

The binaries are released via [GitHub Releases](https://github.com/a-scie/lift/releases)
for Windows x86_64 and Linux and macOS for both aarch64 and x86_64. For each of these platforms
there are two varieties, "thin" and "fat". The "fat" varieties are named `science-fat-*`, include
a hermetic CPython 3.11 distribution from the [Python Build Standalone]() project and are larger as
a result. The "thin" varieties have the CPython 3.11 distribution gouged out and are smaller as a
result. In its place a [`ptex`](https://github.com/a-scie/ptex) binary is included that fills in the
CPython 3.11 distribution by fetching it when the "thin" `science` binary is first run.

I run on Linux x86_64; so I install a stable release like so:
```
curl -fLO \
https://github.com/a-scie/lift/releases/download/v0.1.0/science-linux-x86_64
curl -fL \
https://github.com/a-scie/lift/releases/download/v0.1.0/science-linux-x86_64.sha256 \
| sha256sum -c -
chmod +x science-linux-x86_64 && mv science-linux-x86_64 ~/bin/science
```

The high level documentation is currently thin! The command line help is pretty decent though; so
try there 1st starting with just running `science` with no arguments.

If you'd like to build you own version, see the [contribution guide](CONTRIBUTING.md). There are
build instructions there.

## Contribute

Expand Down
22 changes: 11 additions & 11 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@

### Push Release Tag

Sync a local branch with https://github.com/a-scie/jump main and confirm it has the version bump
Sync a local branch with https://github.com/a-scie/lift main and confirm it has the version bump
and changelog update as the tip commit:

```
$ git log --stat -1 HEAD
commit 01f3a0a8c9c278f092f13ce802bb10e6d3a16696 (HEAD -> main, upstream/main, upstream/HEAD)
commit b46e245557f776594339e351ecf34e5c0fafb4d2 (HEAD -> main, upstream/main, upstream/HEAD)
Author: John Sirois <[email protected]>
Date: Wed May 17 10:26:46 2023 -0700
Date: Wed May 17 11:08:18 2023 -0700
Prepare the 0.1.0 release.
Fix the science binary URL in provenance.
.circleci/config.yml | 70 ++++++++++++++++++++++++++++++++++++
.github/workflows/release.yml | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++
CHANGES.md | 5 +++
CONTRIBUTING.md | 37 +++++++++++++++++++
README.md | 5 +++
RELEASE.md | 43 ++++++++++++++++++++++
6 files changed, 258 insertions(+)
CHANGES.md | 5 +++++
RELEASE.md | 2 +-
science/__init__.py | 2 +-
science/build_info.py | 6 +++---
science/lift.py | 2 +-
tests/test_exe.py | 2 +-
6 files changed, 12 insertions(+), 7 deletions(-)
```

Tag the release as `v<version>` and push the tag to https://github.com/a-scie/lift main:
Expand Down
19 changes: 15 additions & 4 deletions lift.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
[lift]
# Name can be over-ridden with `science lift --app-name ...` which we do when producing "fat" scies.
name = "science"
# We do this here and dogfood ourself!
description = "Ship your interpreted executables using science."

[[lift.interpreters]]
id = "cpython"
provider = "PythonBuildStandalone"
release = "20230507"
version = "3.11.3"
# By default science ships as a "thin" scie that fetches CPython 3.11 on first run.
# We use `science lift --invert-lazy cpython ...` when producing "fat" scies.
lazy = true

[[lift.files]]
# The nox build emits this at `dist/science.pyz` and so our packaging process maps that path using
# `science lift --file science.pyz=dist/science.pyz ...`.
name = "science.pyz"

[[lift.commands]]
# This selects the `python` binary from within the CPython 3.11 interpreter distribution
# (a tarball) provided by PythonBuildStandalone above.
exe = "#{cpython:python}"
args = [
"{science.pyz}",
]
env.remove_re = [

[lift.commands.env]
# We strip any ambient SHIV_* env vars and set the SHIV_ROOT to ensure hermetic operation. Although
# `science` is a Python 3.11 shiv zipapp application under the covers; this should be opaque to the
# end user. For their puposes `science` is just a native binary.
remove_re = [
"SHIV_.*",
]

[lift.commands.env.replace]
SHIV_ROOT = "{scie.bindings}/shiv_root"
replace = { SHIV_ROOT = "{scie.bindings}/shiv_root" }
2 changes: 1 addition & 1 deletion science/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Science project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).

__version__ = "0.1.0"
__version__ = "0.1.1"
6 changes: 3 additions & 3 deletions science/build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ def gather(
git_state: str | None = None
app_info: FrozenDict[str, Any] = FrozenDict()

def to_dict(self, **extra_app_info: Any) -> dict[str, Any]:
def to_dict(self, app_name: str = "science", **extra_app_info: Any) -> dict[str, Any]:
binary = dict[str, Any](
version=__version__,
url=(
f"https://github.com/a-scie/lift/releases/tag/v{__version__}/"
f"{Platform.current().qualified_binary_name('science')}"
f"https://github.com/a-scie/lift/releases/download/v{__version__}/"
f"{Platform.current().qualified_binary_name(app_name)}"
),
)
if self.digest:
Expand Down
2 changes: 1 addition & 1 deletion science/lift.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def render_commands(cmds: Iterable[Command]) -> dict[str, dict[str, Any]]:
}
data = dict[str, Any](scie=scie_data)
if build_info:
data.update(science=build_info.to_dict(**(app_info or {})))
data.update(science=build_info.to_dict(app_name=name, **(app_info or {})))
if fetch_urls:
data.update(ptex=fetch_urls)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def create_and_inspect(*args: str, additional_toml: str = "") -> dict[str, Any]:
binary_info = build_info["binary"]
assert __version__ == binary_info["version"]
assert binary_info["url"].startswith(
f"https://github.com/a-scie/lift/releases/tag/v{__version__}/"
f"https://github.com/a-scie/lift/releases/download/v{__version__}/"
)

data = create_and_inspect(
Expand Down

0 comments on commit 4568bd3

Please sign in to comment.