Jesus Lopez commited on
Commit
c35cd37
·
0 Parent(s):

Initial commit

Browse files
.devcontainer/dev/Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM mcr.microsoft.com/devcontainers/python:1-3.12-bookworm
2
+
3
+ RUN <<EOF
4
+ apt update
5
+ apt install -y \
6
+ silversearcher-ag \
7
+ iputils-ping \
8
+
9
+ EOF
.devcontainer/dev/bin/svc ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Usage: svc service [command]
3
+ # Example: svc app ps aux
4
+
5
+ # Validate arguments
6
+ if [[ $# -lt 1 ]]; then
7
+ echo "Usage: svc service [command]"
8
+ exit 1
9
+ fi
10
+
11
+ # Service
12
+ case $1 in
13
+ *)
14
+ SVC=
15
+ CMD=
16
+ ;;
17
+ esac
18
+
19
+ CMD_ARGS="${@:2}"
20
+ if [[ -z $CMD_ARGS ]]; then
21
+ CMD_ARGS="$CMD"
22
+ fi
23
+ docker compose exec $SVC $CMD_ARGS
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/python
3
+ {
4
+ "name": "TTS Service",
5
+ "dockerComposeFile": "docker-compose.yml",
6
+ "service": "dev",
7
+ "runServices": ["dev"],
8
+ "workspaceFolder": "/workspaces/tts-service",
9
+ "features": {
10
+ "ghcr.io/devcontainers/features/github-cli:1": {},
11
+ "ghcr.io/nikobockerman/devcontainer-features/poetry-persistent-cache:1": {},
12
+ "ghcr.io/devcontainers-extra/features/poetry:2": {},
13
+ "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
14
+ },
15
+ "containerEnv": {
16
+ "DOCKER_CLI_HINTS": "false",
17
+ "POETRY_VIRTUALENVS_IN_PROJECT": "false",
18
+ "VIRTUAL_ENV": "/mnt/poetry-persistent-cache/virtualenvs/tts-service-p7H3l83p-py3.13",
19
+ "COMPOSE_PROJECT_NAME": "tts-service_devcontainer",
20
+ "COMPOSE_FILE": "${containerWorkspaceFolder}/.devcontainer/docker-compose.yml"
21
+ },
22
+ "remoteEnv": {
23
+ "PATH": "${containerEnv:VIRTUAL_ENV}/bin:${containerWorkspaceFolder}/.devcontainer/dev/bin:${containerEnv:PATH}"
24
+ },
25
+ "mounts": [
26
+ "type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,readonly",
27
+ "type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,readonly"
28
+ ],
29
+ "postCreateCommand": ".devcontainer/scripts/post-create.sh ${containerWorkspaceFolder}",
30
+ "postStartCommand": ".devcontainer/scripts/post-start.sh ${containerWorkspaceFolder}",
31
+ "customizations": {
32
+ "vscode": {
33
+ "extensions": [
34
+ "charliermarsh.ruff",
35
+ "curlconverter.curlconverter",
36
+ "esbenp.prettier-vscode",
37
+ "github.vscode-github-actions",
38
+ "humao.rest-client",
39
+ "kiliantyler.kubernetes-yaml-formatter-x",
40
+ "matangover.mypy",
41
+ "ms-python.python",
42
+ "ms-toolsai.jupyter",
43
+ "redhat.vscode-yaml",
44
+ "shd101wyy.markdown-preview-enhanced",
45
+ "tamasfe.even-better-toml"
46
+ ],
47
+ "settings": {
48
+ "python.defaultInterpreterPath": "${containerEnv:VIRTUAL_ENV}/bin/python"
49
+ }
50
+ }
51
+ }
52
+ }
.devcontainer/docker-compose.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ dev:
3
+ profiles:
4
+ - devcontainer
5
+ build: dev
6
+ volumes:
7
+ - ../..:/workspaces:cached
8
+ - ..:/workspaces/tts-service:cached
9
+ command: sleep infinity
.devcontainer/scripts/post-create.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Fail on any error
3
+ set -e
4
+
5
+ # Fix rebase issues inside devcontainer
6
+ sudo git config set --global core.checkStat minimal
7
+
8
+ # Permissions for mounts
9
+ sudo chown vscode:vscode ~/.cache ~/.config
10
+
11
+ # Ensure the lock file is up to date, otherwise the install step may fail later
12
+ poetry lock --no-update
13
+
14
+ # Force the virtual environment to the path set in the .devcontainer.json file
15
+ python -mvenv $VIRTUAL_ENV
16
+ PATH="$VIRTUAL_ENV/bin:$PATH"
17
+ poetry install
18
+
19
+ # Activate pre commit hooks
20
+ pre-commit install
21
+
22
+ # Configuration files
23
+ cat >> ~/.inputrc <<EOF
24
+ set completion-ignore-case on
25
+ set editing-mode vi
26
+ EOF
.devcontainer/scripts/post-start.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/bin/bash
2
+ set -e
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ poetry.lock binary
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ .DS_Store
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
.pre-commit-config.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/maresb/check-json5
11
+ rev: v1.0.0
12
+ hooks:
13
+ - id: check-json5
14
+
15
+ - repo: https://github.com/google/yamlfmt
16
+ rev: v0.13.0
17
+ hooks:
18
+ - id: yamlfmt
19
+ args: ["-formatter", "indentless_arrays=true,trim_trailing_whitespace=true,retain_line_breaks_single=true"]
20
+
21
+ - repo: https://github.com/astral-sh/ruff-pre-commit
22
+ rev: v0.7.4
23
+ hooks:
24
+ - id: ruff
25
+ args: [--fix]
26
+ - id: ruff-format
27
+
28
+ - repo: local
29
+ hooks:
30
+ - id: mypy
31
+ name: mypy
32
+ entry: mypy
33
+ language: system
34
+ types: [python]
35
+ pass_filenames: false
.vscode/extensions.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4
+ // List of extensions which should be recommended for users of this workspace.
5
+ "recommendations": [
6
+ "charliermarsh.ruff",
7
+ "curlconverter.curlconverter",
8
+ "esbenp.prettier-vscode",
9
+ "github.vscode-github-actions",
10
+ "humao.rest-client",
11
+ "kiliantyler.kubernetes-yaml-formatter-x",
12
+ "matangover.mypy",
13
+ "ms-python.python",
14
+ "ms-toolsai.jupyter",
15
+ "redhat.vscode-yaml",
16
+ "shd101wyy.markdown-preview-enhanced",
17
+ "tamasfe.even-better-toml"
18
+ ],
19
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
20
+ "unwantedRecommendations": []
21
+ }
.vscode/launch.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python Debugger: Current File",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "program": "${file}",
12
+ "console": "integratedTerminal"
13
+ }
14
+ ]
15
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "editor.codeActionsOnSave": {
3
+ "source.organizeImports": "always",
4
+ "source.unusedImports": "always"
5
+ },
6
+ "editor.detectIndentation": false,
7
+ "editor.formatOnPaste": true,
8
+ "editor.formatOnSave": true,
9
+ "editor.formatOnSaveMode": "file",
10
+ "editor.formatOnType": true,
11
+ "editor.renderWhitespace": "all",
12
+ "editor.rulers": [132],
13
+ "files.trimTrailingWhitespace": true,
14
+ "kubernetes-yaml-formatter-x.indentlessArrays": true,
15
+ "kubernetes-yaml-formatter-x.retainLineBreaksSingle": true,
16
+ "python.analysis.importFormat": "relative",
17
+ "python.analysis.autoFormatStrings": true,
18
+ "python.analysis.autoImportCompletions": true,
19
+ "ruff.organizeImports": true,
20
+
21
+ "[json]": {
22
+ "prettier.tabWidth": 4,
23
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
24
+ },
25
+ "[jsonc]": {
26
+ "prettier.tabWidth": 4,
27
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
28
+ },
29
+ "[jsonl]": {
30
+ "prettier.tabWidth": 4,
31
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
32
+ },
33
+ "[python]": {
34
+ "editor.defaultFormatter": "charliermarsh.ruff"
35
+ },
36
+ "[yaml]": {
37
+ "editor.defaultFormatter": "kiliantyler.kubernetes-yaml-formatter-x"
38
+ }
39
+ }
README.md ADDED
File without changes
poetry.lock ADDED
Binary file (90.8 kB). View file
 
