nlp2sql 0.2.0rc1__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.
- nlp2sql-0.2.0rc1/.github/workflows/publish-pypi.yml +88 -0
- nlp2sql-0.2.0rc1/.github/workflows/publish-testpypi.yml +72 -0
- nlp2sql-0.2.0rc1/.gitignore +173 -0
- nlp2sql-0.2.0rc1/.python-version +1 -0
- nlp2sql-0.2.0rc1/PKG-INFO +427 -0
- nlp2sql-0.2.0rc1/README.md +355 -0
- nlp2sql-0.2.0rc1/benchmarks/enterprise_benchmark_results.json +26 -0
- nlp2sql-0.2.0rc1/docker/.env.example +34 -0
- nlp2sql-0.2.0rc1/docker/docker-compose.yml +42 -0
- nlp2sql-0.2.0rc1/docker/get-db-urls.sh +35 -0
- nlp2sql-0.2.0rc1/docker/init-schema.sql +160 -0
- nlp2sql-0.2.0rc1/docker/large-schema.sql +320 -0
- nlp2sql-0.2.0rc1/examples/advanced/test_multiple_providers.py +175 -0
- nlp2sql-0.2.0rc1/examples/advanced/test_schema_filters.py +229 -0
- nlp2sql-0.2.0rc1/examples/advanced/test_simple_api.py +145 -0
- nlp2sql-0.2.0rc1/examples/database_specific/test_odoo_analysis.py +246 -0
- nlp2sql-0.2.0rc1/examples/database_specific/test_odoo_integration.py +246 -0
- nlp2sql-0.2.0rc1/examples/documentation/real_world_example.py +170 -0
- nlp2sql-0.2.0rc1/examples/getting_started/basic_usage.py +136 -0
- nlp2sql-0.2.0rc1/examples/getting_started/simple_demo.py +103 -0
- nlp2sql-0.2.0rc1/examples/getting_started/test_api_setup.py +294 -0
- nlp2sql-0.2.0rc1/examples/schema_management/test_auto_schema.py +211 -0
- nlp2sql-0.2.0rc1/examples/schema_management/test_schema_filters_comprehensive.py +278 -0
- nlp2sql-0.2.0rc1/examples/schema_management/test_schema_only.py +137 -0
- nlp2sql-0.2.0rc1/install-dev.sh +76 -0
- nlp2sql-0.2.0rc1/mcp_server/__init__.py +3 -0
- nlp2sql-0.2.0rc1/mcp_server/example_config.json +13 -0
- nlp2sql-0.2.0rc1/mcp_server/pyproject.toml +24 -0
- nlp2sql-0.2.0rc1/mcp_server/server.py +533 -0
- nlp2sql-0.2.0rc1/pyproject.toml +154 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/__init__.py +166 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/adapters/__init__.py +0 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/adapters/anthropic_adapter.py +299 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/adapters/gemini_adapter.py +285 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/adapters/openai_adapter.py +270 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/adapters/postgres_repository.py +422 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/cli.py +915 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/config/__init__.py +0 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/config/settings.py +124 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/core/__init__.py +0 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/core/entities.py +91 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/exceptions/__init__.py +62 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/__init__.py +30 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/ai_provider.py +71 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/cache.py +39 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/query_optimizer.py +69 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/schema_repository.py +74 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/ports/schema_strategy.py +63 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/schema/__init__.py +0 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/schema/analyzer.py +361 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/schema/embedding_manager.py +292 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/schema/manager.py +388 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/services/__init__.py +0 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/services/query_service.py +303 -0
- nlp2sql-0.2.0rc1/src/nlp2sql/utils/__init__.py +0 -0
- nlp2sql-0.2.0rc1/test_tmp/.gitignore +4 -0
- nlp2sql-0.2.0rc1/tests/test_basic.py +54 -0
- nlp2sql-0.2.0rc1/uv.lock +4955 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Publish Python Package to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
tag:
|
|
9
|
+
description: 'Git tag to publish (e.g., v0.2.0, v0.3.0)'
|
|
10
|
+
required: false
|
|
11
|
+
default: 'latest'
|
|
12
|
+
version:
|
|
13
|
+
description: 'Package version to publish (e.g., 0.2.0, 0.3.0)'
|
|
14
|
+
required: false
|
|
15
|
+
default: 'auto-detect'
|
|
16
|
+
confirm_production:
|
|
17
|
+
description: 'Type "PRODUCTION" to confirm publishing to live PyPI'
|
|
18
|
+
required: true
|
|
19
|
+
default: ''
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
deploy:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
environment: pypi # This should match the environment name you provided in GitHub
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
id-token: write # This is required for OpenID Connect
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Validate production confirmation
|
|
32
|
+
run: |
|
|
33
|
+
if [ "${{ github.event.inputs.confirm_production }}" != "PRODUCTION" ]; then
|
|
34
|
+
echo "❌ Production confirmation required. Please type 'PRODUCTION' to confirm."
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
echo "✅ Production deployment confirmed"
|
|
38
|
+
|
|
39
|
+
- name: Checkout specific tag or latest
|
|
40
|
+
uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
ref: ${{ github.event.inputs.tag != 'latest' && github.event.inputs.tag || github.ref }}
|
|
43
|
+
fetch-depth: 0
|
|
44
|
+
|
|
45
|
+
- name: Display selected tag/version info
|
|
46
|
+
run: |
|
|
47
|
+
echo "🏷️ Selected tag: ${{ github.event.inputs.tag || 'latest' }}"
|
|
48
|
+
echo "📦 Target version: ${{ github.event.inputs.version || 'auto-detect' }}"
|
|
49
|
+
echo "🔍 Current commit: $(git rev-parse HEAD)"
|
|
50
|
+
echo "🌟 Current tag: $(git describe --tags --exact-match 2>/dev/null || echo 'No tag')"
|
|
51
|
+
echo "🚀 Publishing to: PRODUCTION PyPI"
|
|
52
|
+
|
|
53
|
+
- name: Set up Python 3.12
|
|
54
|
+
uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: '3.12'
|
|
57
|
+
|
|
58
|
+
- name: Install uv
|
|
59
|
+
run: python -m pip install uv
|
|
60
|
+
|
|
61
|
+
- name: Install project dependencies with uv
|
|
62
|
+
run: |
|
|
63
|
+
# Install main dependencies first
|
|
64
|
+
uv pip install --system .
|
|
65
|
+
# Then install dev dependencies
|
|
66
|
+
uv pip install --system ".[dev]"
|
|
67
|
+
# Verify structlog is installed
|
|
68
|
+
python -c "import structlog; print(f'structlog version: {structlog.__version__}')"
|
|
69
|
+
|
|
70
|
+
- name: Install build and twine
|
|
71
|
+
run: python -m pip install build twine
|
|
72
|
+
|
|
73
|
+
- name: List installed packages (debug)
|
|
74
|
+
run: pip list | grep -E "(structlog|pytest)"
|
|
75
|
+
|
|
76
|
+
- name: Run tests
|
|
77
|
+
env:
|
|
78
|
+
PYTHONPATH: src
|
|
79
|
+
run: |
|
|
80
|
+
pytest
|
|
81
|
+
|
|
82
|
+
- name: Build and publish
|
|
83
|
+
env:
|
|
84
|
+
TWINE_USERNAME: __token__
|
|
85
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
86
|
+
run: |
|
|
87
|
+
python -m build
|
|
88
|
+
twine upload --repository pypi dist/*
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: Publish Python Package to Test PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
tag:
|
|
9
|
+
description: 'Git tag to publish (e.g., v0.2.0b1, v0.2.0)'
|
|
10
|
+
required: false
|
|
11
|
+
default: 'latest'
|
|
12
|
+
version:
|
|
13
|
+
description: 'Package version to publish (e.g., 0.2.0b1, 0.2.0)'
|
|
14
|
+
required: false
|
|
15
|
+
default: 'auto-detect'
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
deploy:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
environment: testpypi # This should match the environment name you provided
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
id-token: write # This is required for OpenID Connect
|
|
24
|
+
contents: read
|
|
25
|
+
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout specific tag or latest
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
ref: ${{ github.event.inputs.tag != 'latest' && github.event.inputs.tag || github.ref }}
|
|
31
|
+
fetch-depth: 0
|
|
32
|
+
|
|
33
|
+
- name: Display selected tag/version info
|
|
34
|
+
run: |
|
|
35
|
+
echo "🏷️ Selected tag: ${{ github.event.inputs.tag || 'latest' }}"
|
|
36
|
+
echo "📦 Target version: ${{ github.event.inputs.version || 'auto-detect' }}"
|
|
37
|
+
echo "🔍 Current commit: $(git rev-parse HEAD)"
|
|
38
|
+
echo "🌟 Current tag: $(git describe --tags --exact-match 2>/dev/null || echo 'No tag')"
|
|
39
|
+
|
|
40
|
+
- name: Set up Python 3.12
|
|
41
|
+
uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: '3.12'
|
|
44
|
+
|
|
45
|
+
- name: Install uv
|
|
46
|
+
run: python -m pip install uv
|
|
47
|
+
|
|
48
|
+
- name: Install project dependencies with uv
|
|
49
|
+
run: |
|
|
50
|
+
# Install main dependencies first
|
|
51
|
+
uv pip install --system .
|
|
52
|
+
# Then install dev dependencies
|
|
53
|
+
uv pip install --system ".[dev]"
|
|
54
|
+
# Verify structlog is installed
|
|
55
|
+
python -c "import structlog; print(f'structlog version: {structlog.__version__}')"
|
|
56
|
+
|
|
57
|
+
- name: Install build and twine
|
|
58
|
+
run: python -m pip install build twine
|
|
59
|
+
|
|
60
|
+
- name: List installed packages (debug)
|
|
61
|
+
run: pip list | grep -E "(structlog|pytest)"
|
|
62
|
+
|
|
63
|
+
- name: Run tests
|
|
64
|
+
env:
|
|
65
|
+
PYTHONPATH: src
|
|
66
|
+
run: |
|
|
67
|
+
pytest
|
|
68
|
+
|
|
69
|
+
- name: Build and publish
|
|
70
|
+
run: |
|
|
71
|
+
python -m build
|
|
72
|
+
twine upload --repository testpypi dist/*
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
### Python template
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
111
|
+
.pdm.toml
|
|
112
|
+
.pdm-python
|
|
113
|
+
.pdm-build/
|
|
114
|
+
|
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
116
|
+
__pypackages__/
|
|
117
|
+
|
|
118
|
+
# Celery stuff
|
|
119
|
+
celerybeat-schedule
|
|
120
|
+
celerybeat.pid
|
|
121
|
+
|
|
122
|
+
# SageMath parsed files
|
|
123
|
+
*.sage.py
|
|
124
|
+
|
|
125
|
+
# Environments
|
|
126
|
+
.env
|
|
127
|
+
.venv
|
|
128
|
+
env/
|
|
129
|
+
venv/
|
|
130
|
+
ENV/
|
|
131
|
+
env.bak/
|
|
132
|
+
venv.bak/
|
|
133
|
+
|
|
134
|
+
# Spyder project settings
|
|
135
|
+
.spyderproject
|
|
136
|
+
.spyproject
|
|
137
|
+
|
|
138
|
+
# Rope project settings
|
|
139
|
+
.ropeproject
|
|
140
|
+
|
|
141
|
+
# mkdocs documentation
|
|
142
|
+
/site
|
|
143
|
+
|
|
144
|
+
# mypy
|
|
145
|
+
.mypy_cache/
|
|
146
|
+
.dmypy.json
|
|
147
|
+
dmypy.json
|
|
148
|
+
|
|
149
|
+
# Pyre type checker
|
|
150
|
+
.pyre/
|
|
151
|
+
|
|
152
|
+
# pytype static type analyzer
|
|
153
|
+
.pytype/
|
|
154
|
+
|
|
155
|
+
# Cython debug symbols
|
|
156
|
+
cython_debug/
|
|
157
|
+
|
|
158
|
+
# PyCharm
|
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
163
|
+
.idea/
|
|
164
|
+
|
|
165
|
+
# nlp2sql specific exclusions
|
|
166
|
+
.claude/settings.local.json
|
|
167
|
+
nplsql.toml
|
|
168
|
+
embeddings/
|
|
169
|
+
query_cache.db
|
|
170
|
+
*.iml
|
|
171
|
+
*.idea/
|
|
172
|
+
.venv_test/
|
|
173
|
+
*.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|