Skip to content

Commit 88f4c78

Browse files
authored
chore: upgrade scaffolding (#105)
1 parent 4ad8307 commit 88f4c78

15 files changed

Lines changed: 104 additions & 4407 deletions

.copier-answers.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
_commit: v1.2.0
1+
_commit: v1.5.1
22
_src_path: gh:superlinear-ai/substrate
33
author_email: laurent@superlinear.eu
44
author_name: Laurent Sorber
5-
project_description: A Python toolkit for Retrieval-Augmented Generation (RAG) with SQLite or PostgreSQL.
5+
project_description: A Python toolkit for Retrieval-Augmented Generation (RAG) with
6+
SQLite or PostgreSQL.
67
project_name: raglite
78
project_type: package
89
project_url: https://github.com/superlinear-ai/raglite

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"overrideCommand": true,
1010
"remoteUser": "user",
11-
"postStartCommand": "sudo chown -R user:user /opt/ && uv sync --python ${PYTHON_VERSION:-3.10} ${RESOLUTION_STRATEGY:+--resolution $RESOLUTION_STRATEGY} --all-extras && pre-commit install --install-hooks",
11+
"postStartCommand": "sudo chown -R user:user /opt/ && uv sync --python ${localEnv:PYTHON_VERSION:3.10} --resolution ${localEnv:RESOLUTION_STRATEGY:highest} --all-extras && pre-commit install --install-hooks",
1212
"customizations": {
1313
"jetbrains": {
1414
"backend": "PyCharm",
@@ -51,7 +51,7 @@
5151
],
5252
"files.autoSave": "onFocusChange",
5353
"github.copilot.chat.agent.enabled": true,
54-
"github.copilot.chat.edits.codesearch.enabled": true,
54+
"github.copilot.chat.codesearch.enabled": true,
5555
"github.copilot.chat.edits.enabled": true,
5656
"github.copilot.nextEditSuggestions.enabled": true,
5757
"jupyter.kernels.excludePythonEnvironments": [

.github/workflows/publish.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ on:
77

88
jobs:
99
publish:
10-
runs-on: ghcr.io/astral-sh/uv:3.10-bookworm
10+
runs-on: ubuntu-latest
11+
environment: pypi
12+
permissions:
13+
id-token: write
1114

1215
steps:
1316
- name: Checkout
1417
uses: actions/checkout@v4
1518

19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
1622
- name: Publish package
1723
run: |
1824
uv build
1925
uv publish
20-
env:
21-
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,8 @@ dist/
7474
# Terraform
7575
.terraform/
7676

77+
# uv
78+
uv.lock
79+
7780
# VS Code
7881
.vscode/

.pre-commit-config.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ repos:
5252
require_serial: true
5353
language: system
5454
stages: [commit-msg]
55-
- id: uv-lock-check
56-
name: uv lock check
57-
entry: uv lock
58-
args: ["--check"]
59-
require_serial: true
60-
language: system
61-
pass_filenames: false
6255
- id: ruff-check
6356
name: ruff check
6457
entry: ruff check

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN git config --system --add safe.directory '*'
1515
RUN --mount=type=cache,target=/var/cache/apt/ \
1616
--mount=type=cache,target=/var/lib/apt/ \
1717
groupadd --gid 1000 user && \
18-
useradd --create-home --no-log-init --gid 1000 --uid 1000 user && \
18+
useradd --create-home --no-log-init --gid 1000 --uid 1000 --shell /usr/bin/bash user && \
1919
chown user:user /opt/ && \
2020
apt-get update && apt-get install --no-install-recommends --yes sudo && \
2121
echo 'user ALL=(root) NOPASSWD:ALL' > /etc/sudoers.d/user && chmod 0440 /etc/sudoers.d/user

README.md

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ RAGLite is a Python toolkit for Retrieval-Augmented Generation (RAG) with Postgr
4040
## Installing
4141

4242
> [!TIP]
43-
> 🚀 It is optional but recommended to install [an accelerated llama-cpp-python precompiled binary](https://github.com/abetlen/llama-cpp-python?tab=readme-ov-file#supported-backends) with:
43+
> 🚀 If you want to use local models, it is recommended to install [an accelerated llama-cpp-python precompiled binary](https://github.com/abetlen/llama-cpp-python?tab=readme-ov-file#supported-backends) with:
4444
> ```sh
45-
> # Configure which llama-cpp-python precompiled binary to install (⚠️ On macOS only v0.3.2 is supported right now):
46-
> LLAMA_CPP_PYTHON_VERSION=0.3.2
45+
> # Configure which llama-cpp-python precompiled binary to install (⚠️ not every combination is available):
46+
> LLAMA_CPP_PYTHON_VERSION=0.3.4
4747
> PYTHON_VERSION=310|311|312
4848
> ACCELERATOR=metal|cu121|cu122|cu123|cu124
4949
> PLATFORM=macosx_11_0_arm64|linux_x86_64|win_amd64
@@ -357,11 +357,9 @@ OPENAI_API_KEY=sk-... raglite --llm gpt-4o-mini --embedder text-embedding-3-larg
357357
<details>
358358
<summary>Prerequisites</summary>
359359

360-
<details>
361-
<summary>1. Set up Git to use SSH</summary>
362-
363360
1. [Generate an SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) and [add the SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).
364361
1. Configure SSH to automatically load your SSH keys:
362+
365363
```sh
366364
cat << EOF >> ~/.ssh/config
367365
@@ -373,31 +371,9 @@ OPENAI_API_KEY=sk-... raglite --llm gpt-4o-mini --embedder text-embedding-3-larg
373371
EOF
374372
```
375373
376-
</details>
377-
378-
<details>
379-
<summary>2. Install Docker</summary>
380-
381374
1. [Install Docker Desktop](https://www.docker.com/get-started).
382-
- _Linux only_:
383-
- Export your user's user id and group id so that [files created in the Dev Container are owned by your user](https://github.com/moby/moby/issues/3206):
384-
```sh
385-
cat << EOF >> ~/.bashrc
386-
387-
export UID=$(id --user)
388-
export GID=$(id --group)
389-
EOF
390-
```
391-
392-
</details>
393-
394-
<details>
395-
<summary>3. Install VS Code or PyCharm</summary>
396-
397375
1. [Install VS Code](https://code.visualstudio.com/) and [VS Code's Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers). Alternatively, install [PyCharm](https://www.jetbrains.com/pycharm/download/).
398-
2. _Optional:_ install a [Nerd Font](https://www.nerdfonts.com/font-downloads) such as [FiraCode Nerd Font](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode) and [configure VS Code](https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions) or [configure PyCharm](https://github.com/tonsky/FiraCode/wiki/Intellij-products-instructions) to use it.
399-
400-
</details>
376+
1. _Optional:_ install a [Nerd Font](https://www.nerdfonts.com/font-downloads) such as [FiraCode Nerd Font](https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/FiraCode) and [configure VS Code](https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions) or [PyCharm](https://github.com/tonsky/FiraCode/wiki/Intellij-products-instructions) to use it.
401377
402378
</details>
403379
@@ -406,9 +382,10 @@ OPENAI_API_KEY=sk-... raglite --llm gpt-4o-mini --embedder text-embedding-3-larg
406382
407383
The following development environments are supported:
408384
409-
1. ⭐️ _GitHub Codespaces_: click on _Code_ and select _Create codespace_ to start a Dev Container with [GitHub Codespaces](https://github.com/features/codespaces).
410-
1. ⭐️ _Dev Container (with container volume)_: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/superlinear-ai/raglite) to clone this repository in a container volume and create a Dev Container with VS Code.
385+
1. ⭐️ _GitHub Codespaces_: click on [Open in GitHub Codespaces](https://github.com/codespaces/new/superlinear-ai/raglite) to start developing in your browser.
386+
1. ⭐️ _VS Code Dev Container (with container volume)_: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/superlinear-ai/raglite) to clone this repository in a container volume and create a Dev Container with VS Code.
411387
1. ⭐️ _uv_: clone this repository and run the following from root of the repository:
388+
412389
```sh
413390
# Create and install a virtual environment
414391
uv sync --python 3.10 --all-extras
@@ -419,13 +396,13 @@ The following development environments are supported:
419396
# Install the pre-commit hooks
420397
pre-commit install --install-hooks
421398
```
422-
1. _Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/⌘</kbd> + <kbd></kbd> + <kbd>P</kbd> → _Dev Containers: Reopen in Container_.
423-
1. _PyCharm_: clone this repository, open it with PyCharm, and [configure Docker Compose as a remote interpreter](https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#docker-compose-remote) with the `dev` service.
424-
1. _Terminal_: clone this repository, open it with your terminal, and run `docker compose up --detach dev` to start a Dev Container in the background, and then run `docker compose exec dev zsh` to open a shell prompt in the Dev Container.
399+
400+
1. _VS Code Dev Container_: clone this repository, open it with VS Code, and run <kbd>Ctrl/⌘</kbd> + <kbd>⇧</kbd> + <kbd>P</kbd> → _Dev Containers: Reopen in Container_.
401+
1. _PyCharm Dev Container_: clone this repository, open it with PyCharm, [create a Dev Container with Mount Sources](https://www.jetbrains.com/help/pycharm/start-dev-container-inside-ide.html), and [configure an existing Python interpreter](https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#widget) at `/opt/venv/bin/python`.
425402
426403
</details>
427404
428-
<details>
405+
<details open>
429406
<summary>Developing</summary>
430407
431408
- This project follows the [Conventional Commits](https://www.conventionalcommits.org/) standard to automate [Semantic Versioning](https://semver.org/) and [Keep A Changelog](https://keepachangelog.com/) with [Commitizen](https://github.com/commitizen-tools/commitizen).

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ services:
55
target: dev
66
environment:
77
- OPENAI_API_KEY
8-
- UV_PUBLISH_TOKEN
98
depends_on:
109
- postgres
1110
volumes:

pyproject.toml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
[project] # https://packaging.python.org/en/latest/specifications/pyproject-toml/
1+
[build-system] # https://docs.astral.sh/uv/concepts/projects/config/#build-systems
2+
requires = ["hatchling>=1.27.0"]
3+
build-backend = "hatchling.build"
4+
5+
[project] # https://packaging.python.org/en/latest/specifications/pyproject-toml/
26
name = "raglite"
37
version = "0.6.2"
48
description = "A Python toolkit for Retrieval-Augmented Generation (RAG) with SQLite or PostgreSQL."
@@ -11,18 +15,18 @@ dependencies = [
1115
# Configuration:
1216
"platformdirs (>=4.0.0)",
1317
# Markdown conversion:
14-
"pdftext (>=0.3.13)",
18+
"pdftext (>=0.4.1)",
1519
"scikit-learn (>=1.4.2)",
1620
# Markdown formatting:
1721
"markdown-it-py (>=3.0.0)",
1822
"mdformat-gfm (>=0.3.6)",
1923
# Sentence and chunk splitting:
2024
"numpy (>=1.26.4,<2.0.0)",
21-
"scipy (>=1.5.0)",
25+
"scipy (>=1.11.2,!=1.15.0.*,!=1.15.1,!=1.15.2)",
2226
"wtpsplit-lite (>=0.1.0)",
2327
# Large Language Models:
2428
"huggingface-hub (>=0.22.0)",
25-
"litellm (>=1.57.8)",
29+
"litellm (>=1.60.2)",
2630
"pydantic (>=2.7.0)",
2731
# Approximate Nearest Neighbors:
2832
"pynndescent (>=0.5.12)",
@@ -32,11 +36,11 @@ dependencies = [
3236
"rerankers[flashrank] (>=0.6.0)",
3337
# Storage:
3438
"pg8000 (>=1.31.2)",
35-
"sqlmodel-slim (>=0.0.18)",
39+
"sqlmodel-slim (>=0.0.21)",
3640
# Progress:
3741
"tqdm (>=4.66.0)",
3842
# Evaluation:
39-
"pandas (>=2.1.0)",
43+
"pandas (>=2.1.1)",
4044
# CLI:
4145
"typer (>=0.15.1)",
4246
# Model Context Protocol:
@@ -58,7 +62,7 @@ issues = "https://github.com/superlinear-ai/raglite/issues"
5862

5963
[dependency-groups] # https://docs.astral.sh/uv/concepts/projects/dependencies/#development-dependencies
6064
dev = [
61-
"commitizen (>=4.1.0)",
65+
"commitizen (>=4.3.0)",
6266
"coverage[toml] (>=7.6.10)",
6367
"ipykernel (>=6.29.4)",
6468
"ipython (>=8.18.0)",
@@ -70,42 +74,42 @@ dev = [
7074
"pytest (>=8.3.4)",
7175
"pytest-mock (>=3.14.0)",
7276
"pytest-xdist (>=3.6.1)",
73-
"ruff (>=0.9.2)",
77+
"ruff (>=0.10.0)",
7478
"typeguard (>=4.4.1)",
7579
]
7680

77-
[tool.commitizen] # https://commitizen-tools.github.io/commitizen/config/
78-
bump_message = "bump(release): v$current_version → v$new_version"
79-
tag_format = "v$version"
80-
update_changelog_on_bump = true
81-
version_provider = "pep621"
82-
8381
[project.optional-dependencies]
8482
# Frontend:
8583
chainlit = ["chainlit (>=2.0.0)"]
8684
# Large Language Models:
87-
llama-cpp-python = ["llama-cpp-python (>=0.3.2)"]
85+
llama-cpp-python = ["llama-cpp-python (>=0.3.3)"]
8886
# Markdown conversion:
8987
pypandoc-binary = ["pypandoc-binary (>=1.13)"]
9088
# Evaluation:
9189
ragas = ["ragas (>=0.1.12)"]
9290

93-
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html#report
91+
[tool.commitizen] # https://commitizen-tools.github.io/commitizen/config/
92+
bump_message = "bump: v$current_version → v$new_version"
93+
tag_format = "v$version"
94+
update_changelog_on_bump = true
95+
version_provider = "uv"
96+
97+
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html#report
9498
fail_under = 50
9599
precision = 1
96100
show_missing = true
97101
skip_covered = true
98102

99-
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html#run
103+
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html#run
100104
branch = true
101105
command_line = "--module pytest"
102106
data_file = "reports/.coverage"
103107
source = ["src"]
104108

105-
[tool.coverage.xml] # https://coverage.readthedocs.io/en/latest/config.html#xml
109+
[tool.coverage.xml] # https://coverage.readthedocs.io/en/latest/config.html#xml
106110
output = "reports/coverage.xml"
107111

108-
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html
112+
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html
109113
junit_xml = "reports/mypy.xml"
110114
strict = true
111115
disallow_subclassing_any = false
@@ -117,13 +121,13 @@ show_error_codes = true
117121
show_error_context = true
118122
warn_unreachable = true
119123

120-
[tool.pytest.ini_options] # https://docs.pytest.org/en/latest/reference/reference.html#ini-options-ref
124+
[tool.pytest.ini_options] # https://docs.pytest.org/en/latest/reference/reference.html#ini-options-ref
121125
addopts = "--color=yes --doctest-modules --ignore=src/raglite/_chainlit.py --exitfirst --failed-first --strict-config --strict-markers --verbosity=2 --junitxml=reports/pytest.xml"
122126
filterwarnings = ["error", "ignore::DeprecationWarning", "ignore::pytest.PytestUnraisableExceptionWarning"]
123127
testpaths = ["src", "tests"]
124128
xfail_strict = true
125129

126-
[tool.ruff] # https://docs.astral.sh/ruff/settings/
130+
[tool.ruff] # https://docs.astral.sh/ruff/settings/
127131
fix = true
128132
line-length = 100
129133
src = ["src", "tests"]
@@ -146,10 +150,10 @@ max-doc-length = 100
146150
[tool.ruff.lint.pydocstyle]
147151
convention = "numpy"
148152

149-
[tool.uv] # https://docs.astral.sh/uv/reference/settings/
150-
package = true
153+
[tool.poe.executor] # https://github.com/nat-n/poethepoet
154+
type = "simple"
151155

152-
[tool.poe.tasks] # https://github.com/nat-n/poethepoet
156+
[tool.poe.tasks]
153157

154158
[tool.poe.tasks.docs]
155159
help = "Generate this package's docs"

0 commit comments

Comments
 (0)