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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
updates:

# Maintain dependencies for Python
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "monthly"
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/deploytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
- name: pip cache
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pyprod-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pyprod-
- name: Install pip-tools and python dependencies
activate-environment: "true"
enable-cache: "true"
- name: Install python dependencies with uv
run: |
# Pin pip to 25.2 to avoid incompatibility with pip-tools and 25.3
# see https://github.com/jazzband/pip-tools/issues/2252
python -m pip install pip==25.2
pip install pip-tools
pip-sync requirements.txt
# Use uv to install dependencies directly from requirements files
uv pip sync requirements.txt
- name: Use pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
- name: Use pnpm
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/pythontest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,16 @@ jobs:
-e "MINIO_ROOT_PASSWORD=development" \
-e "MINIO_DEFAULT_BUCKETS=content:public" \
bitnamilegacy/minio:2024.5.28
- name: Set up Python 3.10
uses: actions/setup-python@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.10'
- name: pip cache
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pytest-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pytest-
- name: Install pip-tools and python dependencies
activate-environment: "true"
enable-cache: "true"
- name: Install python dependencies with uv
run: |
# Pin pip to 25.2 to avoid incompatibility with pip-tools and 25.3
# see https://github.com/jazzband/pip-tools/issues/2252
python -m pip install pip==25.2
pip install pip-tools
pip-sync requirements.txt requirements-dev.txt
# Use uv to install dependencies directly from requirements files
uv pip sync requirements.txt requirements-dev.txt
- name: Test pytest
run: |
sh -c './contentcuration/manage.py makemigrations --check'
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,3 @@ storybook-static/

