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
51 changes: 51 additions & 0 deletions .github/workflows/check-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Check Requirements Up-to-Date

on:
pull_request:
paths:
- "pyproject.toml"
- "uv.lock"
- "requirements/requirements-api.txt"
- ".github/workflows/check-requirements.yml"
push:
branches: [master]
paths:
- "pyproject.toml"
- "uv.lock"
- "requirements/requirements-api.txt"

permissions:
contents: read

jobs:
check-requirements:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
with:
version: "latest"

- name: Set up Python
run: uv python install 3.12

- name: Generate requirements file from lock
run: |
uv export --extra api --no-hashes --format requirements-txt > requirements/requirements-api-check.txt

- name: Check if requirements file is up-to-date
run: |
if ! diff -u requirements/requirements-api.txt requirements/requirements-api-check.txt; then
echo "❌ Error: requirements/requirements-api.txt is out of date!"
echo ""
echo "Please regenerate it by running:"
echo " uv export --extra api --no-hashes --format requirements-txt > requirements/requirements-api.txt"
echo ""
echo "Then commit the updated file."
exit 1
else
echo "✅ requirements/requirements-api.txt is up-to-date"
fi
9 changes: 0 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ jobs:
tar -xvf clever-tools-${CC_VERSION}_linux.tar.gz
PATH=${PATH}:$(pwd)/clever-tools-${CC_VERSION}_linux

- name: Install uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
with:
version: "latest"

- name: Set up Python
run: uv python install 3.12

- name: Login to Clever Cloud
env:
CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }}
Expand All @@ -46,7 +38,6 @@ jobs:
CLEVER_APP_ID: ${{ secrets.BE_CLEVER_APP_ID_PROD }}
APP_NAME: cc_api_prod
run: |
uv pip compile pyproject.toml --extra api --output-file requirements/requirements-api.txt
./clever-tools-latest_linux/clever link $CLEVER_APP_ID
./clever-tools-latest_linux/clever deploy -f

Expand Down
23 changes: 23 additions & 0 deletions requirements/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Requirements Files

This directory contains pre-compiled requirements files for different use cases.

## requirements-api.txt

This file contains all dependencies needed to run the CodeCarbon API server (carbonserver).

### Updating the file

When you modify dependencies in `pyproject.toml` or when `uv.lock` changes (especially those under the `[project.optional-dependencies.api]` section), you **must** regenerate this file:

```bash
uv export --extra api --no-hashes --format requirements-txt > requirements/requirements-api.txt
```

Then commit the updated file.

**Note:** This uses `uv.lock` to ensure fully reproducible builds with the exact same versions that are tested in CI.

### CI Check

A GitHub Actions workflow (`.github/workflows/check-requirements.yml`) automatically verifies that this file is up-to-date on every pull request that modifies `pyproject.toml`. If the check fails, simply run the command above and commit the changes.
Loading
Loading