Skip to content

Commit f64817f

Browse files
committed
run cruft update
1 parent 8af6dc6 commit f64817f

6 files changed

Lines changed: 105 additions & 7 deletions

File tree

.cruft.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/runtimeverification/python-project-template",
3-
"commit": "601d5e2a0e8a98c87dcb1ae694d22d76d0114e01",
3+
"commit": "7a095b4dd0a51916da0a728b8fdd9adf7e469a68",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -11,7 +11,8 @@
1111
"description": "K tooling for the Soroban platform",
1212
"author_name": "Runtime Verification, Inc.",
1313
"author_email": "contact@runtimeverification.com",
14-
"_template": "https://github.com/runtimeverification/python-project-template"
14+
"_template": "https://github.com/runtimeverification/python-project-template",
15+
"_commit": "7a095b4dd0a51916da0a728b8fdd9adf7e469a68"
1516
}
1617
},
1718
"directory": null

Makefile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
UV := uv
2-
UV_RUN := $(UV) run
2+
UV_RUN := $(UV) run --
33

44

55
default: check test-unit
66

7+
.PHONY: build
8+
build:
9+
$(UV) build
10+
711
all: check cov
812

913
.PHONY: clean
@@ -14,26 +18,30 @@ clean:
1418
# Semantics
1519

1620
kdist-build:
17-
$(UV) run kdist -v build -j2 soroban-semantics.*
21+
$(UV_RUN) kdist -v build -j2 soroban-semantics.*
1822

1923
kdist-clean:
20-
$(UV) run kdist clean
24+
$(UV_RUN) kdist clean
2125

2226
# Tests
2327

2428
TEST_ARGS :=
2529

2630
test: test-all
2731

32+
.PHONY: test-all
2833
test-all:
2934
$(UV_RUN) pytest src/tests --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS)
3035

36+
.PHONY: test-unit
3137
test-unit:
3238
$(UV_RUN) pytest src/tests/unit --maxfail=1 --verbose $(TEST_ARGS)
3339

40+
.PHONY: test-integration
3441
test-integration:
3542
$(UV_RUN) pytest src/tests/integration --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS)
3643

44+
.PHONY: test-lemmas
3745
test-lemmas:
3846
$(UV_RUN) pytest src/tests/lemmas --maxfail=1 --verbose --durations=0 --numprocesses=4 --dist=worksteal $(TEST_ARGS)
3947

@@ -60,27 +68,35 @@ cov-integration: test-integration
6068
format: autoflake isort black
6169
check: check-flake8 check-mypy check-autoflake check-isort check-black
6270

71+
.PHONY: check-flake8
6372
check-flake8:
6473
$(UV_RUN) flake8 src
6574

75+
.PHONY: check-mypy
6676
check-mypy:
6777
$(UV_RUN) mypy src
6878

79+
.PHONY: autoflake
6980
autoflake:
7081
$(UV_RUN) autoflake --quiet --in-place src
7182

83+
.PHONY: check-autoflake
7284
check-autoflake:
7385
$(UV_RUN) autoflake --quiet --check src
7486

87+
.PHONY: isort
7588
isort:
7689
$(UV_RUN) isort src
7790

91+
.PHONY: check-isort
7892
check-isort:
7993
$(UV_RUN) isort --check src
8094

95+
.PHONY: black
8196
black:
8297
$(UV_RUN) black src
8398

99+
.PHONY: check-black
84100
check-black:
85101
$(UV_RUN) black --check src
86102

@@ -89,5 +105,6 @@ check-black:
89105

90106
SRC_FILES := $(shell find src -type f -name '*.py')
91107

108+
.PHONY: pyupgrade
92109
pyupgrade:
93110
$(UV_RUN) pyupgrade --py310-plus $(SRC_FILES)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
## Installation
55

