sqlsaber 0.38.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. sqlsaber-0.38.0/.github/workflows/claude-code-review.yml +77 -0
  2. sqlsaber-0.38.0/.github/workflows/claude.yml +64 -0
  3. sqlsaber-0.38.0/.github/workflows/deploy-docs.yml +34 -0
  4. sqlsaber-0.38.0/.github/workflows/publish.yml +33 -0
  5. sqlsaber-0.38.0/.github/workflows/test.yml +33 -0
  6. sqlsaber-0.38.0/.gitignore +12 -0
  7. sqlsaber-0.38.0/.python-version +1 -0
  8. sqlsaber-0.38.0/AGENTS.md +44 -0
  9. sqlsaber-0.38.0/CLAUDE.md +21 -0
  10. sqlsaber-0.38.0/LICENSE +201 -0
  11. sqlsaber-0.38.0/PKG-INFO +251 -0
  12. sqlsaber-0.38.0/README.md +227 -0
  13. sqlsaber-0.38.0/docs/.gitignore +24 -0
  14. sqlsaber-0.38.0/docs/.vscode/extensions.json +4 -0
  15. sqlsaber-0.38.0/docs/.vscode/launch.json +11 -0
  16. sqlsaber-0.38.0/docs/CLAUDE.md +40 -0
  17. sqlsaber-0.38.0/docs/astro.config.mjs +57 -0
  18. sqlsaber-0.38.0/docs/package-lock.json +7106 -0
  19. sqlsaber-0.38.0/docs/package.json +22 -0
  20. sqlsaber-0.38.0/docs/public/CNAME +1 -0
  21. sqlsaber-0.38.0/docs/public/favicon.svg +5 -0
  22. sqlsaber-0.38.0/docs/src/assets/sqlsaber.gif +0 -0
  23. sqlsaber-0.38.0/docs/src/content/docs/changelog.md +531 -0
  24. sqlsaber-0.38.0/docs/src/content/docs/guides/authentication.mdx +135 -0
  25. sqlsaber-0.38.0/docs/src/content/docs/guides/database-setup.mdx +198 -0
  26. sqlsaber-0.38.0/docs/src/content/docs/guides/getting-started.mdx +148 -0
  27. sqlsaber-0.38.0/docs/src/content/docs/guides/memory.mdx +127 -0
  28. sqlsaber-0.38.0/docs/src/content/docs/guides/models.mdx +79 -0
  29. sqlsaber-0.38.0/docs/src/content/docs/guides/queries.mdx +199 -0
  30. sqlsaber-0.38.0/docs/src/content/docs/guides/threads.md +69 -0
  31. sqlsaber-0.38.0/docs/src/content/docs/index.mdx +103 -0
  32. sqlsaber-0.38.0/docs/src/content/docs/installation.mdx +72 -0
  33. sqlsaber-0.38.0/docs/src/content/docs/reference/commands.md +470 -0
  34. sqlsaber-0.38.0/docs/src/content.config.ts +7 -0
  35. sqlsaber-0.38.0/docs/src/styles/global.css +243 -0
  36. sqlsaber-0.38.0/docs/tsconfig.json +5 -0
  37. sqlsaber-0.38.0/legislators.db +0 -0
  38. sqlsaber-0.38.0/pyproject.toml +38 -0
  39. sqlsaber-0.38.0/pytest.ini +2 -0
  40. sqlsaber-0.38.0/sqlsaber.gif +0 -0
  41. sqlsaber-0.38.0/sqlsaber.svg +5 -0
  42. sqlsaber-0.38.0/src/sqlsaber/__init__.py +5 -0
  43. sqlsaber-0.38.0/src/sqlsaber/__main__.py +4 -0
  44. sqlsaber-0.38.0/src/sqlsaber/agents/__init__.py +7 -0
  45. sqlsaber-0.38.0/src/sqlsaber/agents/base.py +63 -0
  46. sqlsaber-0.38.0/src/sqlsaber/agents/provider_factory.py +233 -0
  47. sqlsaber-0.38.0/src/sqlsaber/agents/pydantic_ai_agent.py +142 -0
  48. sqlsaber-0.38.0/src/sqlsaber/api.py +139 -0
  49. sqlsaber-0.38.0/src/sqlsaber/application/__init__.py +1 -0
  50. sqlsaber-0.38.0/src/sqlsaber/application/auth_setup.py +236 -0
  51. sqlsaber-0.38.0/src/sqlsaber/application/db_setup.py +258 -0
  52. sqlsaber-0.38.0/src/sqlsaber/application/model_selection.py +98 -0
  53. sqlsaber-0.38.0/src/sqlsaber/application/prompts.py +115 -0
  54. sqlsaber-0.38.0/src/sqlsaber/cli/__init__.py +7 -0
  55. sqlsaber-0.38.0/src/sqlsaber/cli/auth.py +198 -0
  56. sqlsaber-0.38.0/src/sqlsaber/cli/commands.py +293 -0
  57. sqlsaber-0.38.0/src/sqlsaber/cli/completers.py +172 -0
  58. sqlsaber-0.38.0/src/sqlsaber/cli/database.py +528 -0
  59. sqlsaber-0.38.0/src/sqlsaber/cli/display.py +545 -0
  60. sqlsaber-0.38.0/src/sqlsaber/cli/interactive.py +309 -0
  61. sqlsaber-0.38.0/src/sqlsaber/cli/memory.py +273 -0
  62. sqlsaber-0.38.0/src/sqlsaber/cli/models.py +268 -0
  63. sqlsaber-0.38.0/src/sqlsaber/cli/onboarding.py +322 -0
  64. sqlsaber-0.38.0/src/sqlsaber/cli/slash_commands.py +82 -0
  65. sqlsaber-0.38.0/src/sqlsaber/cli/streaming.py +176 -0
  66. sqlsaber-0.38.0/src/sqlsaber/cli/theme.py +154 -0
  67. sqlsaber-0.38.0/src/sqlsaber/cli/threads.py +360 -0
  68. sqlsaber-0.38.0/src/sqlsaber/config/__init__.py +7 -0
  69. sqlsaber-0.38.0/src/sqlsaber/config/api_keys.py +122 -0
  70. sqlsaber-0.38.0/src/sqlsaber/config/auth.py +92 -0
  71. sqlsaber-0.38.0/src/sqlsaber/config/database.py +334 -0
  72. sqlsaber-0.38.0/src/sqlsaber/config/logging.py +195 -0
  73. sqlsaber-0.38.0/src/sqlsaber/config/oauth_flow.py +288 -0
  74. sqlsaber-0.38.0/src/sqlsaber/config/oauth_tokens.py +184 -0
  75. sqlsaber-0.38.0/src/sqlsaber/config/providers.py +116 -0
  76. sqlsaber-0.38.0/src/sqlsaber/config/settings.py +226 -0
  77. sqlsaber-0.38.0/src/sqlsaber/database/__init__.py +70 -0
  78. sqlsaber-0.38.0/src/sqlsaber/database/base.py +194 -0
  79. sqlsaber-0.38.0/src/sqlsaber/database/csv.py +143 -0
  80. sqlsaber-0.38.0/src/sqlsaber/database/duckdb.py +361 -0
  81. sqlsaber-0.38.0/src/sqlsaber/database/mysql.py +382 -0
  82. sqlsaber-0.38.0/src/sqlsaber/database/postgresql.py +386 -0
  83. sqlsaber-0.38.0/src/sqlsaber/database/resolver.py +110 -0
  84. sqlsaber-0.38.0/src/sqlsaber/database/schema.py +168 -0
  85. sqlsaber-0.38.0/src/sqlsaber/database/sqlite.py +281 -0
  86. sqlsaber-0.38.0/src/sqlsaber/memory/__init__.py +1 -0
  87. sqlsaber-0.38.0/src/sqlsaber/memory/manager.py +75 -0
  88. sqlsaber-0.38.0/src/sqlsaber/memory/storage.py +175 -0
  89. sqlsaber-0.38.0/src/sqlsaber/prompts/__init__.py +0 -0
  90. sqlsaber-0.38.0/src/sqlsaber/prompts/claude.py +52 -0
  91. sqlsaber-0.38.0/src/sqlsaber/prompts/memory.py +4 -0
  92. sqlsaber-0.38.0/src/sqlsaber/prompts/openai.py +40 -0
  93. sqlsaber-0.38.0/src/sqlsaber/theme/__init__.py +5 -0
  94. sqlsaber-0.38.0/src/sqlsaber/theme/manager.py +224 -0
  95. sqlsaber-0.38.0/src/sqlsaber/threads/__init__.py +5 -0
  96. sqlsaber-0.38.0/src/sqlsaber/threads/manager.py +87 -0
  97. sqlsaber-0.38.0/src/sqlsaber/threads/storage.py +317 -0
  98. sqlsaber-0.38.0/src/sqlsaber/tools/__init__.py +18 -0
  99. sqlsaber-0.38.0/src/sqlsaber/tools/base.py +30 -0
  100. sqlsaber-0.38.0/src/sqlsaber/tools/registry.py +85 -0
  101. sqlsaber-0.38.0/src/sqlsaber/tools/sql_guard.py +227 -0
  102. sqlsaber-0.38.0/src/sqlsaber/tools/sql_tools.py +199 -0
  103. sqlsaber-0.38.0/tests/__init__.py +0 -0
  104. sqlsaber-0.38.0/tests/conftest.py +42 -0
  105. sqlsaber-0.38.0/tests/test_agents/test_provider_factory.py +142 -0
  106. sqlsaber-0.38.0/tests/test_application/test_auth_setup.py +122 -0
  107. sqlsaber-0.38.0/tests/test_cli/__init__.py +0 -0
  108. sqlsaber-0.38.0/tests/test_cli/test_auth_reset.py +97 -0
  109. sqlsaber-0.38.0/tests/test_cli/test_commands.py +109 -0
  110. sqlsaber-0.38.0/tests/test_cli/test_slash_commands.py +87 -0
  111. sqlsaber-0.38.0/tests/test_cli/test_threads.py +344 -0
  112. sqlsaber-0.38.0/tests/test_config/__init__.py +0 -0
  113. sqlsaber-0.38.0/tests/test_config/test_database.py +263 -0
  114. sqlsaber-0.38.0/tests/test_config/test_oauth.py +154 -0
  115. sqlsaber-0.38.0/tests/test_config/test_providers.py +40 -0
  116. sqlsaber-0.38.0/tests/test_config/test_settings.py +152 -0
  117. sqlsaber-0.38.0/tests/test_database/__init__.py +0 -0
  118. sqlsaber-0.38.0/tests/test_database/test_connection.py +50 -0
  119. sqlsaber-0.38.0/tests/test_database/test_csv_connection.py +40 -0
  120. sqlsaber-0.38.0/tests/test_database/test_csv_module.py +357 -0
  121. sqlsaber-0.38.0/tests/test_database/test_duckdb_module.py +452 -0
  122. sqlsaber-0.38.0/tests/test_database/test_mysql_module.py +49 -0
  123. sqlsaber-0.38.0/tests/test_database/test_postgresql_module.py +129 -0
  124. sqlsaber-0.38.0/tests/test_database/test_schema.py +110 -0
  125. sqlsaber-0.38.0/tests/test_database/test_schema_display.py +355 -0
  126. sqlsaber-0.38.0/tests/test_database/test_sqlite_module.py +307 -0
  127. sqlsaber-0.38.0/tests/test_database/test_timeout.py +105 -0
  128. sqlsaber-0.38.0/tests/test_database_resolver.py +163 -0
  129. sqlsaber-0.38.0/tests/test_theme/test_manager.py +36 -0
  130. sqlsaber-0.38.0/tests/test_tools/__init__.py +1 -0
  131. sqlsaber-0.38.0/tests/test_tools/test_base.py +33 -0
  132. sqlsaber-0.38.0/tests/test_tools/test_registry.py +156 -0
  133. sqlsaber-0.38.0/tests/test_tools/test_sql_guard.py +322 -0
  134. sqlsaber-0.38.0/tests/test_tools/test_sql_tools.py +227 -0
  135. sqlsaber-0.38.0/tests/threads/test_threads_manager.py +184 -0
  136. sqlsaber-0.38.0/tests/threads/test_threads_storage.py +89 -0
  137. sqlsaber-0.38.0/uv.lock +2263 -0
