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
22 changes: 9 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️


steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install tokenizers
Expand All @@ -31,21 +32,16 @@ jobs:
git apply ./24.patch && ./configure && \
sudo make && sudo make install && sudo ldconfig -v

- run: python -m pip install --upgrade pip
- run: pip install .[all]
- name: Install dependencies
run: uv sync --group dev --all-extras

- run: |
pip install ruff
ruff check src
ruff format --diff src
uv run ruff check src
uv run ruff format --diff src

- run: |
pip install mypy types-requests
mypy src
- run: uv run mypy src

- run: |
pip install pytest httpx
pytest
- run: uv run pytest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
32 changes: 23 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ RUN apt update -y \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

# uv
COPY --from=ghcr.io/astral-sh/uv:0.6.17 /uv /uvx /bin/

Comment on lines +22 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WORKDIR /tmp

# kytea
Expand All @@ -32,18 +35,29 @@ RUN tar zxvf kytea-0.4.7.tar.gz \

WORKDIR /work

COPY ./data ./data
COPY ./src ./src
COPY ./pyproject.toml ./pyproject.toml
COPY ./requirements.lock ./requirements.lock
COPY ./README.md ./README.md
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy

# install dependencies
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 --frozen --no-install-project --no-dev
Comment on lines +42 to +45
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


ADD ./data /work
ADD ./src /work
ADD ./pyproject.toml /work
ADD ./uv.lock /work
ADD ./README.md /work

# install project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --all-extras

RUN python3.10 -m pip install -U pip
RUN python3.10 -m pip install -r requirements.lock
RUN python3.10 -m pip install .
ENV PATH="/work/.venv/bin:$PATH"

CMD [ \
"python3.10", "-m", "uvicorn", \
"uvicorn", \
"--factory", "konoha.api.server:create_app", \
"--reload", "--host", "0.0.0.0", "--port", "8000" \
]
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,19 @@ module = [
]
ignore_missing_imports = true

[tool.uv]
dev-dependencies = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev-dependencies will be deprecated in the future.
Changed it to dependency-groups.
https://docs.astral.sh/uv/concepts/projects/dependencies/#development-dependencies

[dependency-groups]
dev = [
"pytest>=8.2.0",
"httpx>=0.27.0",
"ruff>=0.4.4",
"mypy>=1.10.0",
"sphinx>=7.3.7",
"pydata-sphinx-theme>=0.16.1",
"types-requests>=2.31.0.6",
]

[tool.uv]
default-groups = ["dev"]

[tool.ruff]
line-length = 119
211 changes: 0 additions & 211 deletions requirements-dev.lock

This file was deleted.

Loading