# i18n
/contentcuration/locale/**/LC_MESSAGES/*.csv

# pyenv
.python-version
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
8 changes: 4 additions & 4 deletions docs/dependencies.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Adding or updating dependencies

We use `pip-tools` to ensure all our dependencies use the same versions on all deployments.
We use `uv` to manage Python dependencies and generate requirements files.

To add a dependency, add it to either `requirements.in` or `requirements-dev.in`, then
run `pip-compile requirements[-dev].in` to generate the .txt file. Please make sure that
run `uv pip compile requirements[-dev].in` to generate the .txt file. Please make sure that
both the `.in` and `.txt` file changes are part of the commit when updating dependencies.

To update a dependency, use `pip-compile --upgrade-package [package-name] requirements[-dev].in`
To update a dependency, use `uv pip compile --upgrade-package [package-name] requirements[-dev].in`

For more details, please see the [pip-tools docs on Github](https://github.com/jazzband/pip-tools).
For more details, please see the [uv documentation](https://docs.astral.sh/uv/).
2 changes: 1 addition & 1 deletion docs/host_services_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This guide will walk through setting up Kolibri Studio for local development, where you'll run Studio's Python apps and all of Studio's services on your host machine, without the need for docker.

## Prerequisites
For detailed instructions on installing and configuring Volta, pyenv, and pyenv-virtualenv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.
For detailed instructions on installing and configuring Volta and uv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.

## Install system dependencies and services
Studio requires some background services to be running:
Expand Down
4 changes: 2 additions & 2 deletions docs/local_dev_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ The following guide utilizes docker and docker-compose to run select services re
**Note:** If you are developing on Windows, it is recommended to use WSL (Windows Subsystem for Linux). Please follow the [WSL setup guide](./local_dev_wsl.md) for detailed instructions.

## Prerequisites
For detailed instructions on installing and configuring Volta, pyenv, and pyenv-virtualenv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.
For detailed instructions on installing and configuring Volta and uv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.

## Build your python virtual environment
For complete instructions on installing Python 3.10.13, creating and activating the virtual environment, and installing Studio’s Python dependencies, please refer to the [Build Your Python Virtual Environment](./local_dev_host.md#build-your-python-virtual-environment) section in our Local Development with host guide.
For complete instructions on creating and activating the virtual environment, and installing Studio’s Python dependencies, please refer to the [Build Your Python Virtual Environment](./local_dev_host.md#build-your-python-virtual-environment) section in our Local Development with host guide.


### A note about dependencies on Apple Silicon M1+
Expand Down
30 changes: 13 additions & 17 deletions docs/local_dev_host.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This guide will walk through setting up Kolibri Studio for local development, wh

## Prerequisites
- [volta](https://docs.volta.sh/guide/getting-started)
- [pyenv](https://kolibri-dev.readthedocs.io/en/develop/howtos/installing_pyenv.html) and [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv#installation)
- [uv](https://docs.astral.sh/uv/) - Python package installer and virtual environment manager

## Install system dependencies and services
Studio requires some background services to be running:
Expand Down Expand Up @@ -75,29 +75,25 @@ exit # leave the postgres account
```

## Build your python virtual environment
To determine what version of Python studio needs, you can check the `runtime.txt` file:
```bash
$ cat runtime.txt
# This is the required version of Python to run Studio currently.
# This is determined by the default Python 3 version that is installed
# inside Ubuntu Bionic, which is used to build images for Studio.
# We encode it here so that it can be picked up by Github's dependabot
# to manage automated package upgrades.
python-3.10.13
```
So to install python 3.10.13 through `pyenv` and set up a virtual environment:

Studio uses [uv](https://docs.astral.sh/uv/) for Python dependency management and virtual environments. To set up your development environment:

```bash
pyenv install 3.10.13
pyenv virtualenv 3.10.13 studio-py3.10
pyenv activate studio-py3.10
# Create a virtual environment with uv (this will use the system Python or uv-managed Python)
uv venv --seed

# Activate the virtual environment
source .venv/bin/activate
```

Now you may install Studio's Python dependencies:
```bash
pip install -r requirements.txt -r requirements-dev.txt
uv pip sync requirements.txt requirements-dev.txt
```

To deactivate the virtual environment, when you're finished developing on Studio for the time being:
```bash
pyenv deactivate
deactivate
```

### A note about `psycopg2`
Expand Down
4 changes: 2 additions & 2 deletions docs/local_dev_wsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ git clone https://github.com/$USERNAME/studio.git
Replace `$USERNAME` with your GitHub username.

## Install Prerequisites
For detailed instructions on installing and configuring Volta, pyenv, and pyenv-virtualenv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.
For detailed instructions on installing and configuring Volta and uv, please see the [Prerequisites](./local_dev_host.md#prerequisites) section in our Local Development with host guide.

## Install System Dependencies and Services

Expand Down Expand Up @@ -171,7 +171,7 @@ Now that you have your project open in VS Code, you can run the same commands yo
2. **Activate the Python Virtual Environment**:

```sh
pyenv activate studio-py3.10
source .venv/bin/activate
```
3. **Run the Services**:

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ pytest-django
pytest-timeout
pre-commit==4.5.1
nodeenv
pip-tools==7.5.2
drf-yasg==1.21.10
29 changes: 3 additions & 26 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements-dev.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements-dev.in --output-file requirements-dev.txt
asgiref==3.3.4
# via
# -c requirements.txt
# django
build==1.2.1
# via pip-tools
cfgv==3.3.1
# via pre-commit
click==8.1.3
# via
# -c requirements.txt
# pip-tools
distlib==0.3.9
# via virtualenv
django==3.2.24
Expand Down Expand Up @@ -58,12 +48,8 @@ nodeenv==1.10.0
packaging==25.0
# via
# -c requirements.txt
# build
# drf-yasg
# pytest
# wheel
pip-tools==7.5.2
# via -r requirements-dev.in
platformdirs==4.3.6
# via virtualenv
pluggy==1.5.0
Expand All @@ -72,10 +58,6 @@ pre-commit==4.5.1
# via -r requirements-dev.in
pygments==2.19.1
# via pytest
pyproject-hooks==1.1.0
# via
# build
# pip-tools
pytest==9.0.2
# via
# -r requirements-dev.in
Expand Down Expand Up @@ -110,10 +92,7 @@ sqlparse==0.4.1
tblib==1.7.0
# via django-concurrent-test-helper
tomli==1.2.3
# via
# build
# pip-tools
# pytest
# via pytest
typing-extensions==4.15.0
# via
# -c requirements.txt
Expand All @@ -123,5 +102,3 @@ uritemplate==3.0.1
# via drf-yasg
virtualenv==20.36.1
# via pre-commit
wheel==0.46.2
# via pip-tools
4 changes: 2 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ python-postmark==0.7.0
Django==3.2.24
django-webpack-loader==0.7.0
google-cloud-error-reporting
google-cloud-storage
google-cloud-storage==2.19.0
django-s3-storage==0.15.0
requests>=2.20.0
google-cloud-core
django-db-readonly==0.7.0
google-cloud-kms==2.10.0
google-cloud-kms==2.24.2
google-crc32c==1.8.0
backoff
django-model-utils==5.0.0
Expand Down
Loading