sqlobjects 1.0.11__tar.gz → 1.0.13__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 (77) hide show
  1. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/CHANGELOG.md +8 -0
  2. {sqlobjects-1.0.11/sqlobjects.egg-info → sqlobjects-1.0.13}/PKG-INFO +11 -9
  3. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/README.md +8 -1
  4. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/README.md +9 -5
  5. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/pyproject.toml +8 -9
  6. sqlobjects-1.0.13/sqlobjects/_install_rules.py +121 -0
  7. {sqlobjects-1.0.11 → sqlobjects-1.0.13/sqlobjects.egg-info}/PKG-INFO +11 -9
  8. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects.egg-info/SOURCES.txt +2 -2
  9. sqlobjects-1.0.13/sqlobjects.egg-info/entry_points.txt +2 -0
  10. sqlobjects-1.0.13/sqlobjects.egg-info/requires.txt +1 -0
  11. sqlobjects-1.0.11/MANIFEST.in +0 -4
  12. sqlobjects-1.0.11/setup.py +0 -105
  13. sqlobjects-1.0.11/sqlobjects.egg-info/requires.txt +0 -9
  14. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/LICENSE +0 -0
  15. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/01-database-session-guide.md +0 -0
  16. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/02-model-definition-guide.md +0 -0
  17. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/03-query-operations-guide.md +0 -0
  18. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/04-crud-operations-guide.md +0 -0
  19. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/05-relationships-guide.md +0 -0
  20. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/06-validation-signals-guide.md +0 -0
  21. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/docs/rules/07-performance-guide.md +0 -0
  22. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/setup.cfg +0 -0
  23. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/__init__.py +0 -0
  24. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/cascade.py +0 -0
  25. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/database/__init__.py +0 -0
  26. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/database/config.py +0 -0
  27. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/database/manager.py +0 -0
  28. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/exceptions.py +0 -0
  29. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/__init__.py +0 -0
  30. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/aggregate.py +0 -0
  31. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/base.py +0 -0
  32. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/function.py +0 -0
  33. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/mixins.py +0 -0
  34. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/scalar.py +0 -0
  35. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/subquery.py +0 -0
  36. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/expressions/terminal.py +0 -0
  37. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/__init__.py +0 -0
  38. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/core.py +0 -0
  39. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/functions.py +0 -0
  40. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/proxies.py +0 -0
  41. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/__init__.py +0 -0
  42. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/descriptors.py +0 -0
  43. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/managers.py +0 -0
  44. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/prefetch.py +0 -0
  45. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/strategies.py +0 -0
  46. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/relations/utils.py +0 -0
  47. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/shortcuts.py +0 -0
  48. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/types/__init__.py +0 -0
  49. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/types/base.py +0 -0
  50. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/types/comparators.py +0 -0
  51. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/types/registry.py +0 -0
  52. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/fields/utils.py +0 -0
  53. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/internal/__init__.py +0 -0
  54. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/internal/operations.py +0 -0
  55. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/internal/results.py +0 -0
  56. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/metadata.py +0 -0
  57. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/mixins.py +0 -0
  58. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/model.py +0 -0
  59. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/objects/__init__.py +0 -0
  60. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/objects/bulk.py +0 -0
  61. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/objects/core.py +0 -0
  62. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/objects/upsert.py +0 -0
  63. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/queries/__init__.py +0 -0
  64. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/queries/builder.py +0 -0
  65. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/queries/dialect.py +0 -0
  66. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/queries/executor.py +0 -0
  67. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/queryset.py +0 -0
  68. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/session.py +0 -0
  69. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/signals.py +0 -0
  70. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/utils/__init__.py +0 -0
  71. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/utils/inspect.py +0 -0
  72. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/utils/naming.py +0 -0
  73. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/utils/pattern.py +0 -0
  74. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects/validators.py +0 -0
  75. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects.egg-info/dependency_links.txt +0 -0
  76. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/sqlobjects.egg-info/top_level.txt +0 -0
  77. {sqlobjects-1.0.11 → sqlobjects-1.0.13}/tests/test_config.py +0 -0
@@ -1,3 +1,11 @@
1
+ ## 1.0.13 (2025-11-18)
2
+
3
+ ## 1.0.12 (2025-11-18)
4
+
5
+ ### Refactor
6
+
7
+ - move rules installer to independent scripts
8
+
1
9
  ## 1.0.11 (2025-11-18)
2
10
 
3
11
  ### Feat
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlobjects
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
5
5
  Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
6
6
  Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