6-
Prerequsites: `python >= 3.10`, `pip >= 20.0.2`, `poetry >= 1.3.2`.
6+
Prerequsites: `python >= 3.10`, [`uv`](https://docs.astral.sh/uv/).
77

88
```bash
99
make build
@@ -19,5 +19,5 @@ Use `make` to run common tasks (see the [Makefile](Makefile) for a complete list
1919
* `make check`: Check code style
2020
* `make format`: Format code
2121
* `make test-unit`: Run unit tests
22+
* `make test-integration`: Run integration tests
2223

23-
For interactive use, spawn a shell with `poetry shell` (after `poetry install`), then run an interpreter.

nix/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Notes
2+
#### git submodules
3+
If you use git submodules that are not required for building the project with `nix`, then you should add these directories to the `gitignoreSourcePure` list in `nix/komet/default.nix`, see the respective left-over `TODO` in the nix file. Otherwise, the nix build that is uploaded to the nix binary cache by CI might not match the version that is requested by `kup`, in case this project is offered as a package by `kup`. This is due to weird behaviour in regards to git submodules by `git` and `nix`, where a submodule directory might exist and be empty or instead not exist, which impacts the resulting nix hash, which is of impartance when offering/downloading cached nix derivations. See [runtimeverification/k/pull/4804](https://github.com/runtimeverification/k/pull/4804) for more information.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
final: prev:
2+
let
3+
inherit (final) resolveBuildSystem;
4+
inherit (builtins) mapAttrs;
5+
6+
# Build system dependencies specified in the shape expected by resolveBuildSystem
7+
# The empty lists below are lists of optional dependencies.
8+
#
9+
# A package `foo` with specification written as:
10+
# `setuptools-scm[toml]` in pyproject.toml would be written as
11+
# `foo.setuptools-scm = [ "toml" ]` in Nix
12+
buildSystemOverrides = {
13+
# add dependencies here, e.g.:
14+
# pyperclip.setuptools = [ ];
15+
};
16+
in
17+
mapAttrs (
18+
name: spec:
19+
prev.${name}.overrideAttrs (old: {
20+
nativeBuildInputs = old.nativeBuildInputs ++ resolveBuildSystem spec;
21+
})
22+
) buildSystemOverrides

nix/komet/default.nix

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
lib,
3+
callPackage,
4+
nix-gitignore,
5+
6+
pyproject-nix,
7+
pyproject-build-systems,
8+
uv2nix,
9+
10+
python
11+
}:
12+
let
13+
pyproject-util = callPackage pyproject-nix.build.util {};
14+
pyproject-packages = callPackage pyproject-nix.build.packages {
15+
inherit python;
16+
};
17+
18+
# load a uv workspace from a workspace root
19+
workspace = uv2nix.lib.workspace.loadWorkspace {
20+
workspaceRoot = lib.cleanSource (nix-gitignore.gitignoreSourcePure [
21+
../../.gitignore
22+
".github/"
23+
"result*"
24+
# do not include submodule directories that might be initilized empty or non-existent due to nix/git
25+
# otherwise cachix build might not match the version that is requested by `kup`
26+
# TODO: for new projects, add your submodule directories that are not required for nix builds here!
27+
# e.g., `"/docs/external-computation"` with `external-computation` being a git submodule directory
28+
# "/docs/external-computation"
29+
] ../..
30+
);
31+
};
32+
33+
# create overlay
34+
lockFileOverlay = workspace.mkPyprojectOverlay {
35+
# prefer "wheel" over "sdist" due to maintance overhead
36+
# there is no bundled set of overlays for "sdist" in uv2nix, in contrast to poetry2nix
37+
sourcePreference = "wheel";
38+
};
39+
40+
buildSystemsOverlay = import ./build-systems-overlay.nix;
41+
42+
# construct package set
43+
pythonSet = pyproject-packages.overrideScope (lib.composeManyExtensions [
44+
# make build tools available by default as these are not necessarily specified in python lock files
45+
pyproject-build-systems.overlays.default
46+
# include all packages from the python lock file
47+
lockFileOverlay
48+
# add build system overrides to certain python packages
49+
buildSystemsOverlay
50+
]);
51+
in pyproject-util.mkApplication {
52+
# default dependancy group enables no optional dependencies and no dependency-groups
53+
venv = pythonSet.mkVirtualEnv "komet-env" workspace.deps.default;
54+
package = pythonSet.komet;
55+
}

0 commit comments

Comments
 (0)