codex-core 0.1.0__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.
- codex_core-0.1.0/.github/workflows/ci.yml +56 -0
- codex_core-0.1.0/.github/workflows/docs.yml +46 -0
- codex_core-0.1.0/.github/workflows/publish.yml +48 -0
- codex_core-0.1.0/.gitignore +200 -0
- codex_core-0.1.0/.pre-commit-config.yaml +38 -0
- codex_core-0.1.0/CHANGELOG.md +38 -0
- codex_core-0.1.0/PKG-INFO +69 -0
- codex_core-0.1.0/README.md +30 -0
- codex_core-0.1.0/docs/api/common.md +21 -0
- codex_core-0.1.0/docs/api/core.md +15 -0
- codex_core-0.1.0/docs/api/index.md +15 -0
- codex_core-0.1.0/docs/api/settings.md +10 -0
- codex_core-0.1.0/docs/changelog.md +1 -0
- codex_core-0.1.0/docs/en_EN/README.md +23 -0
- codex_core-0.1.0/docs/en_EN/architecture/README.md +25 -0
- codex_core-0.1.0/docs/en_EN/architecture/platform/common.md +40 -0
- codex_core-0.1.0/docs/en_EN/architecture/platform/core.md +34 -0
- codex_core-0.1.0/docs/en_EN/architecture/platform/settings.md +41 -0
- codex_core-0.1.0/docs/en_EN/guide/getting_started.md +54 -0
- codex_core-0.1.0/docs/evolution/roadmap.md +17 -0
- codex_core-0.1.0/docs/index.md +15 -0
- codex_core-0.1.0/docs/ru_RU/README.md +23 -0
- codex_core-0.1.0/docs/ru_RU/architecture/README.md +25 -0
- codex_core-0.1.0/docs/ru_RU/architecture/platform/common.md +40 -0
- codex_core-0.1.0/docs/ru_RU/architecture/platform/core.md +34 -0
- codex_core-0.1.0/docs/ru_RU/architecture/platform/settings.md +41 -0
- codex_core-0.1.0/docs/ru_RU/guide/getting_started.md +54 -0
- codex_core-0.1.0/mkdocs.yml +73 -0
- codex_core-0.1.0/pyproject.toml +91 -0
- codex_core-0.1.0/src/codex_core/__init__.py +1 -0
- codex_core-0.1.0/src/codex_core/common/__init__.py +24 -0
- codex_core-0.1.0/src/codex_core/common/log_context.py +55 -0
- codex_core-0.1.0/src/codex_core/common/loguru_setup.py +192 -0
- codex_core-0.1.0/src/codex_core/common/phone.py +40 -0
- codex_core-0.1.0/src/codex_core/common/text.py +139 -0
- codex_core-0.1.0/src/codex_core/core/__init__.py +7 -0
- codex_core-0.1.0/src/codex_core/core/base_dto.py +33 -0
- codex_core-0.1.0/src/codex_core/core/exceptions.py +7 -0
- codex_core-0.1.0/src/codex_core/core/pii.py +44 -0
- codex_core-0.1.0/src/codex_core/settings/__init__.py +5 -0
- codex_core-0.1.0/src/codex_core/settings/base.py +82 -0
- codex_core-0.1.0/tests/conftest.py +1 -0
- codex_core-0.1.0/tests/integration/__init__.py +1 -0
- codex_core-0.1.0/tests/integration/test_settings_integration.py +34 -0
- codex_core-0.1.0/tests/unit/__init__.py +0 -0
- codex_core-0.1.0/tests/unit/common/__init__.py +1 -0
- codex_core-0.1.0/tests/unit/common/test_phone.py +27 -0
- codex_core-0.1.0/tests/unit/common/test_text.py +46 -0
- codex_core-0.1.0/tests/unit/core/__init__.py +1 -0
- codex_core-0.1.0/tests/unit/core/test_pii.py +60 -0
- codex_core-0.1.0/tests/unit/settings/__init__.py +1 -0
- codex_core-0.1.0/tests/unit/settings/test_settings.py +27 -0
- codex_core-0.1.0/tools/__init__.py +0 -0
- codex_core-0.1.0/tools/dev/README.md +23 -0
- codex_core-0.1.0/tools/dev/__init__.py +0 -0
- codex_core-0.1.0/tools/dev/check.py +197 -0
- codex_core-0.1.0/tools/dev/generate_project_tree.py +119 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI Pipeline
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
paths-ignore: [ '**.md', 'docs/**', '.gitignore' ]
|
|
7
|
+
pull_request:
|
|
8
|
+
branches: [ main ]
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
quality-gate:
|
|
15
|
+
name: Quality Gate
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
cache: 'pip'
|
|
23
|
+
|
|
24
|
+
- name: Install Dev Dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Pre-commit (Ruff, Format, Bandit, Secrets)
|
|
30
|
+
uses: pre-commit/action@v3.0.1
|
|
31
|
+
|
|
32
|
+
- name: Run pip-audit
|
|
33
|
+
run: pip install pip-audit && pip-audit
|
|
34
|
+
|
|
35
|
+
- name: Run Mypy
|
|
36
|
+
run: pip install mypy && mypy src/codex_core/
|
|
37
|
+
|
|
38
|
+
unit-tests:
|
|
39
|
+
name: Unit Tests
|
|
40
|
+
needs: quality-gate
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- uses: actions/checkout@v4
|
|
44
|
+
- name: Set up Python 3.12
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: "3.12"
|
|
48
|
+
cache: 'pip'
|
|
49
|
+
|
|
50
|
+
- name: Install All Dependencies
|
|
51
|
+
run: |
|
|
52
|
+
python -m pip install --upgrade pip
|
|
53
|
+
pip install -e ".[dev]"
|
|
54
|
+
|
|
55
|
+
- name: Run Unit Tests
|
|
56
|
+
run: pytest tests/ -m "unit" -v --tb=short
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Deploy Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- 'mkdocs.yml'
|
|
10
|
+
- 'src/**'
|
|
11
|
+
- 'pyproject.toml'
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
deploy:
|
|
21
|
+
name: Build & Deploy
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout code
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- name: Configure Git Credentials
|
|
30
|
+
run: |
|
|
31
|
+
git config user.name github-actions[bot]
|
|
32
|
+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
33
|
+
|
|
34
|
+
- name: Set up Python 3.12
|
|
35
|
+
uses: actions/setup-python@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
cache: 'pip'
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: |
|
|
42
|
+
python -m pip install --upgrade pip
|
|
43
|
+
pip install -e ".[docs]"
|
|
44
|
+
|
|
45
|
+
- name: Build and Deploy Docs
|
|
46
|
+
run: mkdocs gh-deploy --force
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-n-publish:
|
|
13
|
+
name: Build and publish to PyPI
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
url: https://pypi.org/project/codex-core/
|
|
18
|
+
permissions:
|
|
19
|
+
id-token: write
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Checkout code
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
cache: 'pip'
|
|
33
|
+
|
|
34
|
+
- name: Install build tools
|
|
35
|
+
run: |
|
|
36
|
+
python -m pip install --upgrade pip
|
|
37
|
+
python -m pip install build twine hatchling
|
|
38
|
+
|
|
39
|
+
- name: Build sdist and wheel
|
|
40
|
+
run: python -m build
|
|
41
|
+
|
|
42
|
+
- name: Check artifacts
|
|
43
|
+
run: twine check dist/*
|
|
44
|
+
|
|
45
|
+
- name: Publish to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
47
|
+
with:
|
|
48
|
+
print-hash: true
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm / JetBrains
|
|
172
|
+
.idea/
|
|
173
|
+
*.iws
|
|
174
|
+
out/
|
|
175
|
+
gen/
|
|
176
|
+
|
|
177
|
+
# Visual Studio Code
|
|
178
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
179
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
180
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
181
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
182
|
+
# .vscode/
|
|
183
|
+
|
|
184
|
+
# Ruff stuff:
|
|
185
|
+
.ruff_cache/
|
|
186
|
+
|
|
187
|
+
# PyPI configuration file
|
|
188
|
+
.pypirc
|
|
189
|
+
|
|
190
|
+
# Cursor
|
|
191
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
192
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
193
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
194
|
+
.cursorignore
|
|
195
|
+
.cursorindexingignore
|
|
196
|
+
|
|
197
|
+
# Marimo
|
|
198
|
+
marimo/_static/
|
|
199
|
+
marimo/_lsp/
|
|
200
|
+
__marimo__/
|
|
@@ -0,0 +1,38 @@
|
|
|
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-json
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
args: ['--maxkb=2000']
|
|
11
|
+
- id: check-merge-conflict
|
|
12
|
+
|
|
13
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
+
rev: v0.9.6
|
|
15
|
+
hooks:
|
|
16
|
+
- id: ruff
|
|
17
|
+
args: [--fix]
|
|
18
|
+
- id: ruff-format
|
|
19
|
+
|
|
20
|
+
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
21
|
+
rev: v0.44.0
|
|
22
|
+
hooks:
|
|
23
|
+
- id: markdownlint
|
|
24
|
+
args: ["--fix", "--disable", "MD013"]
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/PyCQA/bandit
|
|
27
|
+
rev: 1.8.2
|
|
28
|
+
hooks:
|
|
29
|
+
- id: bandit
|
|
30
|
+
args: ["-c", "pyproject.toml"]
|
|
31
|
+
additional_dependencies: ["bandit[toml]"]
|
|
32
|
+
|
|
33
|
+
# 2. Поиск "забытых" секретов и паролей (усиленный)
|
|
34
|
+
- repo: https://github.com/Yelp/detect-secrets
|
|
35
|
+
rev: v1.5.0
|
|
36
|
+
hooks:
|
|
37
|
+
- id: detect-secrets
|
|
38
|
+
# Baseline will be added after manual creation
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2024-05-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Project Structure**: Initial setup of the core library as a standalone project.
|
|
12
|
+
- **Advanced PII Protection**:
|
|
13
|
+
- Implementation of `BaseDTO` with automated, recursive PII masking in `repr` and `str`.
|
|
14
|
+
- Keyword-based sensitive data detection (phone, email, name, address, notes).
|
|
15
|
+
- **International Utilities**:
|
|
16
|
+
- `normalize_phone`: Robust normalization supporting `+`, `00`, and local German `0` formats.
|
|
17
|
+
- `normalize_name`: Smart capitalization preserving hyphens and spaces.
|
|
18
|
+
- `TaskLogContext`: Structured logging adapter for background tasks and operations.
|
|
19
|
+
- **Base Settings**: `BaseCommonSettings` with standardized Redis URL generation and environment-aware flags.
|
|
20
|
+
- **Documentation**:
|
|
21
|
+
- New Domain-Driven documentation standard (Architecture + API Reference).
|
|
22
|
+
- Bilingual support (EN/RU) with structural mirroring.
|
|
23
|
+
- **Testing**:
|
|
24
|
+
- Comprehensive unit test suite (27 scenarios) covering Core, Common, and Settings.
|
|
25
|
+
- Integration test for environment variable loading.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **Package Rename**: Renamed package from `codex_tools` to `codex_core` for better clarity.
|
|
29
|
+
- **Dependency Optimization**:
|
|
30
|
+
- `loguru` removed from mandatory dependencies.
|
|
31
|
+
- `loguru_setup` updated with safe imports and clear installation instructions.
|
|
32
|
+
- **CI/CD**:
|
|
33
|
+
- Switched GitHub Actions to use Node.js 24 (via `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24`).
|
|
34
|
+
- Updated Mypy paths to reflect the new package structure.
|
|
35
|
+
|
|
36
|
+
### Security
|
|
37
|
+
- Integrated `bandit`, `pip-audit`, and `detect-secrets` into the development lifecycle.
|
|
38
|
+
- Standardized `quote_plus` usage for all infrastructure connection strings.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codex-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Core utilities, schemas and settings for Codex WaaS toolkit
|
|
5
|
+
Project-URL: Homepage, https://github.com/codexdlc/codex-core
|
|
6
|
+
Project-URL: Documentation, https://codexdlc.github.io/codex-core/
|
|
7
|
+
Project-URL: Repository, https://github.com/codexdlc/codex-core
|
|
8
|
+
Project-URL: Changelog, https://github.com/codexdlc/codex-core/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/codexdlc/codex-core/issues
|
|
10
|
+
Author: CodexDLC
|
|
11
|
+
License: Apache-2.0
|
|
12
|
+
Keywords: core,pydantic,toolkit,waas
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: pydantic-settings>=2.0
|
|
22
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: bandit>=1.7; extra == 'dev'
|
|
25
|
+
Requires-Dist: detect-secrets>=1.5; extra == 'dev'
|
|
26
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
27
|
+
Requires-Dist: pip-audit>=2.7; extra == 'dev'
|
|
28
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mkdocs-include-markdown-plugin; extra == 'docs'
|
|
35
|
+
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
|
|
36
|
+
Requires-Dist: mkdocs>=1.5; extra == 'docs'
|
|
37
|
+
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# codex-core
|
|
41
|
+
|
|
42
|
+
**Core utilities, schemas, and settings for the Codex WaaS toolkit.**
|
|
43
|
+
|
|
44
|
+
This library provides the foundational building blocks used by all other Codex tools. It focuses on Pydantic-based data models, structured logging, and configuration management.
|
|
45
|
+
|
|
46
|
+
## 🚀 Key Features
|
|
47
|
+
|
|
48
|
+
* **Core Interfaces**: Base classes and protocols for Codex components.
|
|
49
|
+
* **Common Utilities**: Logger setup (Loguru), phone number validation, text processing, and caching.
|
|
50
|
+
* **Schemas**: Shared Pydantic models for cross-service communication.
|
|
51
|
+
* **Settings**: Modern configuration management using `pydantic-settings`.
|
|
52
|
+
|
|
53
|
+
## 📦 Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install codex-core
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 🛠️ Quick Start
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from codex_tools.common.logger import setup_logger
|
|
63
|
+
|
|
64
|
+
logger = setup_logger("my-app")
|
|
65
|
+
logger.info("Codex Core is ready!")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
*Part of the [Codex WaaS](https://github.com/codexdlc) ecosystem.*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# codex-core
|
|
2
|
+
|
|
3
|
+
**Core utilities, schemas, and settings for the Codex WaaS toolkit.**
|
|
4
|
+
|
|
5
|
+
This library provides the foundational building blocks used by all other Codex tools. It focuses on Pydantic-based data models, structured logging, and configuration management.
|
|
6
|
+
|
|
7
|
+
## 🚀 Key Features
|
|
8
|
+
|
|
9
|
+
* **Core Interfaces**: Base classes and protocols for Codex components.
|
|
10
|
+
* **Common Utilities**: Logger setup (Loguru), phone number validation, text processing, and caching.
|
|
11
|
+
* **Schemas**: Shared Pydantic models for cross-service communication.
|
|
12
|
+
* **Settings**: Modern configuration management using `pydantic-settings`.
|
|
13
|
+
|
|
14
|
+
## 📦 Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install codex-core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 🛠️ Quick Start
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from codex_tools.common.logger import setup_logger
|
|
24
|
+
|
|
25
|
+
logger = setup_logger("my-app")
|
|
26
|
+
logger.info("Codex Core is ready!")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
*Part of the [Codex WaaS](https://github.com/codexdlc) ecosystem.*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[🏠 Home](../index.md) | [⚙️ API Reference](index.md) | [🛠️ Common API](common.md)
|
|
2
|
+
|
|
3
|
+
# 🛠️ Common API (Utilities)
|
|
4
|
+
|
|
5
|
+
This section describes the shared utility functions of the **codex-core** library.
|
|
6
|
+
|
|
7
|
+
## Phone Normalization
|
|
8
|
+
Tools for correctly formatting phone numbers (supports +, 00, and local 0).
|
|
9
|
+
|
|
10
|
+
::: codex_core.common.phone
|
|
11
|
+
|
|
12
|
+
## Text Processing
|
|
13
|
+
Tools for name normalization, transliteration, and string cleaning.
|
|
14
|
+
|
|
15
|
+
::: codex_core.common.text
|
|
16
|
+
|
|
17
|
+
## Logging
|
|
18
|
+
Helpers for structured logging and Loguru configuration.
|
|
19
|
+
|
|
20
|
+
::: codex_core.common.log_context
|
|
21
|
+
::: codex_core.common.loguru_setup
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[🏠 Home](../index.md) | [⚙️ API Reference](index.md) | [🛡️ Core API](core.md)
|
|
2
|
+
|
|
3
|
+
# 🛡️ Core API (DTO & PII)
|
|
4
|
+
|
|
5
|
+
This section describes the essential data models and security utilities of the **codex-core** library.
|
|
6
|
+
|
|
7
|
+
## BaseDTO
|
|
8
|
+
`BaseDTO` is an immutable Pydantic model with built-in PII masking for `repr` and `str`.
|
|
9
|
+
|
|
10
|
+
::: codex_core.core.base_dto
|
|
11
|
+
|
|
12
|
+
## PII Protection
|
|
13
|
+
Utilities for identifying and masking sensitive data.
|
|
14
|
+
|
|
15
|
+
::: codex_core.core.pii
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[🏠 Home](../index.md) | [🧭 Guide (EN)](../en_EN/README.md) | [⚙️ API Reference](index.md)
|
|
2
|
+
|
|
3
|
+
# API Reference Overview
|
|
4
|
+
|
|
5
|
+
Welcome to the **codex-core** API Reference! This section provides detailed information about all classes, functions, and modules in the library.
|
|
6
|
+
|
|
7
|
+
## Core API (Essential)
|
|
8
|
+
|
|
9
|
+
- **[🛡️ Core (DTO & PII)](core.md)**: Base data models and PII protection utilities.
|
|
10
|
+
- **[🛠️ Common (Utilities)](common.md)**: Phone, text, and logging helpers.
|
|
11
|
+
- **[⚙️ Settings (Config)](settings.md)**: Base configuration patterns.
|
|
12
|
+
|
|
13
|
+
## Technical Details
|
|
14
|
+
|
|
15
|
+
All files in this section use the `::: codex_core` directive to automatically extract documentation from source code docstrings.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[🏠 Home](../index.md) | [⚙️ API Reference](index.md) | [⚙️ Settings API](settings.md)
|
|
2
|
+
|
|
3
|
+
# ⚙️ Settings API (Base Configuration)
|
|
4
|
+
|
|
5
|
+
This section describes the base configuration patterns used across Codex projects.
|
|
6
|
+
|
|
7
|
+
## BaseCommonSettings
|
|
8
|
+
`BaseCommonSettings` is a Pydantic Settings model that handles Redis URLs and environment variable loading.
|
|
9
|
+
|
|
10
|
+
::: codex_core.settings.base
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{% include "../CHANGELOG.md" %}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[🏠 Home](../index.md) | [🧭 Guide (EN)](README.md) | [⚙️ API Reference](../api/index.md)
|
|
2
|
+
|
|
3
|
+
# Guide: Overview (EN)
|
|
4
|
+
|
|
5
|
+
Welcome to the **codex-core** guide! This library serves as the shared foundation for all Codex projects, ensuring that essential utilities and architectural patterns remain consistent and maintainable.
|
|
6
|
+
|
|
7
|
+
## Documentation Sections
|
|
8
|
+
|
|
9
|
+
### 1. [Getting Started](guide/getting_started.md)
|
|
10
|
+
How to install and integrate `codex-core` into your project.
|
|
11
|
+
|
|
12
|
+
### 2. [🛡️ Architecture & Platform](architecture/README.md)
|
|
13
|
+
Detailed breakdown of the core platform components:
|
|
14
|
+
|
|
15
|
+
- **Core (DTO & PII)**: How data is structured and protected.
|
|
16
|
+
- **Common Utilities**: Phone, text, and logging helpers.
|
|
17
|
+
- **Settings Architecture**: How to manage configuration for different environments.
|
|
18
|
+
|
|
19
|
+
### 3. [🗺 Evolution](../evolution/roadmap.md)
|
|
20
|
+
Our core purpose and development philosophy.
|
|
21
|
+
|
|
22
|
+
### 4. [⚙️ API Reference](../api/index.md)
|
|
23
|
+
Technical details for developers.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[🏠 Home](../../index.md) | [🧭 Guide (EN)](../README.md) | [🛡️ Architecture](../../api/index.md)
|
|
2
|
+
|
|
3
|
+
# 🛡️ Architecture & Platform Overview (EN)
|
|
4
|
+
|
|
5
|
+
This section provides a high-level overview of the architectural patterns and foundational components provided by the **codex-core** library.
|
|
6
|
+
|
|
7
|
+
## Domain Structure
|
|
8
|
+
We divide the platform into three main domains, each serving a specific purpose:
|
|
9
|
+
|
|
10
|
+
| Domain | Description | Key Components |
|
|
11
|
+
| :--- | :--- | :--- |
|
|
12
|
+
| **[🛡️ Core](platform/core.md)** | Essential data models and security. | `BaseDTO`, PII Masking, `mask_value`. |
|
|
13
|
+
| **[🛠️ Common](platform/common.md)** | Standardized utility functions. | `normalize_phone`, `normalize_name`, `TaskLogContext`. |
|
|
14
|
+
| **[⚙️ Settings](platform/settings.md)** | Infrastructure configuration. | `BaseCommonSettings`, `redis_url`. |
|
|
15
|
+
|
|
16
|
+
## Core Principles
|
|
17
|
+
1. **Security First**: PII protection is integrated at the base DTO level.
|
|
18
|
+
2. **Immutability**: Data models are frozen by default to prevent side effects.
|
|
19
|
+
3. **Standardization**: Common tasks (phone, name, logging) are solved once for all Codex projects.
|
|
20
|
+
4. **Developer Friendly**: Comprehensive documentation and type hinting ensure a smooth experience.
|
|
21
|
+
|
|
22
|
+
## Next Steps
|
|
23
|
+
- Read about [🛡️ Core: PII & DTO](platform/core.md).
|
|
24
|
+
- Explore [🛠️ Common Utilities](platform/common.md).
|
|
25
|
+
- Understand [⚙️ Settings Architecture](platform/settings.md).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[🏠 Home](../../../index.md) | [🧭 Guide (EN)](../../README.md) | [🛠️ Common API](../../../api/common.md)
|
|
2
|
+
|
|
3
|
+
# 🛠️ Common: Utilities (Architecture)
|
|
4
|
+
|
|
5
|
+
This section describes the shared utility functions that facilitate common tasks within the **codex-core** ecosystem.
|
|
6
|
+
|
|
7
|
+
## Domain Goal
|
|
8
|
+
The `common` domain provides a collection of robust, standardized, and framework-agnostic utilities to reduce boilerplate and prevent errors across multiple projects.
|
|
9
|
+
|
|
10
|
+
## 1. Phone Normalization
|
|
11
|
+
Standardized phone number formatting is essential for communication and consistency.
|
|
12
|
+
|
|
13
|
+
### Features:
|
|
14
|
+
- **International Support**: Handles `+49`, `0049`, and other international prefixes correctly.
|
|
15
|
+
- **Local Formats**: Automatically converts local German numbers (starting with `0`) to the international `49` format.
|
|
16
|
+
- **Robust Cleaning**: Removes non-digit characters while preserving important structure.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from codex_core.common.phone import normalize_phone
|
|
20
|
+
|
|
21
|
+
# Output: "491511234567"
|
|
22
|
+
normalize_phone("0151 1234567")
|
|
23
|
+
normalize_phone("+49 151 1234567")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 2. Name Normalization
|
|
27
|
+
A utility for correctly formatting first and last names, ensuring consistency in databases and communications.
|
|
28
|
+
|
|
29
|
+
### Key Logic:
|
|
30
|
+
- **Case Correction**: Automatically capitalizes names correctly (e.g., `ivan` -> `Ivan`).
|
|
31
|
+
- **Compound Names**: Correctly handles hyphenated and space-separated names (e.g., `ivanov-petrov` -> `Ivanov-Petrov`).
|
|
32
|
+
- **Space Management**: Removes extra spaces while preserving necessary separators.
|
|
33
|
+
|
|
34
|
+
## 3. Structured Logging
|
|
35
|
+
The `TaskLogContext` helper simplifies logging for structured background operations and tasks.
|
|
36
|
+
|
|
37
|
+
### Advantages:
|
|
38
|
+
- **Automatic Fields**: Adds `task` and `context` names to every log record.
|
|
39
|
+
- **Compatibility**: Works seamlessly with standard `logging` and third-party tools like `loguru` and ELK.
|
|
40
|
+
- **Traceability**: Makes it easy to filter logs by task or context in your log management system.
|