Skip to content

Commit c565026

Browse files
authored
Setup repository with checks for quality (#3)
1 parent e112d44 commit c565026

File tree

11 files changed

+1741
-14
lines changed

11 files changed

+1741
-14
lines changed

.github/workflows/lint.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: lint
2+
run-name: ${{ github.actor }} is linting the package
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- release/*
9+
pull_request:
10+
branches:
11+
- main
12+
- release/*
13+
14+
jobs:
15+
lints:
16+
name: Ruff, Pyright, and Codespell
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: codespell-project/actions-codespell@v2
22+
23+
- name: Set up uv
24+
run: curl -LsSf https://astral.sh/uv/0.6.10/install.sh | sh
25+
26+
- name: Check uv lock file is up-to-date
27+
run: uv lock --check
28+
29+
- name: Set Up Python Environment
30+
run: uv python install 3.11
31+
32+
- name: Restore uv cache
33+
uses: actions/cache@v4
34+
with:
35+
path: /tmp/.uv-cache
36+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
37+
restore-keys: |
38+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
39+
uv-${{ runner.os }}
40+
41+
- name: Install the project
42+
run: uv sync
43+
44+
- name: Run Ruff
45+
run: uv run ruff check .
46+
47+
- name: Run Pyright
48+
run: uv run pyright .
49+
50+
- name: Minimize uv cache
51+
run: uv cache prune --ci

.github/workflows/tests.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: tests
2+
run-name: ${{ github.actor }} is running tests
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- release/*
9+
pull_request:
10+
branches:
11+
- main
12+
- release/*
13+
14+
jobs:
15+
tests:
16+
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ["3.10"]
22+
os: [ubuntu-latest, macos-latest]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up uv
28+
run: curl -LsSf https://astral.sh/uv/0.6.10/install.sh | sh
29+
30+
- name: Set Up Python ${{ matrix.python-version }}
31+
run: uv python install ${{ matrix.python-version }}
32+
33+
- name: Restore uv cache
34+
uses: actions/cache@v4
35+
with:
36+
path: /tmp/.uv-cache
37+
key: uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
38+
restore-keys: |
39+
uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
40+
uv-${{ runner.os }}-${{ matrix.python-version }}
41+
uv-${{ runner.os }}
42+
43+
- name: Install the project
44+
run: uv sync
45+
46+
- name: Run Tests
47+
run: uv run pytest tests

.gitignore

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
# pyenv
2+
.python-version
3+
.python-versions
4+
5+
# Claude
6+
.claude/
7+
18
# Byte-compiled / optimized / DLL files
29
__pycache__/
310
*.py[cod]
411
*$py.class
512

13+
# Mac
14+
.DS_Store
15+
616
# C extensions
717
*.so
818

@@ -94,12 +104,6 @@ ipython_config.py
94104
# install all needed dependencies.
95105
#Pipfile.lock
96106

97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
103107
# poetry
104108
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105109
# This is especially recommended for binary packages to ensure reproducibility, and is more
@@ -112,10 +116,8 @@ ipython_config.py
112116
#pdm.lock
113117
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114118
# in version control.
115-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
119+
# https://pdm.fming.dev/#use-with-ide
116120
.pdm.toml
117-
.pdm-python
118-
.pdm-build/
119121

120122
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121123
__pypackages__/
@@ -167,8 +169,5 @@ cython_debug/
167169
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168170
#.idea/
169171

170-
# Ruff stuff:
171-
.ruff_cache/
172-
173-
# PyPI configuration file
174-
.pypirc
172+
# VSCode
173+
.vscode/

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/codespell-project/codespell
3+
rev: v2.3.0
4+
hooks:
5+
- id: codespell
6+
additional_dependencies:
7+
- tomli
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: "v0.9.7"
10+
hooks:
11+
- id: ruff
12+
args: [--fix]
13+
- id: ruff-format
14+
- repo: https://github.com/RobertCraigie/pyright-python
15+
rev: v1.1.396
16+
hooks:
17+
- id: pyright
18+
- repo: local
19+
hooks:
20+
- id: tests
21+
name: tests
22+
entry: uv run pytest tests
23+
language: system
24+
types: [python]
25+
pass_filenames: false

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
Building a "Chat with Docs" solution for Mirascope, demonstrating how to build an AI application with best practices.
44

5+
## Quick Start
6+
7+
Start the chat application with:
8+
9+
```bash
10+
uv run chat_with_docs/main.py
11+
```
12+
513
## Project Philosophy
614

715
Building AI can feel overwhelming, but it doesn't have to be. This project demonstrates how to incrementally build a real AI system using evaluation-driven development:

chat_with_docs/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""Chat with your documentation."""
2+
3+
import importlib.metadata
4+
5+
__version__ = importlib.metadata.version("chat-with-docs")
6+
7+
__all__ = ["__version__"]

chat_with_docs/main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Main entry point for the chat-with-docs application."""
2+
3+
from rich.console import Console
4+
5+
console = Console()
6+
7+
8+
def main() -> None:
9+
"""Run the chat-with-docs application."""
10+
console.print("[bold green]Welcome to Chat with Docs![/bold green]")
11+
console.print("This application is currently under development.")
12+
13+
14+
if __name__ == "__main__":
15+
main()

pyproject.toml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
[project]
2+
name = "chat-with-docs"
3+
version = "0.1.0"
4+
description = "Chat with your documentation"
5+
readme = "README.md"
6+
license = { file = "LICENSE" }
7+
requires-python = ">=3.10"
8+
dependencies = [
9+
"lilypad-sdk[anthropic,gemini,openai]>=0.2.3",
10+
"mirascope[anthropic,gemini,openai]>=1.24.0",
11+
"rich>=14.0.0",
12+
]
13+
14+
[project.scripts]
15+
chat-with-docs = "chat_with_docs.main:main"
16+
17+
[project.urls]
18+
Repository = "https://github.com/Mirascope/chat-with-docs"
19+
Issues = "https://github.com/Mirascope/chat-with-docs/issues"
20+
21+
[tool.uv]
22+
dev-dependencies = [
23+
"ruff>=0.9.7",
24+
"pytest>=8.3.2",
25+
"pyright>=1.1.396",
26+
"pre-commit>=3.8.0",
27+
]
28+
29+
[tool.pytest.ini_options]
30+
filterwarnings = ["ignore::DeprecationWarning"]
31+
32+
[tool.ruff]
33+
exclude = [
34+
".bzr",
35+
".direnv",
36+
".eggs",
37+
".git",
38+
".git-rewrite",
39+
".hg",
40+
".mypy_cache",
41+
".nox",
42+
".pants.d",
43+
".pytype",
44+
".ruff_cache",
45+
".svn",
46+
".tox",
47+
".venv",
48+
"__pypackages__",
49+
"_build",
50+
"buck-out",
51+
"build",
52+
"dist",
53+
"node_modules",
54+
"venv",
55+
]
56+
line-length = 88
57+
target-version = "py310"
58+
59+
[tool.ruff.lint.per-file-ignores]
60+
"__init__.py" = ["F401"]
61+
"tests/*.py" = ["S101", "ANN"]
62+
63+
[tool.ruff.lint]
64+
select = [
65+
"E",
66+
"F",
67+
"I",
68+
"UP",
69+
"YTT",
70+
"B",
71+
"T10",
72+
"T20",
73+
"C4",
74+
"PYI006",
75+
"SIM",
76+
"ANN",
77+
"RUF022",
78+
]
79+
ignore = ['D105', 'D107', 'D205', 'D415', 'E501', 'B011', 'B028', 'B904']
80+
fixable = ["ALL"]
81+
pydocstyle = { convention = 'google' }
82+
unfixable = []
83+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
84+
85+
[tool.ruff.format]
86+
quote-style = "double"
87+
indent-style = "space"
88+
skip-magic-trailing-comma = false
89+
line-ending = "auto"
90+
91+
[tool.pyright]
92+
exclude = [
93+
".venv",
94+
"build",
95+
]
96+
venvPath = "."
97+
venv = ".venv"
98+
99+
[tool.codespell]
100+
skip = [".git", "*.lock"]
101+
102+
[build-system]
103+
requires = ["hatchling"]
104+
build-backend = "hatchling.build"

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Test package for chat-with-docs."""

tests/test_version.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Test version import."""
2+
3+
from chat_with_docs import __version__
4+
5+
6+
def test_version() -> None:
7+
"""Test that version is a string."""
8+
assert isinstance(__version__, str)

0 commit comments

Comments
 (0)