dcc-backend-common 0.0.1__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 (33) hide show
  1. dcc_backend_common-0.0.1/.env.example +0 -0
  2. dcc_backend_common-0.0.1/.github/workflows/llm-doc-update-trigger.yml +17 -0
  3. dcc_backend_common-0.0.1/.github/workflows/publish.yml +45 -0
  4. dcc_backend_common-0.0.1/.gitignore +137 -0
  5. dcc_backend_common-0.0.1/.pre-commit-config.yaml +25 -0
  6. dcc_backend_common-0.0.1/.python-version +1 -0
  7. dcc_backend_common-0.0.1/.vscode/extension.json +11 -0
  8. dcc_backend_common-0.0.1/.vscode/launch.json +19 -0
  9. dcc_backend_common-0.0.1/.vscode/settings.json +19 -0
  10. dcc_backend_common-0.0.1/CONTRIBUTING.md +126 -0
  11. dcc_backend_common-0.0.1/LICENSE +21 -0
  12. dcc_backend_common-0.0.1/Makefile +36 -0
  13. dcc_backend_common-0.0.1/PKG-INFO +270 -0
  14. dcc_backend_common-0.0.1/README.md +239 -0
  15. dcc_backend_common-0.0.1/pyproject.toml +119 -0
  16. dcc_backend_common-0.0.1/pyrefly.toml +13 -0
  17. dcc_backend_common-0.0.1/renovate.json +105 -0
  18. dcc_backend_common-0.0.1/src/dcc_backend_common/__init__.py +0 -0
  19. dcc_backend_common-0.0.1/src/dcc_backend_common/config/__init__.py +3 -0
  20. dcc_backend_common-0.0.1/src/dcc_backend_common/config/app_config.py +78 -0
  21. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_error_handling/__init__.py +12 -0
  22. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_error_handling/error_codes.py +12 -0
  23. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_error_handling/error_exception.py +62 -0
  24. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_error_handling/error_handler.py +42 -0
  25. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_health_probes/__init__.py +3 -0
  26. dcc_backend_common-0.0.1/src/dcc_backend_common/fastapi_health_probes/router.py +98 -0
  27. dcc_backend_common-0.0.1/src/dcc_backend_common/logger/__init__.py +3 -0
  28. dcc_backend_common-0.0.1/src/dcc_backend_common/logger/logger.py +127 -0
  29. dcc_backend_common-0.0.1/src/dcc_backend_common/py.typed +0 -0
  30. dcc_backend_common-0.0.1/tests/conftest.py +8 -0
  31. dcc_backend_common-0.0.1/tests/unit/test_app_config.py +55 -0
  32. dcc_backend_common-0.0.1/tox.ini +18 -0
  33. dcc_backend_common-0.0.1/uv.lock +2796 -0
