Skip to content

Commit

Permalink
Migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanC committed Aug 25, 2024
1 parent 4985a47 commit f71dd5e
Show file tree
Hide file tree
Showing 8 changed files with 665 additions and 1,168 deletions.
File renamed without changes.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: ci

on:
push:
branches:
- "main"

jobs:
build:
runs-on: ubuntu-latest
steps:
- id: repository
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.event.repository.name }}
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ steps.repository.outputs.lowercase }}:latest
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ steps.repository.outputs.lowercase }}
short-description: ${{ github.event.repository.description }}
39 changes: 0 additions & 39 deletions .github/workflows/ci.yml

This file was deleted.

17 changes: 5 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
FROM python:3.12.4-slim-bullseye
FROM python:3.12-slim-bookworm

WORKDIR /n31l

# Install and configure Poetry
# https://github.com/python-poetry/poetry
RUN pip install poetry
RUN poetry config virtualenvs.create false

# Install dependencies
COPY pyproject.toml pyproject.toml
RUN poetry install --no-root

COPY . .

CMD [ "python", "-OO", "n31l.py" ]
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
RUN uv sync --frozen --no-dev

CMD [ "uv", "run", "n31l.py", "-OO" ]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# N31L

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/EthanC/N31L/ci.yml?branch=main) ![Docker Pulls](https://img.shields.io/docker/pulls/ethanchrisp/n31l?label=Docker%20Pulls) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/ethanchrisp/n31l/latest?label=Docker%20Image%20Size)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/EthanC/N31L/ci.yaml?branch=main) ![Docker Pulls](https://img.shields.io/docker/pulls/ethanchrisp/n31l?label=Docker%20Pulls) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/ethanchrisp/n31l/latest?label=Docker%20Image%20Size)

N31L is a utilitarian Discord bot for the [Call of Duty server](https://discord.gg/CallofDuty).

Expand Down Expand Up @@ -53,7 +53,7 @@ services:
N31L is built for [Python 3.12](https://www.python.org/) or greater.
1. Install required dependencies using [Poetry](https://python-poetry.org/): `poetry install --no-root`
1. Install required dependencies using [uv](https://github.com/astral-sh/uv): `uv sync`
2. Rename `.env.example` to `.env`, then provide the environment variables.
3. Rename `config_example.json` to `config.json`, then provide the configurable variables.
4. Start N31L: `python -OO n31l.py`
1,094 changes: 0 additions & 1,094 deletions poetry.lock

This file was deleted.

41 changes: 20 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
[tool.poetry]
[project]
name = "n31l"
version = "2.0.0"
version = "2.1.0"
description = "N31L is a utilitarian bot for the Call of Duty server."
authors = ["EthanC <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.12,<3.13"
python-dotenv = "^1.0.1"
loguru = "^0.7.2"
loguru-discord = "^1.3.1"
hikari-arc = "^1.3.4"
httpx = "^0.27.0"
asyncpraw = "^7.7.1"
urlextract = "^1.9.0"
uvloop = {version = "^0.19.0", platform = "linux"}

[tool.poetry.group.dev.dependencies]
ruff = "^0.5.1"
asyncpraw-stubs = "^0.0.3"
requires-python = ">=3.12"
dependencies = [
"python-dotenv>=1.0.1",
"loguru>=0.7.2",
"loguru-discord>=1.3.1",
"hikari-arc>=1.3.4",
"httpx>=0.27.0",
"asyncpraw>=7.7.1",
"urlextract>=1.9.0",
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.uv]
dev-dependencies = [
"ruff>=0.6.2",
"asyncpraw-stubs>=0.0.3",
]

[tool.ruff.lint]
select = ["I"]
Loading

0 comments on commit f71dd5e

Please sign in to comment.