deepakpant commited on
Commit
04785dd
·
0 Parent(s):

Initial commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .devcontainer/devcontainer.json +56 -0
  2. .devcontainer/postCreateCommand.sh +12 -0
  3. .editorconfig +24 -0
  4. .github/actions/setup-poetry-env/action.yml +42 -0
  5. .github/workflows/build-and-deploy.yml +55 -0
  6. .github/workflows/deploy-docs.yml +22 -0
  7. .github/workflows/publish-package.yml +41 -0
  8. .github/workflows/test-check-build.yml +91 -0
  9. .github/workflows/version-bump-and-release.yml +62 -0
  10. .gitignore +174 -0
  11. .pre-commit-config.yaml +40 -0
  12. .vscode/launch.json +14 -0
  13. .vscode/settings.json +16 -0
  14. Dockerfile +53 -0
  15. LICENSE +22 -0
  16. Makefile +247 -0
  17. README.md +34 -0
  18. artifacts/documents/.gitkeep +0 -0
  19. artifacts/processed/.gitkeep +0 -0
  20. codecov.yaml +9 -0
  21. docker-compose.yml +22 -0
  22. docs/assets/favicon.ico +0 -0
  23. docs/assets/logo.png +0 -0
  24. docs/index.md +87 -0
  25. docs/modules.md +41 -0
  26. jio_savan_music_downloader/__init__.py +28 -0
  27. jio_savan_music_downloader/api/__init__.py +15 -0
  28. jio_savan_music_downloader/api/endpoint.py +31 -0
  29. jio_savan_music_downloader/config/__init__.py +13 -0
  30. jio_savan_music_downloader/config/config.py +0 -0
  31. jio_savan_music_downloader/constants/__init__.py +18 -0
  32. jio_savan_music_downloader/core/__init__.py +12 -0
  33. jio_savan_music_downloader/core/embedding_service.py +0 -0
  34. jio_savan_music_downloader/core/llm_service.py +0 -0
  35. jio_savan_music_downloader/core/processor.py +0 -0
  36. jio_savan_music_downloader/entity/__init__.py +16 -0
  37. jio_savan_music_downloader/exception/__init__.py +61 -0
  38. jio_savan_music_downloader/logger/__init__.py +61 -0
  39. jio_savan_music_downloader/main.py +92 -0
  40. jio_savan_music_downloader/models/__init__.py +11 -0
  41. jio_savan_music_downloader/models/request_models.py +0 -0
  42. jio_savan_music_downloader/models/response_models.py +0 -0
  43. jio_savan_music_downloader/services/__init__.py +11 -0
  44. jio_savan_music_downloader/services/document_service.py +0 -0
  45. jio_savan_music_downloader/services/vector_db_service.py +0 -0
  46. jio_savan_music_downloader/utils/__init__.py +15 -0
  47. mkdocs.yml +89 -0
  48. notebooks/trails.ipynb +0 -0
  49. poetry.toml +2 -0
  50. pyproject.toml +212 -0
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "jio-savan-music-downloader",
3
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
4
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
5
+ "features": {
6
+ "ghcr.io/devcontainers/features/python:1": {
7
+ "version": "3.12"
8
+ },
9
+ "ghcr.io/devcontainers/features/git:1": {},
10
+ "ghcr.io/devcontainers-contrib/features/poetry:2": {},
11
+ "ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {
12
+ "version": "latest",
13
+ "moby": true
14
+ }
15
+ },
16
+
17
+ // Use 'postCreateCommand' to run commands after the container is created.
18
+ "postCreateCommand": "./.devcontainer/postCreateCommand.sh",
19
+ "forwardPorts": [80, 8000],
20
+
21
+ // Configure tool-specific properties.
22
+ "customizations": {
23
+ "vscode": {
24
+ "extensions": [
25
+ "ms-python.python",
26
+ "editorconfig.editorconfig",
27
+ "ms-azuretools.vscode-docker", // Docker
28
+ "ms-python.isort", // isort
29
+ "visualstudioexptteam.vscodeintellicode", // IntelliCode
30
+ "codeium.codeium", // Codeium AI
31
+ "ms-vscode.makefile-tools", // Makefile tool
32
+ "ms-python.python", // Python
33
+ "ms-python.black-formatter", // Black
34
+ "ms-python.debugpy", // Debugger for Python
35
+ "redhat.vscode-yaml" // YAML
36
+ ],
37
+ "settings": {
38
+ "python.testing.pytestArgs": ["tests"],
39
+ "python.testing.unittestEnabled": false,
40
+ "python.testing.pytestEnabled": true,
41
+ "python.defaultInterpreterPath": "/workspaces/jio-savan-music-downloader/.venv/bin/python",
42
+ "python.testing.pytestPath": "/workspaces/jio-savan-music-downloader/.venv/bin/pytest",
43
+ "python.languageServer": "Pylance",
44
+ "editor.formatOnSave": true,
45
+ "python.analysis.typeCheckingMode": "basic",
46
+ "python.linting.enabled": true,
47
+ "python.linting.pylintEnabled": true
48
+ }
49
+ }
50
+ }//,
51
+ // "hostRequirements": {
52
+ // "cpus": 2,
53
+ // "memory": "4gb",
54
+ // "storage": "10gb"
55
+ // }
56
+ }
.devcontainer/postCreateCommand.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /usr/bin/env bash
2
+
3
+ # Install fish terminal
4
+ sudo apt update -y
5
+ sudo apt-get install fish -y
6
+
7
+ # Repo Initialization
8
+ make init-repo
9
+ git config --global --add safe.directory /workspaces/jio-savan-music-downloader
10
+
11
+ # Install Dependencies
12
+ make reset-env
.editorconfig ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ trim_trailing_whitespace = true
7
+ insert_final_newline = true
8
+ charset = utf-8
9
+ end_of_line = lf
10
+ max_line_length = 120
11
+
12
+ [*.bat]
13
+ indent_style = tab
14
+ end_of_line = crlf
15
+
16
+ [LICENSE]
17
+ insert_final_newline = false
18
+
19
+ [Makefile]
20
+ indent_style = tab
21
+
22
+ [*.json]
23
+ indent_style = space
24
+ indent_size = 4
.github/actions/setup-poetry-env/action.yml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: "setup-poetry-env"
2
+ description: "Composite action to setup the Python and poetry environment."
3
+
4
+ inputs:
5
+ python-version:
6
+ required: false
7
+ description: "The python version to use"
8
+ default: "3.12"
9
+
10
+ runs:
11
+ using: "composite"
12
+ steps:
13
+ - name: Set up python
14
+ uses: actions/setup-python@v5
15
+ with:
16
+ python-version: ${{ inputs.python-version }}
17
+
18
+ - name: Install Poetry
19
+ env:
20
+ POETRY_VERSION: "1.7.1"
21
+ run: curl -sSL https://install.python-poetry.org | python - -y
22
+ shell: bash
23
+
24
+ - name: Add Poetry to Path
25
+ run: echo "$HOME/.local/bin" >> $GITHUB_PATH
26
+ shell: bash
27
+
28
+ - name: Configure Poetry virtual environment in project
29
+ run: poetry config virtualenvs.in-project true
30
+ shell: bash
31
+
32
+ - name: Load cached venv
33
+ id: cached-poetry-dependencies
34
+ uses: actions/cache@v4
35
+ with:
36
+ path: .venv
37
+ key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }}
38
+
39
+ - name: Install dependencies
40
+ if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
41
+ run: poetry install --no-interaction
42
+ shell: bash
.github/workflows/build-and-deploy.yml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Deploy Docker Image
2
+
3
+ on:
4
+ workflow_dispatch: {}
5
+ release:
6
+ types: [published]
7
+ branches: [main]
8
+ repository_dispatch:
9
+ types: [package-release]
10
+
11
+ env:
12
+ DOCKER_IMAGE: deepak93p/jio_savan_music_downloader # Replace with your DockerHub image
13
+ AZURE_WEBAPP_NAME: jio-savan-music-downloader-app # Replace with your Azure Web App name
14
+ AZURE_WEBAPP_RG: jio-savan-music-downloader-rg # Replace with your Azure Web App resource group
15
+
16
+ jobs:
17
+ build-push-docker-image:
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Login to Docker Hub
25
+ env:
26
+ DOCKER_USER: deepak93p
27
+ DOCKER_PWD: ${{ secrets.DOCKERHUB_PUSH_TOKEN }}
28
+ run: echo $DOCKER_PWD | docker login -u $DOCKER_USER --password-stdin
29
+
30
+ - name: Build and Push Docker Image
31
+ run: make bake-container-and-push IMAGE=${{ env.DOCKER_IMAGE }} TAG=${{ github.sha }}
32
+
33
+ - name: Clean up Docker system
34
+ run: docker system prune -f
35
+
36
+ deploy:
37
+ runs-on: ubuntu-latest
38
+ needs: build-push-docker-image
39
+ environment:
40
+ name: "production"
41
+
42
+ steps:
43
+ - name: Azure Login
44
+ uses: azure/login@v1
45
+ with:
46
+ creds: ${{ secrets.AZURE_CREDENTIALS }}
47
+
48
+ - name: Deploy to Azure Container Apps
49
+ run: |
50
+ az containerapp update \
51
+ --name ${{ env.AZURE_WEBAPP_NAME }} \
52
+ --resource-group ${{ env.AZURE_WEBAPP_RG }} \
53
+ --image index.docker.io/${{ env.DOCKER_IMAGE }}:${{ github.sha }} \
54
+ --query "properties.configuration.ingress.fqdn" \
55
+ -o tsv
.github/workflows/deploy-docs.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ branches: [main]
7
+ repository_dispatch:
8
+ types: [package-release]
9
+
10
+ jobs:
11
+ deploy-docs:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Check out
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up the environment
19
+ uses: ./.github/actions/setup-poetry-env
20
+
21
+ - name: Deploy documentation
22
+ run: poetry run mkdocs gh-deploy --force
.github/workflows/publish-package.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Publish Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ branches: [main]
7
+ repository_dispatch:
8
+ types: [package-release]
9
+
10
+
11
+ jobs:
12
+ publish-to-pypi:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Check out
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up the environment
20
+ uses: ./.github/actions/setup-poetry-env
21
+
22
+ - name: Export tag
23
+ id: vars
24
+ run: |
25
+ if [ "${{ github.event.client_payload.version }}" != "" ]; then
26
+ echo "tag=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT
27
+ elif [ "${{ github.event.inputs.version }}" != "" ]; then
28
+ echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
29
+ else
30
+ echo "No version provided"
31
+ exit 1
32
+ fi
33
+
34
+ - name: Build and publish
35
+ run: |
36
+ source .venv/bin/activate
37
+ poetry version $RELEASE_VERSION
38
+ make bake-and-publish
39
+ env:
40
+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
41
+ RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
.github/workflows/test-check-build.yml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Test, check and build pipeline
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types: [opened, synchronize, reopened, ready_for_review]
9
+
10
+ jobs:
11
+ quality:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Check out
15
+ uses: actions/checkout@v4
16
+
17
+ - uses: actions/cache@v4
18
+ with:
19
+ path: ~/.cache/pre-commit
20
+ key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
21
+
22
+ - name: Set up the environment
23
+ uses: ./.github/actions/setup-poetry-env
24
+
25
+ - name: Run checks
26
+ run: make lint
27
+
28
+ tests:
29
+ runs-on: ubuntu-latest
30
+ needs: quality
31
+ strategy:
32
+ matrix:
33
+ python-version: ["3.12"]
34
+ fail-fast: false
35
+ defaults:
36
+ run:
37
+ shell: bash
38
+ steps:
39
+ - name: Check out
40
+ uses: actions/checkout@v4
41
+
42
+ - name: Set up the environment
43
+ uses: ./.github/actions/setup-poetry-env
44
+ with:
45
+ python-version: ${{ matrix.python-version }}
46
+
47
+ - name: Run tests
48
+ run: poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
49
+
50
+ - name: Check typing
51
+ run: poetry run mypy
52
+
53
+ - name: Upload coverage reports to Codecov with GitHub Action on Python 3.12
54
+ uses: codecov/codecov-action@v5
55
+ with:
56
+ token: ${{ secrets.CODECOV_TOKEN }}
57
+ if: ${{ matrix.python-version == '3.12' }}
58
+
59
+ build:
60
+ runs-on: ubuntu-latest
61
+ needs: tests
62
+ strategy:
63
+ matrix:
64
+ python-version: ["3.12"]
65
+ fail-fast: false
66
+ defaults:
67
+ run:
68
+ shell: bash
69
+ steps:
70
+ - name: Check out
71
+ uses: actions/checkout@v4
72
+
73
+ - name: Set up the environment
74
+ uses: ./.github/actions/setup-poetry-env
75
+ with:
76
+ python-version: ${{ matrix.python-version }}
77
+
78
+ - name: Build
79
+ run: make bake
80
+
81
+ check-docs:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - name: Check out
85
+ uses: actions/checkout@v4
86
+
87
+ - name: Set up the environment
88
+ uses: ./.github/actions/setup-poetry-env
89
+
90
+ - name: Check if documentation can be built
91
+ run: poetry run mkdocs build -s
.github/workflows/version-bump-and-release.yml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Version Bump and Create Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ bump_type:
7
+ description: "Type of version bump"
8
+ required: true
9
+ type: choice
10
+ options:
11
+ - patch
12
+ - minor
13
+ - major
14
+
15
+ permissions:
16
+ contents: write
17
+
18
+
19
+ jobs:
20
+ bump-version:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+ token: ${{ secrets.GITHUB_TOKEN }}
28
+
29
+ - name: Set up the environment
30
+ uses: ./.github/actions/setup-poetry-env
31
+ with:
32
+ python-version: "3.12"
33
+
34
+ - name: Configure Git
35
+ run: |
36
+ git config --global user.name 'GitHub Actions'
37
+ git config --global user.email '[email protected]'
38
+
39
+ - name: Bump Version
40
+ id: bump
41
+ run: |
42
+ poetry run bump-my-version bump ${{ github.event.inputs.bump_type }}
43
+ echo "NEW_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
44
+
45
+ - name: Push changes
46
+ run: |
47
+ git push
48
+ git push --tags
49
+
50
+ - name: Create Release
51
+ uses: softprops/action-gh-release@v2
52
+ with:
53
+ generate_release_notes: true
54
+ tag_name: ${{ steps.bump.outputs.NEW_TAG }}
55
+
56
+ - name: Trigger Package Publish
57
+ uses: peter-evans/repository-dispatch@v3
58
+ with:
59
+ token: ${{ secrets.GITHUB_TOKEN }}
60
+ event-type: package-release
61
+ client-payload: '{"version": "${{ steps.bump.outputs.NEW_TAG }}"}'
62
+
.gitignore ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ docs/source
2
+
3
+ # From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # poetry
102
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ #poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ #pdm.lock
111
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112
+ # in version control.
113
+ # https://pdm.fming.dev/#use-with-ide
114
+ .pdm.toml
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .venv
129
+ env/
130
+ venv/
131
+ ENV/
132
+ env.bak/
133
+ venv.bak/
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # Pyre type checker
151
+ .pyre/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # Vscode config files
160
+ # .vscode/
161
+
162
+ # PyCharm
163
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
164
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
166
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
167
+ #.idea/
168
+
169
+ # artifect/
170
+ dvc-service-account-key.json
171
+
172
+
173
+ # MacOS
174
+ .DS_Store
.pre-commit-config.yaml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: "v4.4.0"
4
+ hooks:
5
+ - id: check-case-conflict
6
+ - id: check-merge-conflict
7
+ - id: end-of-file-fixer
8
+ - id: trailing-whitespace
9
+ - id: check-yaml
10
+ - id: check-toml
11
+
12
+ - repo: https://github.com/astral-sh/ruff-pre-commit
13
+ rev: "v0.5.2"
14
+ hooks:
15
+ - id: ruff
16
+ args: [--exit-non-zero-on-fix, --config=pyproject.toml]
17
+ - id: ruff-format
18
+ args: [--config=pyproject.toml]
19
+
20
+ - repo: https://github.com/pre-commit/mirrors-prettier
21
+ rev: "v3.0.3"
22
+ hooks:
23
+ - id: prettier
24
+
25
+ - repo: https://github.com/psf/black
26
+ rev: 23.9.0
27
+ hooks:
28
+ - id: black
29
+
30
+ - repo: https://github.com/timothycrosley/isort
31
+ rev: 5.12.0
32
+ hooks:
33
+ - id: isort
34
+ args: [--settings-path=pyproject.toml]
35
+
36
+ - repo: https://github.com/PyCQA/pydocstyle
37
+ rev: 6.3.0
38
+ hooks:
39
+ - id: pydocstyle
40
+ args: [--config=pyproject.toml]
.vscode/launch.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Python Debugger: jio_savan_music_downloader",
6
+ "type": "debugpy",
7
+ "request": "launch",
8
+ "program": "${workspaceFolder}/jio_savan_music_downloader/main.py",
9
+ "console": "integratedTerminal",
10
+ "justMyCode": true,
11
+ "jinja": true
12
+ }
13
+ ]
14
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "files.exclude": {
3
+ "**/.mypy_cache": true,
4
+ "**/__pycache__": true,
5
+ "**/.pytest_cache": true,
6
+ "**/.ruff_cache": true,
7
+ "**/.venv": true,
8
+ "**/venv": true,
9
+ "**/node_modules": true,
10
+ "**/site": true,
11
+ "**/.coverage": true,
12
+ "**/coverage.xml": true,
13
+ "**/build": true,
14
+ "**/dist": true
15
+ }
16
+ }
Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Builder Stage
2
+ FROM python:3.12-slim AS builder
3
+
4
+ # Set environment variables for Poetry
5
+ ENV POETRY_VERSION=1.6.1 \
6
+ POETRY_HOME="/opt/poetry" \
7
+ PATH="/opt/poetry/bin:$PATH"
8
+
9
+ # Install Poetry and necessary tools
10
+ RUN apt-get update && apt-get install -y --no-install-recommends curl \
11
+ && curl -sSL https://install.python-poetry.org | python3 - \
12
+ && apt-get remove -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Set working directory
15
+ WORKDIR /app
16
+
17
+ # Copy only the dependency files first to leverage Docker caching
18
+ COPY pyproject.toml poetry.lock /app/
19
+
20
+ # Install dependencies (only for building the wheel)
21
+ RUN poetry config virtualenvs.create false \
22
+ && poetry install --no-root --only main
23
+
24
+ # Copy the rest of the application code
25
+ COPY . /app
26
+
27
+ # Build the wheel file
28
+ RUN poetry build -f wheel
29
+
30
+ # Runtime Stage
31
+ FROM python:3.12-slim AS runtime
32
+
33
+ # Set environment variables
34
+ ENV PYTHONUNBUFFERED=1
35
+
36
+ # Install runtime dependencies
37
+ RUN apt-get update && apt-get install -y --no-install-recommends libpq-dev \
38
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
39
+
40
+ # Set working directory
41
+ WORKDIR /app
42
+
43
+ # Copy the built wheel file from the builder stage
44
+ COPY --from=builder /app/dist/*.whl /app/
45
+
46
+ # Install the wheel file
47
+ RUN pip install --no-cache-dir /app/*.whl
48
+
49
+ # Expose application port
50
+ EXPOSE 80
51
+
52
+ # Command to run the application
53
+ CMD ["jio_savan_music_downloader"]
LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025, Deepak pant
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
Makefile ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # =============================
2
+ # Variable Documentation
3
+ # =============================
4
+
5
+ # PYPI_TOKEN: Authentication token for PyPI publishing
6
+ # Usage: make publish PYPI_TOKEN=your_pypi_token
7
+
8
+ # PACKAGE_NAME: Name of the Python package for dependency tree
9
+ # Usage: make print-dependency-tree PACKAGE_NAME=your_package_name
10
+
11
+
12
+ # =============================
13
+ # Project Configuration
14
+ # =============================
15
+ PROJECT_NAME = jio-savan-music-downloader
16
+ GITHUB_USERNAME = DeepakPant93
17
+ GITHUB_REPO = $(PROJECT_NAME)
18
+ PROJECT_SLUG = jio_savan_music_downloader
19
+ CLOUD_REGION = eastus
20
+ TAG = latest
21
+ IMAGE_NAME = deepak93p/$(PROJECT_SLUG)
22
+ RESOURCE_GROUP = $(PROJECT_NAME)-rg
23
+ APP_NAME = $(PROJECT_NAME)-app
24
+ APP_ENV_NAME = $(APP_NAME)-env
25
+ BUMP_TYPE = patch
26
+
27
+ # =============================
28
+ # Help (Default Target)
29
+ # =============================
30
+ .PHONY: help
31
+ help: ## Display this help message
32
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
33
+
34
+ .DEFAULT_GOAL := help
35
+
36
+ # =============================
37
+ # Installation and Setup
38
+ # =============================
39
+ .PHONY: bake-env
40
+ bake-env: clean-env ## Install the poetry environment and set up pre-commit hooks
41
+ @echo "🚀 Creating virtual environment using pyenv and poetry"
42
+ @poetry install
43
+ @poetry run pre-commit install || true
44
+ @max_retries=3; count=0; \
45
+ while ! make lint; do \
46
+ count=$$((count + 1)); \
47
+ if [ $$count -ge $$max_retries ]; then \
48
+ echo "Max retries reached. Exiting."; \
49
+ exit 1; \
50
+ fi; \
51
+ echo "Retrying make lint ($$count/$$max_retries)..."; \
52
+ done
53
+ @poetry shell
54
+
55
+ .PHONY: clean-env
56
+ clean-env: ## Remove the poetry environment
57
+ @echo "🚀 Removing virtual environment"
58
+ @rm -rf .venv
59
+
60
+ .PHONY: reset-env
61
+ reset-env: clean-env bake-env ## Install the poetry environment and set up pre-commit hooks
62
+
63
+ .PHONY: init-repo
64
+ init-repo: ## Initialize git repository
65
+ @echo "🚀 Initializing git repository"
66
+ @git init
67
+ @echo "🚀 Creating initial commit"
68
+ @git add .
69
+ @git commit -m "Initial commit"
70
+ @echo "🚀 Adding remote repository"
71
+ @git branch -M main
72
+ @git remote add origin [email protected]:$(GITHUB_USERNAME)/$(GITHUB_REPO).git
73
+ @echo "🚀 Pushing initial commit"
74
+ @git push -u origin main
75
+
76
+ .PHONY: setup-cloud-env
77
+ setup-cloud-env: ## Create resource group, container app environment, and service principal
78
+ @echo "🚀 Creating resource group: $(RESOURCE_GROUP)"
79
+ @az group create --name $(RESOURCE_GROUP) --location $(CLOUD_REGION)
80
+
81
+ @echo "🚀 Creating container app environment: $(APP_ENV_NAME)"
82
+ @az containerapp env create --name $(APP_ENV_NAME) --resource-group $(RESOURCE_GROUP) --location $(CLOUD_REGION)
83
+
84
+ @echo "🚀 Fetching subscription ID"
85
+ @subscription_id=$$(az account show --query "id" -o tsv) && \
86
+ echo "Subscription ID: $$subscription_id" && \
87
+ echo "🚀 Creating service principal for: $(APP_NAME)" && \
88
+ az ad sp create-for-rbac --name "$(APP_NAME)-service-principal" --role contributor --scopes /subscriptions/$$subscription_id --sdk-auth
89
+
90
+ @echo "🚀 Creating container app: $(APP_NAME)"
91
+ @az containerapp create --name $(APP_NAME) --resource-group $(RESOURCE_GROUP) --environment $(APP_ENV_NAME) --image 'nginx:latest' --target-port 80 --ingress 'external' --query "properties.configuration.ingress.fqdn"
92
+
93
+ .PHONY: clean-cloud-env
94
+ clean-cloud-env: ## Delete resource group, container app environment, and service principal
95
+ @echo "🚀 Deleting service principal for: $(APP_NAME)-service-principal"
96
+ @sp_object_id=$$(az ad sp list --display-name "$(APP_NAME)-service-principal" --query "[0].id" -o tsv) && \
97
+ if [ -n "$$sp_object_id" ]; then \
98
+ az ad sp delete --id $$sp_object_id; \
99
+ echo "Service principal deleted"; \
100
+ else \
101
+ echo "Service principal not found, skipping deletion"; \
102
+ fi
103
+
104
+ @echo "🚀 Deleting container app: $(APP_NAME)"
105
+ @az containerapp delete --name $(APP_NAME) --resource-group $(RESOURCE_GROUP) --yes --no-wait || echo "Container app not found, skipping deletion"
106
+
107
+ @echo "🚀 Deleting container app environment: $(APP_ENV_NAME)"
108
+ @az containerapp env delete --name $(APP_ENV_NAME) --resource-group $(RESOURCE_GROUP) --yes --no-wait || echo "Container app environment not found, skipping deletion"
109
+
110
+ @echo "🚀 Deleting resource group: $(RESOURCE_GROUP)"
111
+ @az group delete --name $(RESOURCE_GROUP) --yes --no-wait || echo "Resource group not found, skipping deletion"
112
+
113
+
114
+ # =============================
115
+ # Code Quality and Testing
116
+ # =============================
117
+ .PHONY: lint
118
+ lint: ## Run code quality tools
119
+ @echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml'"
120
+ @poetry check --lock
121
+ @echo "🚀 Linting code with pre-commit"
122
+ @poetry run pre-commit run -a
123
+ @echo "🚀 Static type checking with mypy"
124
+ @poetry run mypy
125
+ @echo "🚀 Checking for obsolete dependencies with deptry"
126
+ @poetry run deptry .
127
+ @echo "🚀 Checking for security vulnerabilities with bandit"
128
+ @poetry run bandit -c pyproject.toml -r jio_savan_music_downloader/ -ll
129
+
130
+
131
+ .PHONY: test
132
+ test: ## Run tests with pytest
133
+ @echo "🚀 Running tests with pytest"
134
+ @poetry run pytest --cov --cov-config=pyproject.toml --cov-report=term-missing
135
+
136
+
137
+ # =============================
138
+ # Build and Release
139
+ # =============================
140
+ .PHONY: bake
141
+ bake: clean-bake ## Build wheel file using poetry
142
+ @echo "🚀 Creating wheel file"
143
+ @poetry build
144
+
145
+ .PHONY: clean-bake
146
+ clean-bake: ## Clean build artifacts
147
+ @rm -rf dist
148
+
149
+ .PHONY: bump
150
+ bump: ## Bump project version
151
+ @echo "🚀 Bumping version"
152
+ @poetry run bump-my-version bump $(BUMP_TYPE)
153
+
154
+ .PHONY: publish
155
+ publish: ## Publish a release to PyPI
156
+ @echo "🚀 Publishing: Dry run"
157
+ @poetry config pypi-token.pypi $(PYPI_TOKEN)
158
+ @poetry publish --dry-run
159
+ @echo "🚀 Publishing"
160
+ @poetry publish
161
+
162
+ .PHONY: bake-and-publish
163
+ bake-and-publish: bake publish ## Build and publish to PyPI
164
+
165
+ .PHONY: update
166
+ update: ## Update project dependencies
167
+ @echo "🚀 Updating project dependencies"
168
+ @poetry update
169
+ @poetry run pre-commit install --overwrite
170
+ @echo "Dependencies updated successfully"
171
+
172
+ # =============================
173
+ # Run and Documentation
174
+ # =============================
175
+ .PHONY: run
176
+ run: ## Run the project's main application
177
+ @echo "🚀 Running the project"
178
+ @poetry run python $(PROJECT_SLUG)/main.py
179
+
180
+ .PHONY: docs-test
181
+ docs-test: ## Test if documentation can be built without warnings or errors
182
+ @poetry run mkdocs build -s
183
+
184
+ .PHONY: docs
185
+ docs: ## Build and serve the documentation
186
+ @poetry run mkdocs serve
187
+
188
+ # =============================
189
+ # Docker
190
+ # =============================
191
+ .PHONY: bake-container
192
+ bake-container: ## Build Docker image
193
+ @echo "🚀 Building Docker image"
194
+ docker build -t $(IMAGE_NAME):$(TAG) -f Dockerfile .
195
+
196
+ .PHONY: container-push
197
+ container-push: ## Push Docker image to Docker Hub
198
+ @echo "🚀 Pushing Docker image to Docker Hub"
199
+ docker push $(IMAGE_NAME):$(TAG)
200
+
201
+ .PHONY: bake-container-and-push
202
+ bake-container-and-push: bake-container container-push ## Build and push Docker image to Docker Hub
203
+
204
+ .PHONY: clean-container
205
+ clean-container: ## Clean up Docker resources related to the app
206
+ @echo "🚀 Deleting Docker image for app: $(IMAGE_NAME)"
207
+ @docker images $(IMAGE_NAME) --format "{{.Repository}}:{{.Tag}}" | xargs -r docker rmi -f || echo "No image to delete"
208
+
209
+ @echo "🚀 Deleting unused Docker volumes"
210
+ @docker volume ls -qf dangling=true | xargs -r docker volume rm || echo "No unused volumes to delete"
211
+
212
+ @echo "🚀 Deleting unused Docker networks"
213
+ @docker network ls -q --filter "dangling=true" | xargs -r docker network rm || echo "No unused networks to delete"
214
+
215
+ @echo "🚀 Cleaning up stopped containers"
216
+ @docker ps -aq --filter "status=exited" | xargs -r docker rm || echo "No stopped containers to clean up"
217
+
218
+
219
+ # =============================
220
+ # Debug
221
+ # =============================
222
+
223
+ .PHONY: print-dependency-tree
224
+ print-dependency-tree: ## Print dependency tree
225
+ @echo "Printing dependency tree..."
226
+ @poetry run pipdeptree -p $(PACKAGE_NAME)
227
+
228
+
229
+ # =============================
230
+ # Cleanup
231
+ # =============================
232
+ .PHONY: teardown
233
+ teardown: clean-bake clean-container ## Clean up temporary files and directories and destroy the virtual environment, Docker image from your local machine
234
+ @echo "🚀 Cleaning up temporary files and directories"
235
+ @rm -rf .pytest_cache || true
236
+ @rm -rf dist || true
237
+ @rm -rf build || true
238
+ @rm -rf htmlcov || true
239
+ @rm -rf .venv || true
240
+ @rm -rf .mypy_cache || true
241
+ @rm -rf site || true
242
+ @find . -type d -name "__pycache__" -exec rm -rf {} + || true
243
+ @rm -rf .ruff_cache || true
244
+ @echo "🚀 Clean up completed."
245
+
246
+ .PHONY: teardown-all
247
+ teardown-all: teardown clean-cloud-env ## Clean up temporary files and directories and destroy the virtual environment, Docker image, and Cloud resources
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # jio-savan-music-downloader
2
+
3
+ This app will download Jio-Savan music.
4
+
5
+ - **Github repository**: <https://github.com/DeepakPant93/jio-savan-music-downloader/>
6
+ - **Documentation** <https://DeepakPant93.github.io/jio-savan-music-downloader/>
7
+
8
+ ## Getting started with your project
9
+
10
+ First, create a repository on GitHub with the same name as this project, and then run the following commands:
11
+
12
+ ## Installation
13
+
14
+ 1. Initialize the repository if it's your first time:
15
+
16
+ ```bash
17
+ cd jio-savan-music-downloader
18
+ make init-repo
19
+ ```
20
+
21
+ 2. Install dependencies using Poetry:
22
+
23
+ ```bash
24
+ make bake-env
25
+ ```
26
+
27
+ 3. Run the FastAPI server:
28
+
29
+ ```bash
30
+ make run
31
+ ```
32
+
33
+ You are now ready to start development on your project!
34
+ The CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release.
artifacts/documents/.gitkeep ADDED
File without changes
artifacts/processed/.gitkeep ADDED
File without changes
codecov.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ coverage:
2
+ range: 70..100
3
+ round: down
4
+ precision: 1
5
+ status:
6
+ project:
7
+ default:
8
+ target: 90%
9
+ threshold: 0.5%
docker-compose.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: "3.9"
2
+
3
+ services:
4
+ jio_savan_music_downloader:
5
+ build:
6
+ context: .
7
+ dockerfile: Dockerfile
8
+ container_name: jio_savan_music_downloader
9
+ ports:
10
+ - "80:80"
11
+ volumes:
12
+ - .:/app
13
+ environment:
14
+ - PYTHONUNBUFFERED=1
15
+ healthcheck:
16
+ test: ["CMD", "curl", "-f", "http://localhost:80/health" ]
17
+ interval: 30s
18
+ timeout: 10s
19
+ retries: 3
20
+ start_period: 10s
21
+ command: >
22
+ jio_savan_music_downloader
docs/assets/favicon.ico ADDED
docs/assets/logo.png ADDED
docs/index.md ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # jio-savan-music-downloader
2
+
3
+ [![Release](https://img.shields.io/github/v/release/DeepakPant93/jio-savan-music-downloader)](https://img.shields.io/github/v/release/DeepakPant93/jio-savan-music-downloader)
4
+ [![Build status](https://img.shields.io/github/actions/workflow/status/DeepakPant93/jio-savan-music-downloader/test-check-build.yml?branch=main)](https://github.com/DeepakPant93/jio-savan-music-downloader/actions/workflows/test-check-build.yml?query=branch%3Amain)
5
+ [![Commit activity](https://img.shields.io/github/commit-activity/m/DeepakPant93/jio-savan-music-downloader)](https://img.shields.io/github/commit-activity/m/DeepakPant93/jio-savan-music-downloader)
6
+ [![License](https://img.shields.io/github/license/DeepakPant93/jio-savan-music-downloader)](https://img.shields.io/github/license/DeepakPant93/jio-savan-music-downloader)
7
+
8
+ This app will download Jio-Savan music.
9
+ This repository contains a sample Data Science application built with FastAPI, designed to streamline model training and prediction processes via RESTful APIs. The application leverages **Poetry** for dependency management, ensuring a robust and scalable development environment.
10
+
11
+ ---
12
+
13
+ ## Features
14
+
15
+ ### FastAPI Endpoints:
16
+
17
+ - `/upload-docs`: API endpoint to upload documents for creating embeddings.
18
+ - `/ask`: API endpoint for querying the system and receiving context-aware answers.
19
+
20
+ ### Poetry for Dependency Management:
21
+
22
+ - Simplifies package installation and management.
23
+ - Ensures compatibility and reproducibility of the project environment.
24
+
25
+ ### Scalable Architecture:
26
+
27
+ - Modular design with clear separation of concerns.
28
+ - Easy integration of new features or pipelines.
29
+
30
+ ---
31
+
32
+ ## Prerequisites
33
+
34
+ - Python >= 3.12
35
+ - Poetry installed (`pip install poetry`)
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ 1. Clone the repository:
42
+
43
+ ```bash
44
+ git clone https://github.com/DeepakPant93/jio-savan-music-downloader.
45
+ cd jio-savan-music-downloader
46
+ ```
47
+ 1. Initialize the repository if it's your first time:
48
+
49
+ ```bash
50
+ cd jio-savan-music-downloader
51
+ make init-repo
52
+ ```
53
+
54
+ 2. Install dependencies using Poetry:
55
+
56
+ ```bash
57
+ make bake-env
58
+ ```
59
+
60
+ 3. Run the FastAPI server:
61
+
62
+ ```bash
63
+ make run
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Project Structure
69
+
70
+ ```plaintext
71
+ ──jio-savan-music-downloader/
72
+ ├── api # API route definitions
73
+ ├── config # Configuration files and settings
74
+ ├── constants # Static constants and enumerations
75
+ ├── core # Core logic for the application
76
+ ├── entity # Definitions of data models and schemas
77
+ ├── exception # Custom exception classes for error handling
78
+ ├── logger # Logging setup for the application
79
+ ├── models # Request and response models
80
+ ├── services # Business logic and service layer
81
+ ├── utils # Utility functions (e.g., file handling, data encoding)
82
+ └── main.py # Entry point for the FastAPI application
83
+ ```
84
+
85
+ ---
86
+
87
+ Enjoy building with this RAG FastAPI application! 🚀
docs/modules.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ::: jio_savan_music_downloader
2
+
3
+ ## Configuration
4
+
5
+ ::: jio_savan_music_downloader.config
6
+
7
+ ## Core
8
+
9
+ ::: jio_savan_music_downloader.core
10
+
11
+ ## Constants
12
+
13
+ ::: jio_savan_music_downloader.constants
14
+
15
+ ## Logger
16
+
17
+ ::: jio_savan_music_downloader.logger
18
+
19
+ ## Utils
20
+
21
+ ::: jio_savan_music_downloader.utils
22
+
23
+ ## Exceptions
24
+
25
+ ::: jio_savan_music_downloader.exception
26
+
27
+ ## Entities
28
+
29
+ ::: jio_savan_music_downloader.entity
30
+
31
+ ## Models
32
+
33
+ ::: jio_savan_music_downloader.models
34
+
35
+ ## Services
36
+
37
+ ::: jio_savan_music_downloader.services
38
+
39
+ ## APIs
40
+
41
+ ::: jio_savan_music_downloader.api
jio_savan_music_downloader/__init__.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This is the initialization file for the RAG (Retrieval-Augmented Generation) application,
4
+ designed to provide context-aware responses by combining document embeddings with large
5
+ language model (LLM) capabilities. The application is modular, scalable, and maintains
6
+ a clear separation of concerns across its components.
7
+
8
+ Modules:
9
+ api: Exposes endpoints for document upload and querying the system.
10
+ config: Manages application settings and environment variables.
11
+ core: Implements embedding generation, LLM integration, and workflow orchestration.
12
+ models: Defines schemas for API request validation and response structuring.
13
+ service: Provides document management and vector database interaction services.
14
+ exception: Contains custom exceptions for handling application-specific errors.
15
+ utils: Offers utility functions for common operations and data manipulation.
16
+ logger: Implements centralized logging with customizable levels.
17
+ constants: Stores application-wide constants for consistency and maintainability.
18
+
19
+ Features:
20
+ - **Retrieval-Augmented Generation**: Combines document embeddings with LLMs to deliver accurate, context-aware answers.
21
+ - **Modular Design**: Ensures scalability, maintainability, and ease of testing.
22
+ - **Error Handling and Logging**: Enhances debugging and monitoring with structured logs and custom exceptions.
23
+ - **Seamless Integration**: Connects document management, vector database, and LLM workflows efficiently.
24
+ - **User-Friendly API**: Simplifies user interaction with the application's core functionalities.
25
+
26
+ This package serves as the backbone of the RAG application, ensuring a seamless pipeline
27
+ from document ingestion to intelligent query resolution.
28
+ """
jio_savan_music_downloader/api/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module contains API endpoints for a Retrieval-Augmented Generation (RAG) application.
4
+
5
+ Endpoints:
6
+ - POST /upload-docs: This endpoint allows users to upload and manage documents for processing.
7
+ - POST /ask: This endpoint is used for querying the system and receiving context-aware answers based on uploaded documents.
8
+
9
+ Features:
10
+ - **User-Friendly API**: Simplifies user interaction with the application's core functionalities.
11
+ - **Seamless Integration**: Connects document management, vector database, and LLM workflows efficiently.
12
+
13
+ Purpose:
14
+ - Provides the interface for users to interact with the application's core RAG functionalities.
15
+ """
jio_savan_music_downloader/api/endpoint.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import APIRouter
2
+
3
+ router = APIRouter()
4
+
5
+
6
+ @router.post("/upload-docs")
7
+ async def upload_docs() -> dict:
8
+ """
9
+ Endpoint to upload documentation. This function encapsulates
10
+ the logic to upload the documentation and returns a success
11
+ message upon completion.
12
+
13
+ Returns:
14
+ dict: A dictionary containing a success message.
15
+ """
16
+
17
+ return {"message": "Training Model Successful"}
18
+
19
+
20
+ @router.post("/ask")
21
+ async def ask() -> dict:
22
+ """
23
+ Endpoint to handle prediction requests. This function processes
24
+ incoming requests for predictions and returns a success message
25
+ upon completion.
26
+
27
+ Returns:
28
+ dict: A dictionary containing a success message.
29
+ """
30
+
31
+ return {"message": "Prediction Successful"}
jio_savan_music_downloader/config/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module manages the configuration settings for the application.
4
+
5
+ Purpose:
6
+ - Centralizes configuration management for environment variables, application settings, and dependencies.
7
+ - Ensures consistent and secure access to critical configurations.
8
+
9
+ Features:
10
+ - Loads environment variables and provides access to them.
11
+ - Validates and parses configuration settings using Pydantic models.
12
+ - Supports dynamic updates for configuration changes during runtime (if applicable).
13
+ """
jio_savan_music_downloader/config/config.py ADDED
File without changes
jio_savan_music_downloader/constants/__init__.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This package defines global constants used throughout the project. Constants
4
+ help in maintaining consistency and avoiding magic numbers or strings in the codebase.
5
+
6
+ Usage:
7
+ Import the required constants as needed:
8
+
9
+ Example:
10
+ ```python
11
+ from constants import APP_NAME, ENVIRONMENT
12
+ from constants import STATUS_OK, STATUS_BAD_REQUEST
13
+ ```
14
+
15
+ Purpose:
16
+ - Centralizes constant values for maintainability and reusability.
17
+ - Reduces hard-coded values in the project.
18
+ """
jio_savan_music_downloader/core/__init__.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module serves as the core of the application, integrating essential services for the Retrieval-Augmented Generation (RAG) workflow.
4
+
5
+ Modules:
6
+ EmbeddingService: Handles document embedding generation and retrieval for context-aware processing.
7
+ LLMService: Interfaces with large language models (LLMs) to generate answers to user queries.
8
+ Processor: Orchestrates workflows between the embedding and LLM services, ensuring seamless data flow and processing.
9
+
10
+ Purpose:
11
+ - Provides the foundational logic and services required to power the application's RAG functionalities.
12
+ """
jio_savan_music_downloader/core/embedding_service.py ADDED
File without changes
jio_savan_music_downloader/core/llm_service.py ADDED
File without changes
jio_savan_music_downloader/core/processor.py ADDED
File without changes
jio_savan_music_downloader/entity/__init__.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module defines the database entities used across the application for data storage and retrieval.
4
+
5
+ Purpose:
6
+ - Provides structured definitions for database models.
7
+ - Facilitates interaction with the database by mapping application data to database schemas.
8
+
9
+ Components:
10
+ - DB Entities: Defines entities that represent database tables or collections, including fields and relationships.
11
+
12
+ Features:
13
+ - Centralized entity definitions for consistent database operations.
14
+ - Supports validation and serialization of database records.
15
+ - Designed to integrate seamlessly with the database layer, ensuring reliable data handling.
16
+ """
jio_savan_music_downloader/exception/__init__.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module defines custom exception classes and error-handling utilities tailored
4
+ to the needs of a data science pipeline. It helps standardize error reporting, improve
5
+ debugging, and provide meaningful feedback during model training, data preprocessing,
6
+ and prediction processes.
7
+
8
+ Classes:
9
+ DataValidationError: Raised when input data fails validation checks.
10
+ ModelTrainingError: Raised during errors in the model training phase, such as convergence issues or invalid configurations.
11
+ PredictionError: Raised when the prediction pipeline encounters issues, such as missing features or incompatible input formats.
12
+ PipelineExecutionError: Raised for generic errors occurring during pipeline execution.
13
+
14
+ Usage:
15
+ Import and use the exceptions in various stages of the data science pipeline:
16
+
17
+ Example:
18
+ ```python
19
+ from exception import DataValidationError, ModelTrainingError
20
+
21
+ try:
22
+ validate_data(input_data)
23
+ except DataValidationError as e:
24
+ logger.error(f"Data validation failed: {e}")
25
+ raise
26
+ ```
27
+
28
+ Features:
29
+ - Custom exceptions for specific pipeline stages, ensuring meaningful error reporting.
30
+ - Enables targeted exception handling, reducing debugging time.
31
+ - Provides a consistent structure for error messages across the project.
32
+
33
+ Purpose:
34
+ - To define project-specific exceptions for common error scenarios in the pipeline.
35
+ - To improve the robustness and reliability of the pipeline by enabling clear error handling.
36
+ - To make the debugging process more intuitive by raising descriptive errors.
37
+
38
+ Examples:
39
+ - **Data Validation**: Raise a `DataValidationError` if the input data schema is incorrect or missing required fields.
40
+ - **Model Training**: Raise a `ModelTrainingError` if the model fails to converge due to invalid hyperparameters.
41
+ - **Prediction**: Raise a `PredictionError` when incompatible input data is passed to the model.
42
+
43
+ Additional Notes:
44
+ - Use these exceptions in conjunction with logging to provide detailed error information.
45
+ - Ensure that custom exceptions are raised with meaningful messages to assist in debugging and error resolution.
46
+ """
47
+
48
+ from fastapi import HTTPException
49
+
50
+
51
+ class CustomException(HTTPException):
52
+ """Custom exception class for handling errors in the data science pipeline."""
53
+
54
+ def __init__(self, status_code: int, detail: str):
55
+ """
56
+ Custom exception for handling API errors.
57
+
58
+ :param status_code: The HTTP status code to return.
59
+ :param detail: A string describing the error in detail.
60
+ """
61
+ super().__init__(status_code=status_code, detail=detail)
jio_savan_music_downloader/logger/__init__.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module provides centralized logging utilities for the data science pipeline.
4
+ It standardizes logging practices, ensures consistency across components, and facilitates
5
+ easy debugging and monitoring of the pipeline's execution, including data preprocessing,
6
+ model training, evaluation, and predictions.
7
+
8
+ Functions:
9
+ setup_logging: Configures the logging system, including log format, level, and output destinations.
10
+ get_logger: Returns a logger instance for a specific module or stage of the pipeline.
11
+
12
+ Features:
13
+ - Centralized logging configuration to maintain consistency.
14
+ - Support for different log levels (INFO, DEBUG, WARNING, ERROR, CRITICAL).
15
+ - Ability to write logs to files, console, or external monitoring systems.
16
+ - Timestamped log entries for accurate tracking of events.
17
+ - Integration with custom exception handling for detailed error reporting.
18
+
19
+ Usage:
20
+ Use this module to log messages in a standardized manner across the project:
21
+
22
+ Example:
23
+ ```python
24
+ from src.logging import logger
25
+
26
+ logger.info("Starting the model training process...")
27
+ logger.error("An error occurred during data validation.")
28
+ ```
29
+
30
+ Purpose:
31
+ - To provide a standardized mechanism for logging messages throughout the data science pipeline.
32
+ - To assist in debugging by capturing detailed logs of each pipeline stage.
33
+ - To enable seamless integration with monitoring and alerting systems.
34
+
35
+ Best Practices:
36
+ - Use appropriate log levels to categorize messages (e.g., DEBUG for detailed information, ERROR for issues).
37
+ - Ensure logs include sufficient context, such as function names or input details, to aid debugging.
38
+ - Regularly monitor log files for anomalies or errors in the pipeline.
39
+
40
+ Additional Notes:
41
+ - The `setup_logging` function can be configured to write logs to multiple destinations, such as files or cloud services.
42
+ - The module can be extended to integrate with third-party monitoring tools like Elasticsearch, Splunk, or Datadog.
43
+ """
44
+
45
+ import logging
46
+ import os
47
+ import sys
48
+
49
+ logging_str = "[%(asctime)s: %(levelname)s: %(module)s: %(message)s]"
50
+ log_dir = "logs"
51
+ log_filepath = os.path.join(log_dir,"jio-savan-music-downloader.log")
52
+ os.makedirs(log_dir, exist_ok=True)
53
+
54
+
55
+ logging.basicConfig(
56
+ level=logging.INFO,
57
+ format=logging_str,
58
+ handlers=[logging.FileHandler(log_filepath), logging.StreamHandler(sys.stdout)],
59
+ )
60
+
61
+ logger = logging.getLogger("jio-savan-music-downloader-logger")
jio_savan_music_downloader/main.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, responses
2
+ from fastapi.openapi.utils import get_openapi
3
+ from fastapi_health import health
4
+
5
+ from jio_savan_music_downloader.api.endpoint import router
6
+
7
+ __version__ = "0.0.1"
8
+
9
+ app = FastAPI(
10
+ title="jio-savan-music-downloader APIs",
11
+ description="This app will download Jio-Savan music.",
12
+ version=__version__,
13
+ docs_url="/docs",
14
+ redoc_url="/redoc",
15
+ )
16
+
17
+
18
+ app = FastAPI()
19
+
20
+ @app.get("/", include_in_schema=False)
21
+ async def root() -> responses.RedirectResponse:
22
+ """
23
+ Redirects the root URL to the API documentation page.
24
+
25
+ Returns:
26
+ RedirectResponse: A response object that redirects the client to the "/docs" URL.
27
+ """
28
+
29
+ return responses.RedirectResponse("/docs")
30
+
31
+
32
+ # Health Check
33
+ async def health_check() -> dict:
34
+ """
35
+ Checks the health of the API.
36
+
37
+ This endpoint checks the health of the API and returns a simple status
38
+ message. It is intended to be used by load balancers or other monitoring
39
+ systems to determine if the API is functional.
40
+
41
+ Returns:
42
+ dict: A dictionary containing the status of the API.
43
+ """
44
+ return {"status": "healthy"}
45
+
46
+
47
+ # Include routers
48
+ app.add_api_route(
49
+ "/health",
50
+ health([health_check]),
51
+ tags=["Management"],
52
+ description="Management APIs",
53
+ )
54
+ app.include_router(router, prefix="/api/v1", tags=["Operations"])
55
+
56
+
57
+ def _custom_openapi() -> dict:
58
+ if app.openapi_schema:
59
+ return app.openapi_schema
60
+ openapi_schema = get_openapi(
61
+ title="jio-savan-music-downloader APIs",
62
+ description="This app will download Jio-Savan music.",
63
+ version=__version__,
64
+ routes=app.routes,
65
+ )
66
+ app.openapi_schema = openapi_schema
67
+ return app.openapi_schema
68
+
69
+
70
+ app.openapi = _custom_openapi
71
+
72
+
73
+ def main() -> None:
74
+ """
75
+ The main entry point of the application.
76
+
77
+ This function starts the FastAPI server using Uvicorn. It serves the API
78
+ on the specified host and port. The function is intended to be run
79
+ directly when the script is executed.
80
+
81
+ Notes:
82
+ - The 'nosec B104' comment is used to suppress a security warning
83
+ related to binding to all network interfaces.
84
+ """
85
+
86
+ import uvicorn
87
+
88
+ uvicorn.run(app, host="0.0.0.0", port=80) # nosec B104
89
+
90
+
91
+ if __name__ == "__main__":
92
+ main()
jio_savan_music_downloader/models/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module defines the data models used for API request and response handling.
4
+
5
+ Components:
6
+ - Request Models: Defines the structure and validation rules for incoming API requests.
7
+ - Response Models: Specifies the format and schema for outgoing API responses.
8
+
9
+ Purpose:
10
+ - Ensures consistent data validation and serialization across the application, adhering to defined schemas.
11
+ """
jio_savan_music_downloader/models/request_models.py ADDED
File without changes
jio_savan_music_downloader/models/response_models.py ADDED
File without changes
jio_savan_music_downloader/services/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ This module provides the core services for managing documents and vector database operations.
4
+
5
+ Components:
6
+ - Document Service: Handles document-related operations such as storage, retrieval, and preprocessing.
7
+ - Vector DB Service: Manages interactions with the vector database, including storing and querying embeddings.
8
+
9
+ Purpose:
10
+ - Implements the business logic and service layer to support the application's RAG functionality.
11
+ """
jio_savan_music_downloader/services/document_service.py ADDED
File without changes
jio_savan_music_downloader/services/vector_db_service.py ADDED
File without changes
jio_savan_music_downloader/utils/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+
3
+ The `utils` module provides various utility functions for file I/O, data encoding/decoding, and directory management.
4
+
5
+ Functions:
6
+ read_yaml: Reads a YAML file and returns its contents as a dictionary.
7
+ create_directories: Creates directories if they do not exist.
8
+ save_json: Saves data to a JSON file.
9
+ load_json: Loads JSON data from a file.
10
+ save_bin: Saves binary data to a file.
11
+ load_bin: Loads binary data from a file.
12
+ get_size: Returns the size of a file or directory in bytes.
13
+ decode_image: Decodes an image from a base64 string.
14
+ encode_image_into_base64: Encodes an image into a base64 string.
15
+ """
mkdocs.yml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ site_name: jio-savan-music-downloader
2
+ repo_url: https://github.com/DeepakPant93/jio-savan-music-downloader
3
+ site_url: https://DeepakPant93.github.io/jio-savan-music-downloader
4
+ site_description: This app will download Jio-Savan music.
5
+ site_author: Deepak pant
6
+ edit_uri: edit/main/docs/
7
+ repo_name: DeepakPant93/jio-savan-music-downloader
8
+ copyright: Maintained by <a href="https://github.com/DeepakPant93/">Deepak pant</a>.
9
+
10
+ nav:
11
+ - Home: index.md
12
+ - Modules: modules.md
13
+
14
+ plugins:
15
+ - search
16
+ - tags
17
+ - mkdocstrings:
18
+ handlers:
19
+ python:
20
+ setup_commands:
21
+ show_source: false
22
+ show_root_heading: true
23
+ show_root_full_path: false
24
+ heading_level: 3
25
+ enable_inventory: true
26
+ # - import sys
27
+ # - sys.path.append('../')
28
+ # - git-revision-date-localized: # Shows last updated date
29
+ # enable_creation_date: true
30
+ - minify: # Minifies HTML and JS
31
+ minify_html: true
32
+ minify_js: true
33
+
34
+ theme:
35
+ name: material
36
+ logo: assets/logo.png # Optional custom logo
37
+ favicon: assets/favicon.ico # Optional favicon
38
+ features:
39
+ - navigation.tabs # Top-level sections as tabs
40
+ - navigation.sections # Sections are expanded
41
+ - navigation.top # Back to top button
42
+ - search.suggest # Search suggestions
43
+ - search.highlight # Highlight search results
44
+ - content.tabs.link # Link code tabs
45
+ - content.code.annotate # Code block annotations
46
+ - content.copy.code # Copy code button
47
+ palette:
48
+ - media: "(prefers-color-scheme: light)"
49
+ scheme: default
50
+ primary: indigo
51
+ accent: deep orange
52
+ toggle:
53
+ icon: material/brightness-7
54
+ name: Switch to dark mode
55
+ - media: "(prefers-color-scheme: dark)"
56
+ scheme: slate
57
+ primary: black
58
+ accent: deep orange
59
+ toggle:
60
+ icon: material/brightness-4
61
+ name: Switch to light mode
62
+ icon:
63
+ repo: fontawesome/brands/github
64
+
65
+ extra:
66
+ social:
67
+ - icon: fontawesome/brands/github
68
+ link: https://github.com/DeepakPant93/jio-savan-music-downloader
69
+ - icon: fontawesome/brands/python
70
+ link: https://pypi.org/project/jio-savan-music-downloader
71
+ # analytics: # Optional Google Analytics
72
+ # provider: google
73
+ # property: G-XXXXXXXXXX # Replace with your tracking ID
74
+
75
+ markdown_extensions:
76
+ - toc:
77
+ permalink: true
78
+ - pymdownx.arithmatex:
79
+ generic: true
80
+ - pymdownx.highlight: # Advanced code highlighting
81
+ anchor_linenums: true
82
+ line_spans: __span
83
+ pygments_lang_class: true
84
+ - pymdownx.inlinehilite
85
+ - pymdownx.snippets
86
+ - pymdownx.superfences
87
+ - pymdownx.tabbed
88
+ - attr_list
89
+ - md_in_html
notebooks/trails.ipynb ADDED
File without changes
poetry.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [virtualenvs]
2
+ in-project = true
pyproject.toml ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "jio_savan_music_downloader"
3
+ version = "0.0.1"
4
+ description = "This app will download Jio-Savan music."
5
+ authors = ["Deepak pant <[email protected]>"]
6
+ repository = "https://github.com/DeepakPant93/jio-savan-music-downloader"
7
+ documentation = "https://DeepakPant93.github.io/jio-savan-music-downloader/"
8
+ readme = "README.md"
9
+ packages = [
10
+ {include = "jio_savan_music_downloader"}
11
+ ]
12
+
13
+ [tool.poetry.scripts]
14
+ jio_savan_music_downloader = "jio_savan_music_downloader.main:main"
15
+
16
+ [tool.poetry.dependencies]
17
+ python = ">=3.11,<4.0"
18
+ fastapi = "~0.100.0" # Latest compatible version
19
+ uvicorn = "^0.23.0" # For running FastAPI apps
20
+ fastapi-health = "^0.4.0" # Health check for FastAPI
21
+ #pyyaml = "^6.0.2"
22
+ #python-box = "^7.2.0"
23
+ #ensure = "^1.0.4"
24
+ #joblib = "^1.3.2" # Parallel processing and caching
25
+ #python-dotenv = "^1.0.0" # Manage environment variables
26
+ #PyPDF2 = "^3.0.0" # For PDF manipulation
27
+ #pydantic = "^2.0.0" # Data validation and settings management
28
+
29
+
30
+
31
+ [tool.poetry.group.dev.dependencies]
32
+ deptry = "^0.16.2" # For dependency management
33
+ mypy = "^1.5.1" # Static type checking
34
+ pre-commit = "^3.4.0" # Pre-commit hooks
35
+ tox = "^4.11.1" # Testing in multiple environments
36
+ ipykernel = "^6.25.0" # Jupyter kernel
37
+ black = "^23.9.0" # Code formatter
38
+ build = "^1.0.0" # Build management
39
+ bump-my-version = "^0.28.2" # Bump versions automatically
40
+ codespell = "^2.2.5" # Spell checking in code
41
+ wheel = "^0.41.0" # Build wheels
42
+ twine = "^4.0.0" # Publish packages
43
+ bandit = "^1.8.0" # Security check
44
+ pylint = "^3.0.0" # Powerful linter
45
+ pydocstyle = "^6.3.0" # Enforce PEP 257 docstring conventions
46
+ isort = "^5.12.0" # Sort imports
47
+
48
+ [tool.poetry.group.docs.dependencies]
49
+ mkdocs = "^1.5.0" # Documentation site generator
50
+ sphinx = "^7.2.0" # Documentation tool
51
+ mkdocs-git-revision-date-plugin = "^0.3.2" # Show revision dates
52
+ mkdocs-git-revision-date-localized-plugin = "^1.3.0" # Localized dates
53
+ mkdocs-jupyter = ">=0.25.1" # For Jupyter Notebook integration
54
+ mkdocs-pdf-export-plugin = "^0.5.10" # PDF export
55
+ mkdocs-material = ">=9.1.3" # MkDocs Material theme
56
+ mkdocstrings-crystal = "^0.3.0" # Mkdocstrings for Crystal
57
+ pygments = "^2.16.0" # Syntax highlighting
58
+ pymdown-extensions = "^10.0" # Markdown extensions
59
+ nbconvert = "^7.7.0" # Convert notebooks to other formats
60
+ nbformat = "^5.9.0" # Notebook format support
61
+ livereload = "^2.6.3" # Live reload for MkDocs
62
+ watchdog = "^3.0.0" # File monitoring
63
+ mkdocstrings = {extras = ["python"], version = "^0.27.0"} # Auto-generate documentation from docstrings
64
+ mkdocs-minify-plugin = "^0.8.0" # Minify HTML
65
+
66
+ [tool.poetry.group.test.dependencies]
67
+ pytest-mock = "^3.11.0" # Mocking in tests
68
+ factory-boy = "^3.3.1" # Test data generation
69
+ pytest-asyncio = "^0.21.0" # Async testing support
70
+ pytest-xdist = "^3.3.1" # Parallel test execution
71
+ freezegun = "^1.2.0" # Mock datetime
72
+ pytest = "^7.2.0" # Testing framework
73
+ allure-pytest = "^2.13.0" # Reporting for pytest
74
+ pytest-sugar = "^0.9.7" # Better test output
75
+ pytest-cov = "^4.0.0" # Test coverage reports
76
+ httpx = "^0.24.0"
77
+ pytest-runner = "^6.0.0" # Running tests via `python setup.py test`
78
+
79
+
80
+ [build-system]
81
+ requires = ["poetry-core>=1.0.0"]
82
+ build-backend = "poetry.core.masonry.api"
83
+
84
+
85
+ [tool.mypy]
86
+ files = ["jio_savan_music_downloader"]
87
+ disallow_untyped_defs = true
88
+ disallow_any_unimported = true
89
+ no_implicit_optional = true
90
+ check_untyped_defs = true
91
+ warn_return_any = true
92
+ warn_unused_ignores = true
93
+ show_error_codes = true
94
+ pretty = true
95
+ show_traceback = true
96
+
97
+
98
+ [[tool.mypy.overrides]]
99
+ module = [
100
+ "joblib.*",
101
+ "yaml.*",
102
+ "ensure.*",
103
+ "fastapi_health.*",
104
+ "jio_savan_music_downloader.main"
105
+ ]
106
+ ignore_missing_imports = true
107
+ ignore_errors = true
108
+
109
+
110
+ [tool.pytest.ini_options]
111
+ testpaths = ["tests"]
112
+ norecursedirs = "legacy_tests"
113
+ python_files = ["test_*.py"]
114
+ python_classes = ["Test*"]
115
+ python_functions = ["test_*"]
116
+ filterwarnings = [
117
+ "ignore:.*general_plain_validator_function.*:DeprecationWarning",
118
+ "ignore:.*with_info_plain_validator_function.*:DeprecationWarning"
119
+ ]
120
+
121
+
122
+ [tool.ruff]
123
+ target-version = "py39"
124
+ line-length = 120
125
+ fix = true
126
+ select = [
127
+ # flake8-2020
128
+ "YTT",
129
+ # flake8-bandit
130
+ "S",
131
+ # flake8-bugbear
132
+ "B",
133
+ # flake8-builtins
134
+ "A",
135
+ # flake8-comprehensions
136
+ "C4",
137
+ # flake8-debugger
138
+ "T10",
139
+ # flake8-simplify
140
+ "SIM",
141
+ # isort
142
+ "I",
143
+ # mccabe
144
+ "C90",
145
+ # pycodestyle
146
+ "E", "W",
147
+ # pyflakes
148
+ "F",
149
+ # pygrep-hooks
150
+ "PGH",
151
+ # pyupgrade
152
+ "UP",
153
+ # ruff
154
+ "RUF",
155
+ # tryceratops
156
+ "TRY",
157
+ ]
158
+ ignore = [
159
+ # LineTooLong
160
+ "E501",
161
+ # DoNotAssignLambda
162
+ "E731",
163
+ # Possible binding to all interfaces - Require for Docker container
164
+ "S104"
165
+ ]
166
+
167
+ [tool.ruff.format]
168
+ preview = true
169
+
170
+ [tool.coverage.report]
171
+ skip_empty = true
172
+
173
+
174
+ [tool.coverage.run]
175
+ branch = true
176
+ source = ["jio_savan_music_downloader"]
177
+ # parallel = true
178
+ # concurrency = ["thread"]
179
+ omit = [
180
+ "**/__init__.py", # Exclude all init files
181
+ "jio_savan_music_downloader/main.py", # Exclude main.py file
182
+ "jio_savan_music_downloader/constants/*", # Exclude all files in a constants folder
183
+ "jio_savan_music_downloader/exception/*", # Exclude all files in a exception folder
184
+ "jio_savan_music_downloader/logger/*", # Exclude all files in a logger folder
185
+ "jio_savan_music_downloader/entity/*", # Exclude all files in entity folder
186
+ "jio_savan_music_downloader/config/*", # Exclude all files in config folder
187
+ "jio_savan_music_downloader/models/*", # Exclude all files in model folder
188
+ ]
189
+
190
+ [tool.ruff.per-file-ignores]
191
+ "tests/*" = ["S101"]
192
+
193
+ [tool.bumpversion]
194
+ current_version = "0.0.1"
195
+ commit = true
196
+ tag = true
197
+
198
+ [[tool.bumpversion.files]]
199
+ glob = "pyproject.toml"
200
+ search = 'version = "{current_version}"'
201
+ replace = 'version = "{new_version}"'
202
+
203
+ [[tool.bumpversion.files]]
204
+ glob = "jio_savan_music_downloader/main.py"
205
+ search = '__version__ = "{current_version}"'
206
+ replace = '__version__ = "{new_version}"'
207
+
208
+ [tool.deptry]
209
+ exclude = ["research","artifacts", "notebooks", "tests", "docs", ".venv", "venv", "__pycache__", ".ruff_cache", ".pytest_cache", ".mypy_cache", ".coverage", ".git", "build", "dist", ".github", "site", "config"]
210
+
211
+ [tool.pydocstyle]
212
+ select = ["D101", "D102"]