Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .tests/all_pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,23 @@ function runPyTest () {

# Install the `reboot` package from the specified path explicitly, over-
# writing the version from `pyproject.toml`.
rye remove --no-sync reboot
rye remove --no-sync --dev reboot
rye add --dev reboot --absolute --path=${SANDBOX_ROOT}$REBOOT_WHL_FILE

# Create and activate a virtual environment.
rye sync --no-lock
uv add --no-sync "${SANDBOX_ROOT}$REBOOT_WHL_FILE"

# Force a fresh virtualenv. A pre-existing `.venv/` (e.g., carried
# over from a pre-baked image, or copied between containers/host
# paths during the dev-container test) has its original creation
# path baked into its `activate` script and console-script
# shebangs, which breaks them when the venv is used from a
# different location. `uv sync` only regenerates entry-point
# scripts for packages it reinstalls, so it can't repair a
# relocated venv. Nuking and re-syncing guarantees the venv lives
# at the current path, which makes it safe to `activate`.
rm -rf .venv
uv sync
source .venv/bin/activate

for application_folder in "${all_application_folders[@]}"; do
runPyTest $application_folder
done

# Deactivate the virtual environment, since we can run a test which may require
# another virtual environment (currently we do that only in `all_tests.sh`).
deactivate

# TODO: when relevant, add additional non-pytest tests here.
17 changes: 12 additions & 5 deletions .tests/readme_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ set -x # Echo executed commands to help debug failures.
if [ -n "$REBOOT_WHL_FILE" ]; then
# Install the `reboot` package from the specified path explicitly, over-
# writing the version from `pyproject.toml`.
rye remove --no-sync reboot
rye remove --no-sync --dev reboot
rye add --dev reboot --absolute --path=${SANDBOX_ROOT}$REBOOT_WHL_FILE
uv add --no-sync "${SANDBOX_ROOT}$REBOOT_WHL_FILE"
fi

# Create and activate a virtual environment.
rye sync --no-lock
# Force a fresh virtualenv. A pre-existing `.venv/` (e.g., carried
# over from a pre-baked image, or copied between containers/host
# paths during the dev-container test) has its original creation
# path baked into its `activate` script and console-script
# shebangs, which breaks them when the venv is used from a
# different location. `uv sync` only regenerates entry-point
# scripts for packages it reinstalls, so it can't repair a
# relocated venv. Nuking and re-syncing guarantees the venv lives
# at the current path, which makes it safe to `activate`.
rm -rf .venv
uv sync
source .venv/bin/activate

cd hello-constructors
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Running directly on a host requires:
- Linux: `x86_64` or `arm64`, with `glibc>=2.35` (Ubuntu Jammy and other equivalent-generation distributions)
- Mac: `arm64` (Apple M1 and newer) with `MacOS>=14.0` and `Xcode>=15.2`
- ... or [talk to us](https://discord.gg/cRbdcS94Nr) if your desired platform isn't currently supported!
- [Rye](https://rye-up.com/) - A tool to manage `python`, `pip`, and `venv`.
- [uv](https://docs.astral.sh/uv/) - A tool to manage `python`, `pip`, and `venv`.
- If you are already familiar with Python [virtual environments](https://docs.python.org/3/library/venv.html), feel free to use your tool of choice with [`pyproject.toml`](./pyproject.toml). Python >= 3.10 and < 3.13 is required.
- Docker
- Note: the example does not run "inside of" Docker, but Docker is used to host a native support service for local development.
Expand All @@ -64,9 +64,9 @@ running it. The most notable of those dependencies is the `reboot` PyPI
distribution, which contains both the Reboot CLI (`rbt`) and the `reboot`
Python package.

Using `rye`, we can create and activate a virtualenv containing this project's dependencies (as well as fetch an appropriate Python version) using:
Using `uv`, we can create and activate a virtualenv containing this project's dependencies (as well as fetch an appropriate Python version) using:
```sh
rye sync --no-lock
uv sync
source .venv/bin/activate
```

Expand All @@ -77,7 +77,7 @@ way of keeping the options you have to type (and remember!) to a minimum. We
provide a different `.rbtrc` for every application in this repository, and by
selecting an application directory you select the `.rbtrc` that will be used:

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./.tests/readme_test.sh&lines=24-24) -->
<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./.tests/readme_test.sh&lines=31-31) -->
<!-- The below code snippet is automatically added from ./.tests/readme_test.sh -->

```sh
Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[project]
name = "monorepo"
version = "0.1.0"
requires-python = ">= 3.10"
dependencies = [
"reboot==1.1.0",
"reboot==1.2.0",
]

[tool.rye]
dev-dependencies = [
[dependency-groups]
dev = [
"mypy==1.18.1",
"pytest>=7.4.2",
"types-protobuf>=4.24.0.20240129",
"reboot==1.1.0",
]

# This project only uses `rye` to provide `python` and its dependencies, so
# these settings remove the need to name or version the project.
virtual = true
managed = true
# There is no `[build-system]` table: that tells `uv` this is a virtual
# (non-package) project — it installs the dependencies into `.venv` but
# never tries to build/install the project itself.
Loading
Loading