poetry.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [virtualenvs]
2
+ in-project = true
pyproject.toml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "tts-service"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Jesus Lopez <jesus@jesusla.com>"]
6
+ readme = "README.md"
7
+
8
+
9
+ [tool.poetry.dependencies]
10
+ python = "~3.12"
11
+
12
+ [tool.poetry.group.dev.dependencies]
13
+ debugpy = "^1.8.9"
14
+ ipykernel = "^6.29.5"
15
+ pipdeptree = "^2.23.4"
16
+ pre-commit = "^4.0.1"
17
+ ruff = "^0.7.4"
18
+
19
+ [tool.poetry.group.test.dependencies]
20
+ pytest = "^8.3.3"
21
+ pytest-cov = "^6.0.0"
22
+
23
+ [tool.poetry.group.typing.dependencies]
24
+ mypy = "^1.13.0"
25
+
26
+
27
+ [tool.ruff]
28
+ line-length = 132
29
+
30
+ [tool.ruff.lint]
31
+ select = [
32
+ # pycodestyle
33
+ "E",
34
+ # Pyflakes
35
+ "F",
36
+ # pyupgrade
37
+ "UP",
38
+ # flake8-bugbear
39
+ "B",
40
+ # flake8-simplify
41
+ "SIM",
42
+ # isort
43
+ "I",
44
+ ]
45
+
46
+
47
+ [tool.mypy]
48
+ strict = true
49
+
50
+
51
+ [build-system]
52
+ requires = ["poetry-core"]
53
+ build-backend = "poetry.core.masonry.api"
tests/__init__.py ADDED
File without changes
tts_service/__init__.py ADDED
File without changes