@@ -0,0 +1,77 @@
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@beta
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+
40
+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41
+ # model: "claude-opus-4-20250514"
42
+
43
+ # Direct prompt for automated review (no @claude mention needed)
44
+ direct_prompt: |
45
+ Please review this pull request and provide feedback on:
46
+ - Code quality and best practices
47
+ - Potential bugs or issues
48
+ - Performance considerations
49
+ - Security concerns
50
+ - Test coverage
51
+
52
+ Be constructive and helpful in your feedback.
53
+
54
+ # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55
+ # use_sticky_comment: true
56
+
57
+ # Optional: Customize review based on file types
58
+ # direct_prompt: |
59
+ # Review this PR focusing on:
60
+ # - For TypeScript files: Type safety and proper interface usage
61
+ # - For API endpoints: Security, input validation, and error handling
62
+ # - For React components: Performance, accessibility, and best practices
63
+ # - For tests: Coverage, edge cases, and test quality
64
+
65
+ # Optional: Different prompts for different authors
66
+ # direct_prompt: |
67
+ # ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68
+ # 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69
+ # 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70
+
71
+ # Optional: Add specific tools for running tests or linting
72
+ # allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73
+
74
+ # Optional: Skip review for certain conditions
75
+ if: |
76
+ !contains(github.event.pull_request.title, '[skip-review]') &&
77
+ !contains(github.event.pull_request.title, '[WIP]')
@@ -0,0 +1,64 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@beta
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
44
+ # model: "claude-opus-4-20250514"
45
+
46
+ # Optional: Customize the trigger phrase (default: @claude)
47
+ # trigger_phrase: "/claude"
48
+
49
+ # Optional: Trigger when specific user is assigned to an issue
50
+ # assignee_trigger: "claude-bot"
51
+
52
+ # Optional: Allow Claude to run specific commands
53
+ # allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54
+
55
+ # Optional: Add custom instructions for Claude to customize its behavior for your project
56
+ # custom_instructions: |
57
+ # Follow our coding standards
58
+ # Ensure all new code has tests
59
+ # Use TypeScript for new files
60
+
61
+ # Optional: Custom environment variables for Claude
62
+ # claude_env: |
63
+ # NODE_ENV: test
64
+
@@ -0,0 +1,34 @@
1
+ name: Deploy docs to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ # Allow this job to clone the repo and create a page deployment
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout your repository using git
19
+ uses: actions/checkout@v4
20
+ - name: Install, build, and upload your site
21
+ uses: withastro/action@v3
22
+ with:
23
+ path: docs/
24
+
25
+ deploy:
26
+ needs: build
27
+ runs-on: ubuntu-latest
28
+ environment:
29
+ name: github-pages
30
+ url: ${{ steps.deployment.outputs.page_url }}
31
+ steps:
32
+ - name: Deploy to GitHub Pages
33
+ id: deployment
34
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,33 @@
1
+ name: Build and Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version-file: "pyproject.toml"
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --all-extras --dev
28
+
29
+ - name: Build package
30
+ run: uv build
31
+
32
+ - name: Publish to PyPI
33
+ run: uv publish
@@ -0,0 +1,33 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ # Cancel active CI runs for a PR before starting another run
9
+ concurrency:
10
+ group: ${{ github.workflow}}-${{ github.ref }}
11
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --locked --all-extras --dev
31
+
32
+ - name: Run tests
33
+ run: uv run python -m pytest
@@ -0,0 +1,12 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ *.local.*
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,44 @@
1
+ # Repository Guidelines
2
+
3
+ ## Project Structure & Module Organization
4
+ - Source: `src/sqlsaber/`
5
+ - `cli/`: CLI entry (`saber`, `sqlsaber`), REPL, prompts.
6
+ - `agents/`: agent implementations (pydantic‑ai).
7
+ - `tools/`: SQL, introspection, registry.
8
+ - `database/`: connection, resolver, schema utilities.
9
+ - `memory/`, `conversation/`: state and persistence.
10
+ - `config/`: settings, API keys, OAuth, DB configs.
11
+ - Tests: `tests/` mirror modules (`test_cli/`, `test_tools/`, …).
12
+ - Docs & assets: `docs/`, `sqlsaber.gif`, `sqlsaber.svg`.
13
+
14
+ ## Build, Test, and Development Commands
15
+ - Install (editable): `uv sync`
16
+ - Lint: `uv run ruff check .`
17
+ - Format: `uv run ruff format .`
18
+ - Tests (all): `uv run pytest -q`
19
+ - Tests (targeted): `uv run pytest tests/test_tools -q`
20
+ - Run CLI (dev): `uv run saber` or `uv run python -m sqlsaber`
21
+
22
+
23
+ Note: Prefer `uv run ruff ...` over `uvx ruff ...` to avoid hitting user-level uv caches that may be restricted in sandboxed environments.
24
+
25
+ ## Coding Style & Naming Conventions
26
+ - Python 3.12+, 4‑space indent, use modern type hints.
27
+ - Ruff is the linter/formatter; code must be clean and formatted.
28
+ - Naming: modules/files `snake_case.py`; classes `PascalCase`; functions/vars `snake_case`; constants `UPPER_SNAKE`.
29
+ - Keep public CLI surfaces in `cli/`; factor reusable logic into modules under `sqlsaber/`.
30
+
31
+ ## Testing Guidelines
32
+ - Framework: `pytest` with `pytest-asyncio`.
33
+ - Place tests under `tests/`, name files `test_*.py` and mirror package layout.
34
+ - Include tests for new behavior and bug fixes; prefer async tests for async code.
35
+ - Use fixtures from `tests/conftest.py` where possible.
36
+
37
+ ## Commit & Pull Request Guidelines
38
+ - Commits: short, imperative; prefer conventional prefixes (e.g., `feat:`, `fix:`, `docs:`). Reference issues/PRs when relevant.
39
+ - PRs must: describe the change and rationale, include tests, pass `ruff` and `pytest`, and update docs/README for user‑visible changes.
40
+ - For CLI UX changes, include before/after samples (command + output snippet).
41
+
42
+ ## Security & Configuration Tips
43
+ - Never commit secrets. Configure via CLI: `saber db add` and `saber models set` (credentials stored via system keyring).
44
+ - Queries run read‑only by default; avoid introducing mutating behavior in tools without explicit safeguards.
@@ -0,0 +1,21 @@
1
+ ## Commands
2
+
3
+ - **Run Python**: `uv run python`
4
+ - **Run tests**: `uv run python -m pytest`
5
+ - **Run single test**: `uv run python -m pytest tests/test_path/test_file.py::test_function`
6
+ - **Lint**: `uv run ruff check --fix`
7
+ - **Format**: `uv run ruff format`
8
+
9
+ ## Architecture
10
+
11
+ - **CLI App**: Agentic SQL assistant for natural language to SQL
12
+ - **Core modules**: `agents/` (AI logic), `cli/` (commands), `database/` (connections)
13
+ - **Database support**: PostgreSQL, SQLite, MySQL via asyncpg/aiosqlite/aiomysql
14
+
15
+ ## Code Style
16
+
17
+ - **Imports**: stdlib → 3rd party → local, use relative imports within modules
18
+ - **Naming**: snake_case functions/vars, PascalCase classes, UPPER_SNAKE constants, `_private` methods
19
+ - **Types**: Always use modern type hints (3.12+), async functions for I/O
20
+ - **Errors**: Use try/finally for cleanup
21
+ - **Docstrings**: Triple-quoted with Args/Returns sections
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.