Skip to content

Commit f8e4fb2

Browse files
authored
Template housekeeping - cleanup and fixes (#85)
* [fix] Celery related cleanup * [fix] Cleanup in line with pre commit standard * [fix] Additional linter cleanup * [fix] Minor whitespace cleanup * [fix] Fix ty refference for precommit * [fix] Fix minor typechecking and import issues * [fix] Fix minor ruff issues * [chore] Add git init & initial pass with pre-commit to copier script * [fix] Final cleanup pass * [fix] CR changes
1 parent cbcb265 commit f8e4fb2

35 files changed

+209
-130
lines changed

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+

copier.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,9 @@ _tasks:
121121
when: "{{ project_type in ['api-monolith', 'api-microservice'] }}"
122122
- command: uvx python -c "import os; os.makedirs('migrations/versions', exist_ok=True)"
123123
when: "{{ project_type in ['api-monolith', 'api-microservice', 'agent'] }}"
124-
- "uv sync"
124+
- "uv sync --group code-quality"
125+
- "git init && git checkout -b master && git add --all"
126+
- command: uvx python -c "import subprocess; result = subprocess.run(['uv', 'run', 'pre-commit', 'run', '--all-files']); exit(0)"
127+
- "git add --all"
128+
- command: uvx python -c "import subprocess; subprocess.run(['git', 'commit', '-m', 'Initial commit'])"
129+

python-ai-kit/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ Makefile
2525
.*
2626

2727
*.xml
28-
*.db
28+
*.db

python-ai-kit/.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
*.sh text eol=lf
1+
*.sh text eol=lf

python-ai-kit/.github/workflows/ci.yml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
- name: Run formatter
3434
run: uv run ruff format --check
3535
- name: Run type checker
36-
run: uv run ty check
36+
run: uv run ty check

python-ai-kit/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ __pypackages__/
100100
# Celery stuff
101101
celerybeat-schedule
102102
celerybeat.pid
103+
celerybeat-schedule
104+
celerybeat-schedule-wal
105+
celerybeat-schedule-shm
103106
*-shm
104107
*-wal
105108

@@ -156,4 +159,4 @@ volumes
156159
*.pem
157160

158161
# Streamlit secrets
159-
.streamlit/
162+
.streamlit/

python-ai-kit/.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ repos:
1212
hooks:
1313
- id: ty
1414
name: ty check
15-
entry: .venv/bin/ty check .
15+
entry: uv run ty check .
1616
language: system
17+
pass_filenames: false
1718

1819
- repo: https://github.com/pre-commit/pre-commit-hooks
1920
rev: v6.0.0
2021
hooks:
2122
- id: trailing-whitespace
2223
- id: end-of-file-fixer
2324
- id: check-merge-conflict
24-
args: [--assume-in-merge]
25+
args: [--assume-in-merge]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{default_python_version}}
1+
{{default_python_version}}

python-ai-kit/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

python-ai-kit/app/config.py.jinja

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ class Settings(BaseSettings):
2222
)
2323

2424
# CORE SETTINGS
25-
fernet_decryptor: FernetDecryptorField = Field("MASTER_KEY")
25+
fernet_decryptor: FernetDecryptorField = Field(FernetDecryptorField("MASTER_KEY"))
2626
environment: EnvironmentType = EnvironmentType.LOCAL
2727

2828
# API SETTINGS
29-
api_name: str = f"{{project_name}} API"
29+
api_name: str = "{{project_name}} API"
3030
api_v1: str = "/api/v1"
3131
api_latest: str = api_v1
3232
paging_limit: int = 100
3333
cors_origins: list[AnyHttpUrl] = []
3434
cors_allow_all: bool = False
35-
3635
{% if project_type in ["api-monolith", "api-microservice"] %}
36+
3737
# DATABASE SETTINGS
3838
db_host: str = "localhost"
3939
db_port: int = 5432
4040
db_name: str = "{{project_name}}"
4141
db_user: str = "{{project_name}}"
4242
db_password: SecretStr = SecretStr("{{project_name}}")
4343
{% endif %}
44-
4544
{% if project_type == "agent" %}
45+
4646
# AGENT SETTINGS
4747
debug_mode: bool = False
4848
api_key: str
@@ -66,14 +66,14 @@ class Settings(BaseSettings):
6666
return [url.strip() for url in v.split(',') if url.strip()]
6767
return v
6868
{% endif %}
69-
7069
{% if "celery" in plugins %}
70+
7171
# CELERY SETTINGS
7272
CELERY_BROKER_URL: str
7373
CELERY_RESULT_BACKEND: str
7474
{% endif %}
75-
7675
{% if "sentry" in plugins %}
76+
7777
# Sentry
7878
SENTRY_ENABLED: bool = False
7979
SENTRY_DSN: str | None = None
@@ -99,12 +99,12 @@ class Settings(BaseSettings):
9999
return v.get_decrypted_value(validation_info.data["fernet_decryptor"])
100100
return v
101101

102-
103102
{%if project_type == "mcp-server" %}
103+
104104
# MCP SETTINGS
105105
mcp_server_name: str = f"MCP Server"
106-
{% endif %}
107106

107+
{% endif %}
108108
{% if project_type in ["api-monolith", "api-microservice"] %}
109109
@property
110110
def db_uri(self) -> str:
@@ -113,8 +113,8 @@ class Settings(BaseSettings):
113113
f"{self.db_user}:{self.db_password.get_secret_value()}"
114114
f"@{self.db_host}:{self.db_port}/{self.db_name}"
115115
)
116-
{% endif %}
117116

117+
{% endif %}
118118
# 0. pytest ini_options
119119
# 1. environment variables
120120
# 2. .env

0 commit comments

Comments
 (0)