Skip to content
Open
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
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# ruff is for python files and is used with ruff.toml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-added-large-files
args: ['--maxkb=3000']
- id: check-toml
- id: check-yaml
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
# - id: requirements-txt-fixer
# exclude: ^requirements/.*$
- id: trailing-whitespace
- id: name-tests-test
args: [ --pytest-test-first ]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
hooks:
- id: ruff
args: ['--fix']
- id: ruff-format

- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ['--exclude-files', '.*[^i][^p][^y][^n][^b]$', '--exclude-lines', '"(hash|id|image/\w+)":.*', ]
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,23 @@ sync-local-config:
--output-format yaml \
--prettyPrint \
> config.yaml


UV := "$$HOME/.local/bin/uv" # keep the quotes incase the path contains spaces
pre-commit-install:
@echo "${YELLOW}=========> Installing pre-commit...${NC}"
$(UV) run pre-commit install
pre-commit:
@echo "${YELLOW}=========> Running pre-commit...${NC}"
$(UV) run pre-commit run --all-files

# This build the documentation based on current code 'src/' and 'docs/' directories
# This is to run the documentation locally to see how it looks
deploy-doc-local:
@echo "${YELLOW}Deploying documentation locally...${NC}"
@$(UV) run mkdocs build && $(UV) run mkdocs serve

# Deploy it to the gh-pages branch in your GitHub repository (you need to setup the GitHub Pages in github settings to use the gh-pages branch)
deploy-doc-gh:
@echo "${YELLOW}Deploying documentation in github actions..${NC}"
@$(UV) run mkdocs build && $(UV) run mkdocs gh-deploy
1 change: 0 additions & 1 deletion app/models/reminder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from datetime import UTC, datetime
from typing import Optional

from pydantic import BaseModel, Field

Expand Down
60 changes: 60 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
site_name: Generative AI Project Template
site_description: Documentation
site_author: Amine Djeghri
docs_dir: .
# site_url: #TODO: Fill when deployment CI added
#site_dir: public
#repo_url:
#edit_uri: blob/main/docs/


theme:

name: "material" # https://squidfunk.github.io/mkdocs-material/getting-started/
language: en
features: # https://squidfunk.github.io/mkdocs-material/setup/
- search.suggest
- search.highlight
- search.share
- navigation.instant
- navigation.instant.progress
- navigation.tracking
- navigation.tabs
- navigation.tabs.sticky
# - navigation.sections
- navigation.path
- navigation.indexes
- navigation.top
- toc.follow
- content.code.copy
- content.code.annotate
palette:
# Palette toggle for light mode
- scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- scheme: slate
toggle:
icon: material/brightness-4
name: Switch to light mode
plugins:
- mkdocstrings:
default_handler: python
import:
- https://docs.python-requests.org/en/master/objects.inv
load_external_modules: true
handlers:
python:
paths: [., source]
- gen-files:
scripts:
- scripts/gen_doc_stubs.py
- search
- same-dir
- exclude:
glob:
- node_modules/**
- .venv/**
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,36 @@ dev = [
"ruff~=0.7", # Linter
]

# uv configuration
# uses also the depenencies in the [project.dependencies] section
[tool.uv]
managed = true
default-groups = ["dev", "docs"]
[dependency-groups]
# if you add new dependencies here, make sure to add them to [tool.uv] default-groups up above
dev = [
"deepeval~=0.21", # LLM model evaluation
"deptry~=0.20", # Dependency tree testing
"pyright~=1.1", # Static type checker
"pytest-assume~=2.4", # Pytest plugin for conditional tests
"pytest-asyncio~=0.24", # Pytest plugin for async tests
"pytest-repeat~=0.9", # Pytest plugin for repeating tests
"pytest-xdist[psutil]~=3.6", # Pytest plugin for parallel testing
"pytest~=8.3", # Testing framework
"ruff~=0.7", # Linter
"pre-commit~=4.0.1" # Pre-commit hooks
]
docs = [
"mkdocs == 1.6.1",
"mkdocs-material>=9.5.41",
"mkdocstrings>=0.26.2",
"mkdocs-mermaid2-plugin>=1.1.1",
"mkdocs-gen-files>=0.5.0",
"mkdocstrings-python",
"mkdocs-same-dir",
"mkdocs-exclude"
]

[tool.setuptools]
py-modules = [
"app",
Expand Down
20 changes: 20 additions & 0 deletions scripts/gen_doc_stubs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""This script walks through the source code and generates a markdown file for each python file.

The goal is then for the markdown files to be used by mkdocs to call the plugin mkdocstring.
"""

from pathlib import Path

import mkdocs_gen_files

src_root = Path("src")
for path in src_root.glob("**/*.py"):
if "__init__" in str(path):
print("Skipping", path)
continue
doc_path = Path("package", path.relative_to(src_root)).with_suffix(".md")

if "seqly" not in str(path) and "__init__" not in str(path):
with mkdocs_gen_files.open(doc_path, "w") as f:
ident = ".".join(path.with_suffix("").parts)
print("::: " + ident, file=f)
Loading