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
8 changes: 6 additions & 2 deletions .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm

RUN pip3 install "poetry==2.3.3"
COPY --from=ghcr.io/astral-sh/uv:0.11.8 /uv /uvx /bin/

ENV UV_PROJECT_ENVIRONMENT=.venv
ENV UV_LINK_MODE=copy
ENV UV_COMPILE_BYTECODE=1

USER vscode
30 changes: 18 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
"dockerfile": "Containerfile"
},
"runArgs": ["--network=host", "--name=eclypse-dev"],
"containerEnv": {
"POETRY_VIRTUALENVS_CREATE": "true",
"POETRY_VIRTUALENVS_PATH": "/home/vscode/.cache/pypoetry/virtualenvs",
"POETRY_NO_INTERACTION": "1"
},
"remoteUser": "vscode",
"postCreateCommand": "bash .devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -21,17 +18,28 @@
"ms-azuretools.vscode-docker"
],
"settings": {
"python.poetryPath": "/usr/local/bin/poetry",
"[python]": { "editor.formatOnSave": true },
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.terminal.activateEnvironment": true,

"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"tests",
"--cov=eclypse",
"--cov-report=xml",
"--cov-report=term-missing"
"--cov-report=term-missing",
"-n auto"
],
"python.terminal.activateEnvironment": true,

"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff"
},

"ruff.nativeServer": "on",

"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
Expand All @@ -51,7 +59,5 @@
"label": "Ray Dashboard",
"onAutoForward": "silent"
}
},
"postCreateCommand": "bash .devcontainer/post-create.sh",
"remoteUser": "vscode"
}
}
33 changes: 5 additions & 28 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,10 @@

set -euo pipefail

poetry install --with dev,test,docs --extras=remote --extras=tboard
POETRY_ENV_PATH="$(poetry env info --path)"
uv sync --locked --group dev --group test --group docs
uv run --no-sync pre-commit install

for rc_file in "$HOME/.zshrc" "$HOME/.bashrc"; do
marker_start="# >>> eclypse poetry env >>>"
marker_end="# <<< eclypse poetry env <<<"
mkdir -p "$HOME/.local/share/zsh/site-functions"

touch "$rc_file"

if grep -Fq "$marker_start" "$rc_file"; then
tmp_file="$(mktemp)"
awk -v start="$marker_start" -v end="$marker_end" '
$0 == start { skip = 1; next }
$0 == end { skip = 0; next }
skip != 1 { print }
' "$rc_file" > "$tmp_file"
mv "$tmp_file" "$rc_file"
fi

cat <<EOF >> "$rc_file"
$marker_start
if [ -f "$POETRY_ENV_PATH/bin/activate" ]; then
source "$POETRY_ENV_PATH/bin/activate"
fi
$marker_end
EOF
done

source "$POETRY_ENV_PATH/bin/activate"
poetry run pre-commit install
uv generate-shell-completion zsh > "$HOME/.local/share/zsh/site-functions/_uv"
uvx --generate-shell-completion zsh > "$HOME/.local/share/zsh/site-functions/_uvx"
34 changes: 26 additions & 8 deletions .github/workflows/build_and_deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build and Deploy to PyPI

on:
workflow_dispatch:
push:
Expand All @@ -18,16 +19,33 @@ jobs:
with:
python-version: "3.11"

- name: Install Dependencies
run: make setup-build
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Install dependencies
run: |
uv sync --group dev --group deploy --no-install-project

- name: Check formatting and linting
run: |
uv run --no-sync isort --check-only eclypse
uv run --no-sync ruff check
uv run --no-sync ruff format --check

- name: Build the Package
run: make build
- name: Build wheel
run: |
uv build --wheel --clear --no-create-gitignore

