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
2 changes: 1 addition & 1 deletion .cursor/rules/makefile-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Some helpful commands have been defined in the `Makefile` already.
If the user is confused, point them towards these resources.

- `make all` - runs `main.py`
- `make lint` - runs `black` linter, an opinionated linter
- `make fmt` - runs `ruff format` + JSON formatting
- `make test` - runs all tests defined by `TEST_TARGETS = tests/folder1 tests/folder2`
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ make test_slow # Run slow tests only
make test_nondeterministic # Run nondeterministic tests only

# Code Quality (run after major changes)
make fmt # Run black formatter + JSON formatting
make fmt # Run ruff formatter + JSON formatting
make ruff # Run ruff linter
make vulture # Find dead code
make ty # Run typer type checker
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,24 @@ test_flaky: check_uv ## Repeat fast tests to detect flaky tests
########################################################

# Linter will ignore these directories
IGNORE_LINT_DIRS = .venv|venv
IGNORE_LINT_DIRS = .venv venv
LINE_LENGTH = 88
FIND_PRUNE = $(foreach dir,$(IGNORE_LINT_DIRS),-path "./$(dir)" -o) -false

### Code Quality
install_tools: check_uv ## Install linting/formatting tools
@echo "$(YELLOW)🔧Installing tools...$(RESET)"
@uv tool install black --force
@uv tool install ruff --force
@uv tool install ty --force
@uv tool install vulture --force
@echo "$(GREEN)✅Tools installed.$(RESET)"

fmt: install_tools check_jq ## Format code with black and jq
@echo "$(YELLOW)✨Formatting project with Black...$(RESET)"
@uv tool run black --exclude '/($(IGNORE_LINT_DIRS))/' . --line-length $(LINE_LENGTH)
fmt: install_tools check_jq ## Format code with ruff and jq
@echo "$(YELLOW)✨Formatting project with Ruff...$(RESET)"
@uv tool run ruff format
@echo "$(YELLOW)✨Formatting JSONs with jq...$(RESET)"
@count=0; \
find . \( $(IGNORE_LINT_DIRS:%=-path './%' -prune -o) \) -type f -name '*.json' -print0 | \
find . \( $(FIND_PRUNE) \) -prune -o -type f -name '*.json' -print0 | \
while IFS= read -r -d '' file; do \
if jq . "$$file" > "$$file.tmp" 2>/dev/null && mv "$$file.tmp" "$$file"; then \
count=$$((count + 1)); \
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Opinionated Python stack for fast development. The `saas` branch extends `main`
| Feature | `main` | `saas` |
|---------|:------:|:------:|
| UV + Pydantic config | ✅ | ✅ |
| CI/Linters (Ruff, Black, Vulture) | ✅ | ✅ |
| CI/Linters (Ruff, Vulture) | ✅ | ✅ |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

check that manual_docs/branch_comparison.md:28 is updated to reflect Ruff instead of Black formatter for consistency

| Black formatter | ✅ | ✅ | Opinionated code formatting |
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 44:44

Comment:
check that `manual_docs/branch_comparison.md:28` is updated to reflect Ruff instead of Black formatter for consistency

```
| Black formatter | ✅ | ✅ | Opinionated code formatting |
```

How can I resolve this? If you propose a fix, please make it concise.

| Pre-commit hooks (prek) | ✅ | ✅ |
| LLM (DSPY + LangFuse Observability) | ✅ | ✅ |
| FastAPI + Uvicorn | ❌ | ✅ |
Expand All @@ -55,7 +55,7 @@ Opinionated Python stack for fast development. The `saas` branch extends `main`
## Quick Start

- `make all` - runs `main.py`
- `make fmt` - runs `black` linter, an opinionated linter
- `make fmt` - runs `ruff format` + JSON formatting
- `make banner` - create a new banner that makes the README nice 😊
- `make test` - runs all tests defined by `TEST_TARGETS = tests/folder1 tests/folder2`

Expand Down Expand Up @@ -91,4 +91,3 @@ This software uses the following tools:
</a>

