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 .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
!pydis_core/
!dev/
!pyproject.toml
!poetry.lock
!uv.lock
!README.md
12 changes: 11 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
version: 2

updates:
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
- version-update:semver-minor
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
26 changes: 18 additions & 8 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.2
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python_version: "3.11"
install_args: "--extras async-rediscache --only main --only doc"
enable-cache: true
resolution-strategy: "lowest"
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --locked --group doc --extra async-rediscache

- name: Generate HTML Site
run: sphinx-build -nW -j auto -b html docs docs/build
Expand All @@ -37,11 +42,16 @@ jobs:
with:
fetch-depth: 0 # We need to check out the entire repository to find all tags

- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.2
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python_version: "3.11"
install_args: "--extras async-rediscache"
enable-cache: true
resolution-strategy: "lowest"
cache-dependency-glob: "uv.lock"
activate-environment: true

- name: Install dependencies
run: uv sync --locked --group doc --extra async-rediscache

- name: Build All Doc Versions
run: sphinx-multiversion docs docs/build -n -j auto
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python_version: ["3.11", "3.12"]
python_version: ["3.11", "3.12", "3.13", "3.14"]

name: Run Linting & Test Suites
runs-on: ubuntu-latest
steps:
- name: Install Python Dependencies
uses: HassanAbouelela/actions/setup-python@setup-python_v1.4.2
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python_version: ${{ matrix.python_version }}
install_args: "--extras async-rediscache --only main --only lint --only test"
enable-cache: true
resolution-strategy: "lowest"
cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python_version }}
activate-environment: true

- name: Install dependencies
run: uv sync --locked --group lint --group test --extra async-rediscache

- name: Run pre-commit hooks
run: SKIP=ruff pre-commit run --all-files
Expand All @@ -30,7 +38,7 @@ jobs:
run: python -m pytest -n auto --cov pydis_core -q

- name: Build and dry run the example bot to ensure deps can be installed & imported
run: docker run --rm --env GUILD_ID=1234 --env IN_CI=true $(docker build --build-arg python_version=${{ matrix.python_version }} -q -f ./dev/Dockerfile .) run python -m dev.bot
run: docker run --rm --env GUILD_ID=1234 --env IN_CI=true $(docker build --build-arg python_version=${{ matrix.python_version }} -q -f ./dev/Dockerfile .)

# Prepare the Pull Request Payload artifact. If this fails, we
# we fail silently using the `continue-on-error` option. It's
Expand Down
25 changes: 16 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand All @@ -11,11 +11,18 @@ repos:

- repo: local
hooks:
- id: ruff
name: ruff
description: Run ruff linting
entry: poetry run ruff check --force-exclude
language: system
'types_or': [python, pyi]
require_serial: true
args: [--fix, --exit-non-zero-on-fix]
- id: uv-lock
name: uv-lock
description: "Automatically run 'uv lock' on your project dependencies"
entry: uv lock
language: system
files: ^(uv\.lock|pyproject\.toml|uv\.toml)$
pass_filenames: false
- id: ruff
name: ruff
description: Run ruff linting
entry: uv run --locked ruff check --force-exclude
language: system
'types_or': [python, pyi]
require_serial: true
args: [--fix, --exit-non-zero-on-fix]
23 changes: 16 additions & 7 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
ARG python_version=3.11
ARG python_version=3.14-slim

FROM --platform=linux/amd64 ghcr.io/owl-corp/python-poetry-base:$python_version-slim
FROM python:$python_version AS builder
COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /bin/

ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy

# Install project dependencies
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-root --only dev,main
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --no-install-project --frozen --group dev

# Copy the source code in last to optimize rebuilding the image
COPY . .

# Install again, this time with the root project
RUN poetry install --only-root
RUN uv pip install "pydis_core[all]@."

WORKDIR /app/dev
ENV PATH="/app/.venv/bin:$PATH"

ENTRYPOINT ["poetry"]
CMD ["run", "python", "-m", "bot"]
ENTRYPOINT ["python"]
CMD ["-m", "bot"]
2 changes: 1 addition & 1 deletion dev/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Option 1
- The path provided to install should be the root directory of this project on your machine.
That is, the folder which contains the ``pyproject.toml`` file.
- Make sure to install in the correct environment. Most Python Discord projects use
poetry, so you can run ``poetry run pip install /path/to/pydis_core``.
uv, so you can run ``uv run -- pip install /path/to/pydis_core``.

3. You can now use features from your local bot-core changes.
To load new changes, run the install command again.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
context: .
dockerfile: dev/Dockerfile
volumes:
- .:/app:ro
- ./dev:/app/dev:ro
tty: true
depends_on:
- web
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Table of contents:
## Building
To build the docs, you can use the following task:
```shell
poetry run task docs
uv run task docs
```

The output will be in the [`/docs/build`](.) directory.
Expand Down Expand Up @@ -42,7 +42,7 @@ The project supports building all different versions at once using [sphinx-multi
after version `v7.1.0`. You can run the following command to achieve that:

```shell
poetry run sphinx_multiversion -v docs docs/build -n -j auto -n
uv run sphinx_multiversion -v docs docs/build -n -j auto -n
```

This will build all tags, as well as the main branch. To build branches besides the main one
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# The full version, including alpha/beta/rc tags
release = version = tomli.loads(
(PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8")
)["tool"]["poetry"]["version"]
)["project"]["version"]

# -- General configuration ---------------------------------------------------

Expand Down
Loading