- name: Verify the distribution
run: make verify
- name: Verify distribution
run: |
uv run --no-sync twine check --strict dist/*

- name: Upload to PyPI
# publish only on tags
if: startsWith(github.ref, 'refs/tags/')
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN_PUBLIC }}
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN_PUBLIC }}
poetry publish --skip-existing -vv --no-interaction
uv publish -v
19 changes: 14 additions & 5 deletions .github/workflows/upload_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ on:
- "eclypse/**"
- "tests/**"
- "pyproject.toml"
- "poetry.lock"
- "uv.lock"
- ".github/workflows/upload_coverage.yaml"
pull_request:
paths:
- "eclypse/**"
- "tests/**"
- "pyproject.toml"
- "poetry.lock"
- "uv.lock"
- ".github/workflows/upload_coverage.yaml"

jobs:
test:
name: Run tests on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: [ "3.11", "3.12", "3.13" ]

steps:
- name: Checkout Source Code
uses: actions/checkout@v6
Expand All @@ -35,11 +37,18 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: make setup-test
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Install dependencies
run: |
uv sync --group test

- name: Run tests
run: poetry run pytest
run: |
uv run --no-sync pytest

- name: Upload results to Codecov
if: matrix.python-version == '3.11'
Expand Down
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -93,13 +93,6 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
12 changes: 7 additions & 5 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ build:
os: "ubuntu-22.04"
tools:
python: "3.11"
jobs:
post_create_environment:
- pip install poetry
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

python:
install:
- method: uv
command: sync
groups:
- docs

sphinx:
configuration: docs/conf.py
34 changes: 15 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DEFAULT_GOAL := check

PYTHON ?= python3

check:
pre-commit run -a

Expand All @@ -9,31 +11,25 @@ changelog:
patch:
cz bump --changelog --increment patch

setup:
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false
echo "Poetry virtualenv creation disabled for CI. To re-enable, run `poetry config virtualenvs.create true`."

setup-build: setup
poetry install --with=dev,deploy --no-root
setup-build:
uv sync --group dev --group deploy --no-install-project

setup-test: setup
poetry install --with=test --no-root
setup-test:
uv sync --group test --no-install-project

format:
poetry run isort eclypse
poetry run ruff check
poetry run ruff format

build: format
poetry build -v --no-cache --format wheel
isort eclypse
ruff check
ruff format

verify:
poetry run twine check --strict dist/*
twine check --strict dist/*

build: format
uv build --wheel --clear --no-create-gitignore

publish-test: build verify
poetry publish -r test-pypi --skip-existing -v
UV_PUBLISH_TOKEN="$$UV_TEST_PYPI_ECLYPSE" uv publish --index testpypi -v

publish: build verify
poetry publish --skip-existing -v
uv publish -v
2 changes: 1 addition & 1 deletion docs/source/overview/examples/echo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Run it from the repository root with:

.. code-block:: bash

poetry run echo
uv run echo

Application
-----------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/examples/grid_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Run it from the repository root with:

.. code-block:: bash

poetry run grid-analysis
uv run grid-analysis

Simulation sweep
----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/examples/image_prediction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Run it from the repository root with:

.. code-block:: bash

poetry run image-prediction
uv run image-prediction

Application
-----------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/examples/off_the_shelf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Run it from the repository root with:

.. code-block:: bash

poetry run off-the-shelf
uv run off-the-shelf

Application
-----------
Expand Down
4 changes: 2 additions & 2 deletions docs/source/overview/examples/sock_shop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Run either variant from the repository root with:

.. code-block:: bash

poetry run sock-shop-mpi
poetry run sock-shop-rest
uv run sock-shop-mpi
uv run sock-shop-rest

.. warning::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview/examples/user_distribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Run it from the repository root with:

.. code-block:: bash

poetry run user-distribution
uv run user-distribution

Infrastructure
--------------
Expand Down
16 changes: 8 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ECLYPSE Examples

Run examples from the repository root with Poetry scripts.
Run examples from the repository root with uv scripts.

| Name | Demonstrates | How to run | Docs |
| --- | --- | --- | --- |
| Echo | A small application comparing service communication patterns. | `poetry run echo` | `docs/source/overview/examples/echo.rst` |
| Off the shelf | Built-in infrastructure, application, placement, and metrics. | `poetry run off-the-shelf` | `docs/source/overview/examples/off_the_shelf.rst` |
| Sock Shop MPI | Remote emulation of the Sock Shop application using MPI communication. | `poetry run sock-shop-mpi` | `docs/source/overview/examples/sock_shop.rst` |
| Sock Shop REST | Remote emulation of the Sock Shop application using REST communication. | `poetry run sock-shop-rest` | `docs/source/overview/examples/sock_shop.rst` |
| Grid analysis | Ray Tune parameter sweeps over topologies, policies, and strategies. | `poetry run grid-analysis` | `docs/source/overview/examples/grid_analysis.rst` |
| Image prediction | Remote image-prediction services with custom metrics and degradation. | `poetry run image-prediction` | `docs/source/overview/examples/image_prediction.rst` |
| User distribution | User-distribution-driven infrastructure changes and custom metrics. | `poetry run user-distribution` | `docs/source/overview/examples/user_distribution.rst` |
| Echo | A small application comparing service communication patterns. | `uv run echo` | `docs/source/overview/examples/echo.rst` |
| Off the shelf | Built-in infrastructure, application, placement, and metrics. | `uv run off-the-shelf` | `docs/source/overview/examples/off_the_shelf.rst` |
| Sock Shop MPI | Remote emulation of the Sock Shop application using MPI communication. | `uv run sock-shop-mpi` | `docs/source/overview/examples/sock_shop.rst` |
| Sock Shop REST | Remote emulation of the Sock Shop application using REST communication. | `uv run sock-shop-rest` | `docs/source/overview/examples/sock_shop.rst` |
| Grid analysis | Ray Tune parameter sweeps over topologies, policies, and strategies. | `uv run grid-analysis` | `docs/source/overview/examples/grid_analysis.rst` |
| Image prediction | Remote image-prediction services with custom metrics and degradation. | `uv run image-prediction` | `docs/source/overview/examples/image_prediction.rst` |
| User distribution | User-distribution-driven infrastructure changes and custom metrics. | `uv run user-distribution` | `docs/source/overview/examples/user_distribution.rst` |
Loading