Made with [contrib.rocks](https://contrib.rocks).

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"tailwindcss": "^4.1.18",
"typescript": "^5.9.3"
}
}
}
18 changes: 14 additions & 4 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -16,8 +20,12 @@
"jsx": "react-jsx",
"incremental": true,
"paths": {
"@/*": ["./*"],
"fumadocs-mdx:collections/*": [".source/*"]
"@/*": [
"./*"
],
"fumadocs-mdx:collections/*": [
".source/*"
]
},
"plugins": [
{
Expand All @@ -32,5 +40,7 @@
".next/types/**/*.ts",
".next/dev/types/**/*.ts"
],
"exclude": ["node_modules"]
"exclude": [
"node_modules"
]
}
2 changes: 1 addition & 1 deletion manual_docs/branch_comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This document provides a detailed comparison of features available in the `main`
| Feature | `main` | `saas` | Notes |
|---------|:------:|:------:|-------|
| Ruff linter | ✅ | ✅ | Fast Python linter |
| Black formatter | ✅ | ✅ | Opinionated code formatting |
| Ruff formatter | ✅ | ✅ | Opinionated code formatting |
| Vulture dead code detection | ✅ | ✅ | Find unused code |
| ty type checker | ✅ | ✅ | Type checking |
| GitHub Actions CI | ✅ | ✅ | Automated testing & linting |
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors = [
{ name = "Miyamura80", email = "eitomiyamura@gmail.com" }
]
dependencies = [
"black>=24.8.0",
"pyyaml>=6.0.2",
"python-dotenv>=1.0.1",
"human-id>=0.2.0",
Expand Down
14 changes: 7 additions & 7 deletions tests/healthcheck/test_env_var_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_env_var_loading_precedence(monkeypatch):
monkeypatch.setenv("OPENAI_API_KEY", "system_openai_key")

# 2. Create a temporary .env file
dot_env_content = "DEV_ENV=dotenv\n" "OPENAI_API_KEY=dotenv_openai_key\n"
dot_env_content = "DEV_ENV=dotenv\nOPENAI_API_KEY=dotenv_openai_key\n"
with open(dot_env_path, "w") as f:
f.write(dot_env_content)

Expand All @@ -41,12 +41,12 @@ def test_env_var_loading_precedence(monkeypatch):

# 4. Assert that the variables are loaded with the correct precedence
assert reloaded_config.DEV_ENV == "dotenv", "Should load from .env first"
assert (
reloaded_config.ANTHROPIC_API_KEY == "system_anthropic_key"
), "Should fall back to system env"
assert (
reloaded_config.OPENAI_API_KEY == "dotenv_openai_key"
), "Should load from .env"
assert reloaded_config.ANTHROPIC_API_KEY == "system_anthropic_key", (
"Should fall back to system env"
)
assert reloaded_config.OPENAI_API_KEY == "dotenv_openai_key", (
"Should load from .env"
)

finally:
# Clean up and restore the original .env file if it existed
Expand Down
62 changes: 31 additions & 31 deletions tests/healthcheck/test_pydantic_type_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,51 +39,51 @@ def test_pydantic_type_coercion(monkeypatch):
config = common_module.global_config # type: ignore[attr-defined]

# Verify integer coercion
assert isinstance(
config.default_llm.default_max_tokens, int
), "default_max_tokens should be int"
assert (
config.default_llm.default_max_tokens == 50000
), "default_max_tokens should be 50000"

assert isinstance(
config.llm_config.retry.max_attempts, int
), "max_attempts should be int"
assert isinstance(config.default_llm.default_max_tokens, int), (
"default_max_tokens should be int"
)
assert config.default_llm.default_max_tokens == 50000, (
"default_max_tokens should be 50000"
)

assert isinstance(config.llm_config.retry.max_attempts, int), (
"max_attempts should be int"
)
assert config.llm_config.retry.max_attempts == 5, "max_attempts should be 5"

assert isinstance(
config.llm_config.retry.min_wait_seconds, int
), "min_wait_seconds should be int"
assert isinstance(config.llm_config.retry.min_wait_seconds, int), (
"min_wait_seconds should be int"
)
assert config.llm_config.retry.min_wait_seconds == 2, "min_wait_seconds should be 2"

assert isinstance(
config.llm_config.retry.max_wait_seconds, int
), "max_wait_seconds should be int"
assert (
config.llm_config.retry.max_wait_seconds == 10
), "max_wait_seconds should be 10"
assert isinstance(config.llm_config.retry.max_wait_seconds, int), (
"max_wait_seconds should be int"
)
assert config.llm_config.retry.max_wait_seconds == 10, (
"max_wait_seconds should be 10"
)

# Verify float coercion
assert isinstance(
config.default_llm.default_temperature, float
), "default_temperature should be float"
assert (
config.default_llm.default_temperature == 0.7
), "default_temperature should be 0.7"
assert isinstance(config.default_llm.default_temperature, float), (
"default_temperature should be float"
)
assert config.default_llm.default_temperature == 0.7, (
"default_temperature should be 0.7"
)

# Verify boolean coercion
assert isinstance(
config.llm_config.cache_enabled, bool
), "cache_enabled should be bool"
assert isinstance(config.llm_config.cache_enabled, bool), (
"cache_enabled should be bool"
)
assert config.llm_config.cache_enabled is True, "cache_enabled should be True"

assert isinstance(config.logging.verbose, bool), "verbose should be bool"
assert config.logging.verbose is False, "verbose should be False"

assert isinstance(config.logging.format.show_time, bool), "show_time should be bool"
assert (
config.logging.format.show_time is True
), "show_time should be True (from '1')"
assert config.logging.format.show_time is True, (
"show_time should be True (from '1')"
)

assert isinstance(config.logging.levels.debug, bool), "debug should be bool"
assert config.logging.levels.debug is True, "debug should be True"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_logging_thread_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def call_setup():
logger_any.remove = original_remove

assert not errors, f"Errors during concurrent setup: {errors}"
assert (
call_count == 1
), f"logger.remove() called {call_count} times, expected exactly 1"
assert call_count == 1, (
f"logger.remove() called {call_count} times, expected exactly 1"
)
assert logging_module._logging_initialized is True
2 changes: 0 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.