7
- License: MIT
7
+ License-Expression: MIT
8
8
  Project-URL: Homepage, https://github.com/XtraVisionsAI/sqlobjects
9
9
  Project-URL: Repository, https://github.com/XtraVisionsAI/sqlobjects.git
10
10
  Project-URL: Documentation, https://github.com/XtraVisionsAI/sqlobjects#readme
@@ -13,7 +13,6 @@ Project-URL: Changelog, https://github.com/XtraVisionsAI/sqlobjects/blob/main/CH
13
13
  Keywords: python,orm,async,django-style,database,query
14
14
  Classifier: Development Status :: 4 - Beta
15
15
  Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
16
  Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3.12
@@ -25,11 +24,7 @@ Classifier: Typing :: Typed
25
24
  Requires-Python: >=3.12
26
25
  Description-Content-Type: text/markdown
27
26
  License-File: LICENSE
28
- Requires-Dist: sqlalchemy[asyncio]>=2.0.43
29
- Provides-Extra: amazonq
30
- Provides-Extra: kiro
31
- Provides-Extra: claude
32
- Provides-Extra: cursor
27
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.44
33
28
  Dynamic: license-file
34
29
 
35
30
  # SQLObjects
@@ -233,7 +228,14 @@ Best practices and usage patterns optimized for AI coding assistants:
233
228
  - [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
234
229
  - [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
235
230
 
236
- **Installation**: Rules are automatically installed with `pip install sqlobjects[amazonq]` (or `[cursor]`, `[claude]`, `[kiro]`)
231
+ **Installation**:
232
+ ```bash
233
+ # Install package
234
+ pip install sqlobjects
235
+
236
+ # Install rules for your AI assistant
237
+ sqlobjects-install-rules amazonq # or cursor, claude, kiro
238
+ ```
237
239
 
238
240
  ### Feature Documentation
239
241
 
@@ -199,7 +199,14 @@ Best practices and usage patterns optimized for AI coding assistants:
199
199
  - [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
200
200
  - [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
201
201
 
202
- **Installation**: Rules are automatically installed with `pip install sqlobjects[amazonq]` (or `[cursor]`, `[claude]`, `[kiro]`)
202
+ **Installation**:
203
+ ```bash
204
+ # Install package
205
+ pip install sqlobjects
206
+
207
+ # Install rules for your AI assistant
208
+ sqlobjects-install-rules amazonq # or cursor, claude, kiro
209
+ ```
203
210
 
204
211
  ### Feature Documentation
205
212
 
@@ -42,13 +42,17 @@ These rules complement the full documentation:
42
42
 
43
43
  ## Installation
44
44
 
45
- These rules are automatically installed when you use:
45
+ Install the package, then install rules for your AI assistant:
46
46
 
47
47
  ```bash
48
- pip install sqlobjects[amazonq] # For Amazon Q
49
- pip install sqlobjects[cursor] # For Cursor
50
- pip install sqlobjects[claude] # For Claude
51
- pip install sqlobjects[kiro] # For Kiro
48
+ # Install SQLObjects
49
+ pip install sqlobjects
50
+
51
+ # Install rules for your AI assistant
52
+ sqlobjects-install-rules amazonq # For Amazon Q
53
+ sqlobjects-install-rules cursor # For Cursor
54
+ sqlobjects-install-rules claude # For Claude
55
+ sqlobjects-install-rules kiro # For Kiro
52
56
  ```
53
57
 
54
58
  ## Version
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "sqlobjects"
3
- version = "1.0.11"
3
+ version = "1.0.13"
4
4
  description = "Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading"
5
5
  readme = "README.md"
6
- license = { text = "MIT" }
6
+ license = "MIT"
7
7
  authors = [
8
8
  { name = "XtraVisions", email = "gitadmin@xtravisions.com" },
9
9
  { name = "Chen Hao", email = "chenhao@xtravisions.com" }
@@ -23,7 +23,6 @@ keywords = [
23
23
  classifiers = [
24
24
  "Development Status :: 4 - Beta",
25
25
  "Intended Audience :: Developers",
26
- "License :: OSI Approved :: MIT License",
27
26
  "Operating System :: OS Independent",
28
27
  "Programming Language :: Python :: 3",
29
28
  "Programming Language :: Python :: 3.12",
@@ -35,14 +34,11 @@ classifiers = [
35
34
  ]
36
35
  requires-python = ">=3.12"
37
36
  dependencies = [
38
- "sqlalchemy[asyncio]>=2.0.43",
37
+ "sqlalchemy[asyncio]>=2.0.44",
39
38
  ]
40
39
 
41
- [project.optional-dependencies]
42
- amazonq = []
43
- kiro = []
44
- claude = []
45
- cursor = []
40
+ [project.scripts]
41
+ sqlobjects-install-rules = "sqlobjects._install_rules:main"
46
42
 
47
43
  [project.urls]
48
44
  Homepage = "https://github.com/XtraVisionsAI/sqlobjects"
@@ -80,6 +76,9 @@ include = ["sqlobjects*"]
80
76
  [tool.setuptools.package-data]
81
77
  sqlobjects = ["py.typed"]
82
78
 
79
+ [tool.setuptools.data-files]
80
+ "share/sqlobjects/rules" = ["docs/rules/*.md"]
81
+
83
82
  [[tool.uv.index]]
84
83
  name = "tsinghua"
85
84
  url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
@@ -0,0 +1,121 @@
1
+ """Install AI assistant rules to configuration directories."""
2
+
3
+ import shutil
4
+ import sys
5
+ from pathlib import Path
6
+
7
+
8
+ def find_project_root() -> Path:
9
+ """Find project root by looking for common markers."""
10
+ current = Path.cwd()
11
+ markers = [".git", "pyproject.toml", "setup.py", "package.json"]
12
+
13
+ # Search up to 5 levels
14
+ for _ in range(5):
15
+ if any((current / marker).exists() for marker in markers):
16
+ return current
17
+ if current.parent == current: # Reached filesystem root
18
+ break
19
+ current = current.parent
20
+
21
+ # Fallback to current directory
22
+ return Path.cwd()
23
+
24
+
25
+ def install_rules(target_name: str, target_dir: Path | None = None) -> bool:
26
+ """Install rules to AI assistant configuration directory.
27
+
28
+ Args:
29
+ target_name: Target AI assistant (amazonq, kiro, claude, cursor)
30
+ target_dir: Optional custom target directory (default: auto-detect project root)
31
+
32
+ Returns:
33
+ True if successful, False otherwise
34
+ """
35
+ # Try multiple locations for rules directory
36
+ possible_locations = [
37
+ # Location 1: Standard installation - share/sqlobjects/rules
38
+ Path(sys.prefix) / "share" / "sqlobjects" / "rules",
39
+ # Location 2: Development mode - project root
40
+ Path(__file__).parent.parent / "docs" / "rules",
41
+ ]
42
+
43
+ rules_dir = None
44
+ for location in possible_locations:
45
+ if location.exists() and list(location.glob("*.md")):
46
+ rules_dir = location
47
+ break
48
+
49
+ if not rules_dir:
50
+ print("Error: Rules directory not found in any of:", file=sys.stderr)
51
+ for loc in possible_locations:
52
+ print(f" - {loc}", file=sys.stderr)
53
+ return False
54
+
55
+ # Determine base directory
56
+ base_dir = target_dir if target_dir else find_project_root()
57
+
58
+ # Target directory mapping (project-level)
59
+ target_dirs = {
60
+ "amazonq": base_dir / ".amazonq" / "rules" / "sqlobjects",
61
+ "kiro": base_dir / ".kiro" / "rules" / "sqlobjects",
62
+ "claude": base_dir / ".claude" / "rules" / "sqlobjects",
63
+ "cursor": base_dir / ".cursor" / "rules" / "sqlobjects",
64
+ }
65
+
66
+ target_dir = target_dirs.get(target_name)
67
+ if not target_dir:
68
+ print(f"Error: Unknown target '{target_name}'", file=sys.stderr)
69
+ print(f"Valid targets: {', '.join(target_dirs.keys())}", file=sys.stderr)
70
+ return False
71
+
72
+ if not rules_dir.exists():
73
+ print(f"Error: Rules directory not found at {rules_dir}", file=sys.stderr)
74
+ return False
75
+
76
+ # Create target directory and copy files
77
+ try:
78
+ target_dir.mkdir(parents=True, exist_ok=True)
79
+
80
+ copied_count = 0
81
+ for file in rules_dir.glob("*.md"):
82
+ shutil.copy2(file, target_dir / file.name)
83
+ copied_count += 1
84
+
85
+ if copied_count > 0:
86
+ actual_target = target_dirs[target_name]
87
+ print(f"✓ Installed {copied_count} rule files to {actual_target}")
88
+ return True
89
+ else:
90
+ print("Warning: No rule files found to install", file=sys.stderr)
91
+ return False
92
+ except Exception as e:
93
+ print(f"Error: Failed to install rules: {e}", file=sys.stderr)
94
+ return False
95
+
96
+
97
+ def main():
98
+ """CLI entry point."""
99
+ if len(sys.argv) < 2:
100
+ print("Usage: sqlobjects-install-rules <target>")
101
+ print()
102
+ print("Install SQLObjects AI assistant rules to configuration directory.")
103
+ print()
104
+ print("Targets:")
105
+ print(" amazonq - Install to .amazonq/rules/sqlobjects/")
106
+ print(" cursor - Install to .cursor/rules/sqlobjects/")
107
+ print(" claude - Install to .claude/rules/sqlobjects/")
108
+ print(" kiro - Install to .kiro/rules/sqlobjects/")
109
+ print()
110
+ print("Examples:")
111
+ print(" sqlobjects-install-rules amazonq")
112
+ print(" sqlobjects-install-rules cursor")
113
+ sys.exit(1)
114
+
115
+ target = sys.argv[1].lower()
116
+ success = install_rules(target)
117
+ sys.exit(0 if success else 1)
118
+
119
+
120
+ if __name__ == "__main__":
121
+ main()
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlobjects
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: Django-style async ORM library based on SQLAlchemy with chainable queries, Q objects, and relationship loading
5
5
  Author-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
6
6
  Maintainer-email: XtraVisions <gitadmin@xtravisions.com>, Chen Hao <chenhao@xtravisions.com>
7
- License: MIT
7
+ License-Expression: MIT
8
8
  Project-URL: Homepage, https://github.com/XtraVisionsAI/sqlobjects
9
9
  Project-URL: Repository, https://github.com/XtraVisionsAI/sqlobjects.git
10
10
  Project-URL: Documentation, https://github.com/XtraVisionsAI/sqlobjects#readme
@@ -13,7 +13,6 @@ Project-URL: Changelog, https://github.com/XtraVisionsAI/sqlobjects/blob/main/CH
13
13
  Keywords: python,orm,async,django-style,database,query
14
14
  Classifier: Development Status :: 4 - Beta
15
15
  Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: MIT License
17
16
  Classifier: Operating System :: OS Independent
18
17
  Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3.12
@@ -25,11 +24,7 @@ Classifier: Typing :: Typed
25
24
  Requires-Python: >=3.12
26
25
  Description-Content-Type: text/markdown
27
26
  License-File: LICENSE
28
- Requires-Dist: sqlalchemy[asyncio]>=2.0.43
29
- Provides-Extra: amazonq
30
- Provides-Extra: kiro
31
- Provides-Extra: claude
32
- Provides-Extra: cursor
27
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.44
33
28
  Dynamic: license-file
34
29
 
35
30
  # SQLObjects
@@ -233,7 +228,14 @@ Best practices and usage patterns optimized for AI coding assistants:
233
228
  - [Validation & Signals Guide](docs/rules/06-validation-signals-guide.md) - Data validation and lifecycle hooks
234
229
  - [Performance Guide](docs/rules/07-performance-guide.md) - Optimization techniques and best practices
235
230
 
236
- **Installation**: Rules are automatically installed with `pip install sqlobjects[amazonq]` (or `[cursor]`, `[claude]`, `[kiro]`)
231
+ **Installation**:
232
+ ```bash
233
+ # Install package
234
+ pip install sqlobjects
235
+
236
+ # Install rules for your AI assistant
237
+ sqlobjects-install-rules amazonq # or cursor, claude, kiro
238
+ ```
237
239
 
238
240
  ### Feature Documentation
239
241
 
@@ -1,9 +1,7 @@
1
1
  CHANGELOG.md
2
2
  LICENSE
3
- MANIFEST.in
4
3
  README.md
5
4
  pyproject.toml
6
- setup.py
7
5
  docs/rules/01-database-session-guide.md
8
6
  docs/rules/02-model-definition-guide.md
9
7
  docs/rules/03-query-operations-guide.md
@@ -13,6 +11,7 @@ docs/rules/06-validation-signals-guide.md
13
11
  docs/rules/07-performance-guide.md
14
12
  docs/rules/README.md
15
13
  sqlobjects/__init__.py
14
+ sqlobjects/_install_rules.py
16
15
  sqlobjects/cascade.py
17
16
  sqlobjects/exceptions.py
18
17
  sqlobjects/metadata.py
@@ -25,6 +24,7 @@ sqlobjects/validators.py
25
24
  sqlobjects.egg-info/PKG-INFO
26
25
  sqlobjects.egg-info/SOURCES.txt
27
26
  sqlobjects.egg-info/dependency_links.txt
27
+ sqlobjects.egg-info/entry_points.txt
28
28
  sqlobjects.egg-info/requires.txt
29
29
  sqlobjects.egg-info/top_level.txt
30
30
  sqlobjects/database/__init__.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sqlobjects-install-rules = sqlobjects._install_rules:main
@@ -0,0 +1 @@
1
+ sqlalchemy[asyncio]>=2.0.44
@@ -1,4 +0,0 @@
1
- include README.md
2
- include LICENSE
3
- include CHANGELOG.md
4
- recursive-include docs/rules *.md
@@ -1,105 +0,0 @@
1
- import os
2
- import re
3
- import shutil
4
- import sys
5
- from pathlib import Path
6
-
7
- from setuptools import Distribution, setup
8
- from setuptools.command.develop import develop
9
- from setuptools.command.install import install
10
-
11
-
12
- class PostInstallCommand(install):
13
- """Post-installation for installation mode."""
14
-
15
- user_options = install.user_options + [
16
- ("extras=", None, "Extras to install (comma-separated)"),
17
- ]
18
-
19
- def __init__(self, dist: Distribution):
20
- super().__init__(dist)
21
- self.extras: str | None = None
22
-
23
- def initialize_options(self):
24
- install.initialize_options(self)
25
- self.extras = None
26
-
27
- def run(self):
28
- install.run(self)
29
- self._post_install()
30
-
31
- def _post_install(self):
32
- """执行安装后的 rules 复制"""
33
- extras_to_install = set()
34
-
35
- # 方法1: 从环境变量获取
36
- env_extras = os.environ.get("SQLOBJECTS_INSTALL_EXTRAS", "")
37
- if env_extras:
38
- extras_to_install.update(e.strip() for e in env_extras.split(","))
39
-
40
- # 方法2: 从命令行参数检测
41
- for arg in sys.argv:
42
- # 匹配 sqlobjects[amazonq] 或 .[amazonq] 格式
43
- match = re.search(r"\[([^\]]+)\]", arg)
44
- if match:
45
- extras_str = match.group(1)
46
- extras_to_install.update(e.strip() for e in extras_str.split(","))
47
-
48
- # 方法3: 从 self.extras 获取(如果通过 --extras 传递)
49
- if self.extras:
50
- extras_to_install.update(e.strip() for e in self.extras.split(","))
51
-
52
- # 执行安装
53
- valid_extras = {"amazonq", "kiro", "claude", "cursor"}
54
- for extra in extras_to_install & valid_extras:
55
- try:
56
- self._install_rules(extra)
57
- except Exception as e:
58
- print(f"Warning: Failed to install rules for {extra}: {e}", file=sys.stderr)
59
-
60
- def _install_rules(self, target_name: str) -> None:
61
- """复制 rules 到 AI 助手配置目录"""
62
- # 获取 rules 目录
63
- package_dir = Path(__file__).parent
64
- rules_dir = package_dir / "docs" / "rules"
65
-
66
- # 目标目录映射
67
- target_dirs = {
68
- "amazonq": Path.home() / ".amazonq" / "rules" / "sqlobjects",
69
- "kiro": Path.home() / ".kiro" / "rules" / "sqlobjects",
70
- "claude": Path.home() / ".claude" / "rules" / "sqlobjects",
71
- "cursor": Path.home() / ".cursor" / "rules" / "sqlobjects",
72
- }
73
-
74
- target_dir = target_dirs.get(target_name)
75
- if not target_dir or not rules_dir.exists():
76
- return
77
-
78
- # 创建目标目录并复制文件
79
- target_dir.mkdir(parents=True, exist_ok=True)
80
- copied_count = 0
81
- for file in rules_dir.glob("*.md"):
82
- try:
83
- shutil.copy2(file, target_dir / file.name)
84
- copied_count += 1
85
- except Exception:
86
- pass
87
-
88
- if copied_count > 0:
89
- print(f"✓ Installed {copied_count} rule files to {target_dir}")
90
-
91
-
92
- class PostDevelopCommand(develop):
93
- """Post-installation for development mode."""
94
-
95
- def run(self):
96
- develop.run(self)
97
- # 开发模式不自动安装 rules(避免污染开发环境)
98
-
99
-
100
- setup(
101
- cmdclass={
102
- "install": PostInstallCommand,
103
- "develop": PostDevelopCommand,
104
- },
105
- )
@@ -1,9 +0,0 @@
1
- sqlalchemy[asyncio]>=2.0.43
2
-
3
- [amazonq]
4
-
5
- [claude]
6
-
7
- [cursor]
8
-
9
- [kiro]
File without changes
File without changes