File without changes
@@ -0,0 +1,17 @@
1
+ name: LLM Doc Update Trigger
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+
7
+ jobs:
8
+ llm-doc-update:
9
+ uses: DCC-BS/ci-workflows/.github/workflows/llm-doc-update-conditional.yml@v7
10
+ with:
11
+ doc_repo: "DCC-BS/documentation"
12
+ doc_path: "markdown/backend-common"
13
+ openai_model: "GLM-4.7"
14
+ openai_base_url: "https://api.z.ai/api/coding/paas/v4"
15
+ secrets:
16
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
17
+ GH_TOKEN: ${{ secrets.GH_TOKEN_CUSTOM }}
@@ -0,0 +1,45 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ id-token: write # Required for Trusted Publishing
8
+ contents: write # Required for creating the git tag
9
+
10
+ jobs:
11
+ publish:
12
+ name: Build and publish
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Set up Python
25
+ run: uv python install 3.12
26
+
27
+ - name: Tag and push
28
+ run: |
29
+ VERSION=$(uv version --short)
30
+ TAG="v$VERSION"
31
+ git config --global user.name "github-actions[bot]"
32
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
33
+
34
+ if git rev-parse "$TAG" >/dev/null 2>&1 || git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then
35
+ echo "Tag $TAG already exists."
36
+ else
37
+ git tag "$TAG"
38
+ git push origin "$TAG"
39
+ fi
40
+
41
+ - name: Build package
42
+ run: uv build
43
+
44
+ - name: Publish package
45
+ run: uv publish
@@ -0,0 +1,137 @@
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
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
90
+ __pypackages__/
91
+
92
+ # Celery stuff
93
+ celerybeat-schedule
94
+ celerybeat.pid
95
+
96
+ # SageMath parsed files
97
+ *.sage.py
98
+
99
+ # Environments
100
+ .env
101
+ .venv
102
+ env/
103
+ venv/
104
+ ENV/
105
+ env.bak/
106
+ venv.bak/
107
+
108
+ # Spyder project settings
109
+ .spyderproject
110
+ .spyproject
111
+
112
+ # Rope project settings
113
+ .ropeproject
114
+
115
+ # mkdocs documentation
116
+ /site
117
+
118
+ # mypy
119
+ .mypy_cache/
120
+ .dmypy.json
121
+ dmypy.json
122
+
123
+ # Pyre type checker
124
+ .pyre/
125
+
126
+ # pytype static type analyzer
127
+ .pytype/
128
+
129
+ # Cython debug symbols
130
+ cython_debug/
131
+
132
+ # PyCharm
133
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
134
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
135
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
136
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
137
+ #.idea/
@@ -0,0 +1,25 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: "v5.0.0"
4
+ hooks:
5
+ - id: check-case-conflict
6
+ - id: check-merge-conflict
7
+ - id: check-toml
8
+ - id: check-yaml
9
+ - id: check-json
10
+ exclude: ^.devcontainer/devcontainer.json|.vscode/.*
11
+ - id: pretty-format-json
12
+ exclude: ^.devcontainer/devcontainer.json|.vscode/.*
13
+ args: [--autofix]
14
+ - id: end-of-file-fixer
15
+ - id: trailing-whitespace
16
+ - id: detect-private-key
17
+
18
+ - repo: https://github.com/astral-sh/ruff-pre-commit
19
+ rev: "v0.9.9"
20
+ hooks:
21
+ - id: ruff
22
+ types_or: [python, pyi]
23
+ args: [--fix, --exit-zero]
24
+ - id: ruff-format
25
+ types_or: [python, pyi]
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,11 @@
1
+ {
2
+ "recommendations": [
3
+ "ms-python.isort",
4
+ "ms-azuretools.vscode-docker",
5
+ "ms-vscode.makefile-tools",
6
+ "meta.pyrefly",
7
+ "ms-python.python",
8
+ "ms-python.debugpy",
9
+ "charliermarsh.ruff",
10
+ "SonarSource.sonarlint-vscode"
11
+ }
@@ -0,0 +1,19 @@
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: FastAPI",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "module": "fastapi",
12
+ "args": [
13
+ "dev",
14
+ "./src/dcc_backend_common/app.py"
15
+ ],
16
+ "jinja": true
17
+ },
18
+ ]
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "files.exclude": {
3
+ "**/.DS_Store": true,
4
+ "**/.git": true,
5
+ "**/.hg": true,
6
+ "**/.mypy_cache": true,
7
+ "**/.pytest_cache": true,
8
+ "**/.svn": true,
9
+ "**/.venv": true,
10
+ "**/CVS": true,
11
+ "**/Thumbs.db": true,
12
+ "**/__pycache__": true
13
+ },
14
+ "python.testing.pytestArgs": [
15
+ "tests"
16
+ ],
17
+ "python.testing.pytestEnabled": true,
18
+ "python.testing.unittestEnabled": false
19
+ }
@@ -0,0 +1,126 @@
1
+ # Contributing to `backend-common`
2
+
3
+ Contributions are welcome, and they are greatly appreciated!
4
+ Every little bit helps, and credit will always be given.
5
+
6
+ You can contribute in many ways:
7
+
8
+ # Types of Contributions
9
+
10
+ ## Report Bugs
11
+
12
+ Report bugs at https://github.com/DCC-BS/backend-common/issues
13
+
14
+ If you are reporting a bug, please include:
15
+
16
+ - Your operating system name and version.
17
+ - Any details about your local setup that might be helpful in troubleshooting.
18
+ - Detailed steps to reproduce the bug.
19
+
20
+ ## Fix Bugs
21
+
22
+ Look through the GitHub issues for bugs.
23
+ Anything tagged with "bug" and "help wanted" is open to whoever wants to implement a fix for it.
24
+
25
+ ## Implement Features
26
+
27
+ Look through the GitHub issues for features.
28
+ Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.
29
+
30
+ ## Write Documentation
31
+
32
+ backend-common could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such.
33
+
34
+ ## Submit Feedback
35
+
36
+ The best way to send feedback is to file an issue at https://github.com/DCC-BS/backend-common/issues.
37
+
38
+ If you are proposing a new feature:
39
+
40
+ - Explain in detail how it would work.
41
+ - Keep the scope as narrow as possible, to make it easier to implement.
42
+ - Remember that this is a volunteer-driven project, and that contributions
43
+ are welcome :)
44
+
45
+ # Get Started!
46
+
47
+ Ready to contribute? Here's how to set up `backend-common` for local development.
48
+ Please note this documentation assumes you already have `uv` and `Git` installed and ready to go.
49
+
50
+ 1. Fork the `backend-common` repo on GitHub.
51
+
52
+ 2. Clone your fork locally:
53
+
54
+ ```bash
55
+ cd <directory_in_which_repo_should_be_created>
56
+ git clone git@github.com:YOUR_NAME/backend-common.git
57
+ ```
58
+
59
+ 3. Now we need to install the environment. Navigate into the directory
60
+
61
+ ```bash
62
+ cd backend-common
63
+ ```
64
+
65
+ Then, install and activate the environment with:
66
+
67
+ ```bash
68
+ uv sync
69
+ ```
70
+
71
+ 4. Install pre-commit to run linters/formatters at commit time:
72
+
73
+ ```bash
74
+ uv run pre-commit install
75
+ ```
76
+
77
+ 5. Create a branch for local development:
78
+
79
+ ```bash
80
+ git checkout -b name-of-your-bugfix-or-feature
81
+ ```
82
+
83
+ Now you can make your changes locally.
84
+
85
+ 6. Don't forget to add test cases for your added functionality to the `tests` directory.
86
+
87
+ 7. When you're done making changes, check that your changes pass the formatting tests.
88
+
89
+ ```bash
90
+ make check
91
+ ```
92
+
93
+ Now, validate that all unit tests are passing:
94
+
95
+ ```bash
96
+ make test
97
+ ```
98
+
99
+ 9. Before raising a pull request you should also run tox.
100
+ This will run the tests across different versions of Python:
101
+
102
+ ```bash
103
+ tox
104
+ ```
105
+
106
+ This requires you to have multiple versions of python installed.
107
+ This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally.
108
+
109
+ 10. Commit your changes and push your branch to GitHub:
110
+
111
+ ```bash
112
+ git add .
113
+ git commit -m "Your detailed description of your changes."
114
+ git push origin name-of-your-bugfix-or-feature
115
+ ```
116
+
117
+ 11. Submit a pull request through the GitHub website.
118
+
119
+ # Pull Request Guidelines
120
+
121
+ Before you submit a pull request, check that it meets these guidelines:
122
+
123
+ 1. The pull request should include tests.
124
+
125
+ 2. If the pull request adds functionality, the docs should be updated.
126
+ Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Data Competence Center Basel-Stadt
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.
@@ -0,0 +1,36 @@
1
+ .PHONY: install
2
+ install: ## Install the virtual environment and install the pre-commit hooks
3
+ @echo "🚀 Creating virtual environment using uv"
4
+ @uv sync --extra fastapi
5
+ @uv run pre-commit install
6
+
7
+ .PHONY: check
8
+ check: ## Run code quality tools.
9
+ @echo "🚀 Checking lock file consistency with 'pyproject.toml'"
10
+ @uv lock --locked
11
+ @echo "🚀 Linting code: Running pre-commit"
12
+ @uv run pre-commit run -a
13
+ @echo "🚀 Static type checking: Running pyrefly"
14
+ @uv run pyrefly check ./src/dcc_backend_common
15
+
16
+ .PHONY: test
17
+ test: ## Test the code with pytest
18
+ @echo "🚀 Testing code: Running pytest"
19
+ @uv run python -m pytest --doctest-modules
20
+
21
+ .PHONY: build
22
+ build: clean-build ## Build wheel file
23
+ @echo "🚀 Creating wheel file"
24
+ @uvx --from build pyproject-build --installer uv
25
+
26
+ .PHONY: clean-build
27
+ clean-build: ## Clean build artifacts
28
+ @echo "🚀 Removing build artifacts"
29
+ @uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None"
30
+
31
+ .PHONY: help
32
+ help:
33
+ @uv run python -c "import re; \
34
+ [[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]"
35
+
36
+ .DEFAULT_GOAL := help