bqsqlparse 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.
- bqsqlparse-0.1.0/.gitignore +8 -0
- bqsqlparse-0.1.0/DEPLOYMENT.md +148 -0
- bqsqlparse-0.1.0/LICENSE +21 -0
- bqsqlparse-0.1.0/PKG-INFO +722 -0
- bqsqlparse-0.1.0/README.md +670 -0
- bqsqlparse-0.1.0/pyproject.toml +55 -0
- bqsqlparse-0.1.0/src/bqsqlparse/__init__.py +62 -0
- bqsqlparse-0.1.0/src/bqsqlparse/errors.py +30 -0
- bqsqlparse-0.1.0/src/bqsqlparse/functions.py +159 -0
- bqsqlparse-0.1.0/src/bqsqlparse/lexer.py +242 -0
- bqsqlparse-0.1.0/src/bqsqlparse/lineage.py +902 -0
- bqsqlparse-0.1.0/src/bqsqlparse/nodes.py +728 -0
- bqsqlparse-0.1.0/src/bqsqlparse/parser.py +1715 -0
- bqsqlparse-0.1.0/src/bqsqlparse/py.typed +0 -0
- bqsqlparse-0.1.0/src/bqsqlparse/unparse.py +766 -0
- bqsqlparse-0.1.0/tests/test_lexer.py +69 -0
- bqsqlparse-0.1.0/tests/test_lineage.py +270 -0
- bqsqlparse-0.1.0/tests/test_parser.py +322 -0
- bqsqlparse-0.1.0/tests/test_scripting.py +272 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Deploying `bqsqlparse` to PyPI
|
|
2
|
+
|
|
3
|
+
A step-by-step guide to publish this package, from first release to automated
|
|
4
|
+
CI publishing.
|
|
5
|
+
|
|
6
|
+
## 0. Prerequisites
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
python3 -m pip install --upgrade build twine
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
- A [PyPI account](https://pypi.org/account/register/) (and optionally a
|
|
13
|
+
[TestPyPI account](https://test.pypi.org/account/register/) — they are
|
|
14
|
+
separate registrations)
|
|
15
|
+
- Two-factor authentication enabled on PyPI (required for uploads)
|
|
16
|
+
|
|
17
|
+
## 1. Pre-flight checklist
|
|
18
|
+
|
|
19
|
+
1. **Name availability** — confirm `bqsqlparse` is free:
|
|
20
|
+
https://pypi.org/project/bqsqlparse/ (404 = available). If taken, change
|
|
21
|
+
`name` in [pyproject.toml](pyproject.toml).
|
|
22
|
+
2. **Version** — bump the version in *both* places:
|
|
23
|
+
- `version` in [pyproject.toml](pyproject.toml)
|
|
24
|
+
- `__version__` in [src/bqsqlparse/__init__.py](src/bqsqlparse/__init__.py)
|
|
25
|
+
|
|
26
|
+
Follow [SemVer](https://semver.org/): `0.1.0` → `0.1.1` (fix),
|
|
27
|
+
`0.2.0` (feature), `1.0.0` (stable API). PyPI never allows re-uploading
|
|
28
|
+
the same version.
|
|
29
|
+
3. **Metadata** — update `authors`, and the `[project.urls]` section to point
|
|
30
|
+
at your real repository.
|
|
31
|
+
4. **Tests pass**:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e ".[dev]"
|
|
35
|
+
pytest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 2. Build the distributions
|
|
39
|
+
|
|
40
|
+
From the package root:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
rm -rf dist/
|
|
44
|
+
python3 -m build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This creates:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
dist/bqsqlparse-0.1.0.tar.gz # source distribution (sdist)
|
|
51
|
+
dist/bqsqlparse-0.1.0-py3-none-any.whl # wheel
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Validate the metadata renders correctly on PyPI:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python3 -m twine check dist/*
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Both files should report `PASSED`.
|
|
61
|
+
|
|
62
|
+
## 3. (Recommended) Dry-run on TestPyPI
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python3 -m twine upload --repository testpypi dist/*
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
When prompted, use `__token__` as the username and a TestPyPI API token
|
|
69
|
+
(create one at https://test.pypi.org/manage/account/token/) as the password.
|
|
70
|
+
|
|
71
|
+
Verify installation from TestPyPI in a clean environment:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python3 -m venv /tmp/bqtest && source /tmp/bqtest/bin/activate
|
|
75
|
+
pip install --index-url https://test.pypi.org/simple/ bqsqlparse
|
|
76
|
+
python3 -c "import bqsqlparse; print(bqsqlparse.parse_one('SELECT 1').sql())"
|
|
77
|
+
deactivate
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 4. Publish to PyPI
|
|
81
|
+
|
|
82
|
+
Create an API token at https://pypi.org/manage/account/token/
|
|
83
|
+
(scope it to just this project after the first upload), then:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python3 -m twine upload dist/*
|
|
87
|
+
# username: __token__
|
|
88
|
+
# password: pypi-AgEIcHlwaS5vcmc... (your token)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To avoid typing the token every time, create `~/.pypirc`:
|
|
92
|
+
|
|
93
|
+
```ini
|
|
94
|
+
[pypi]
|
|
95
|
+
username = __token__
|
|
96
|
+
password = pypi-AgEIcHlwaS5vcmc...
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
(`chmod 600 ~/.pypirc` — never commit this file.)
|
|
100
|
+
|
|
101
|
+
Your package is now live: `pip install bqsqlparse` 🎉
|
|
102
|
+
|
|
103
|
+
## 5. Tag the release
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git tag v0.1.0
|
|
107
|
+
git push origin v0.1.0
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 6. (Best practice) Automate with GitHub Actions + Trusted Publishing
|
|
111
|
+
|
|
112
|
+
Trusted Publishing removes the need for long-lived API tokens entirely.
|
|
113
|
+
|
|
114
|
+
1. On PyPI: *Your project → Manage → Publishing → Add a new publisher*.
|
|
115
|
+
Enter your GitHub `owner/repo`, workflow file name `publish.yml`, and
|
|
116
|
+
environment name `pypi`.
|
|
117
|
+
2. This repo already ships the workflow at
|
|
118
|
+
[.github/workflows/publish.yml](.github/workflows/publish.yml). It:
|
|
119
|
+
- runs the test suite on every push/PR
|
|
120
|
+
- builds and publishes to PyPI whenever you push a `v*` tag
|
|
121
|
+
3. Release flow becomes just:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# bump version in pyproject.toml + __init__.py, commit, then:
|
|
125
|
+
git tag v0.2.0 && git push origin v0.2.0
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 7. Releasing new versions — quick reference
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 1. bump version (pyproject.toml + src/bqsqlparse/__init__.py)
|
|
132
|
+
# 2. update CHANGELOG / README if needed
|
|
133
|
+
pytest # 3. green tests
|
|
134
|
+
rm -rf dist && python3 -m build # 4. build
|
|
135
|
+
python3 -m twine check dist/* # 5. validate
|
|
136
|
+
python3 -m twine upload dist/* # 6. upload (or push a v* tag for CI)
|
|
137
|
+
git tag vX.Y.Z && git push origin vX.Y.Z
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Troubleshooting
|
|
141
|
+
|
|
142
|
+
| Error | Fix |
|
|
143
|
+
| --- | --- |
|
|
144
|
+
| `File already exists` | Version already uploaded — bump the version and rebuild |
|
|
145
|
+
| `Invalid or non-existent authentication` | Username must be literally `__token__`; token must include the `pypi-` prefix |
|
|
146
|
+
| `The name 'bqsqlparse' is too similar to an existing project` | Pick a different `name` in pyproject.toml |
|
|
147
|
+
| README renders badly on PyPI | Run `twine check dist/*`; ensure `readme = "README.md"` and valid Markdown |
|
|
148
|
+
| Wrong files in the wheel | Inspect with `unzip -l dist/*.whl`; adjust `[tool.hatch.build.targets.wheel]` |
|
bqsqlparse-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vamsi Kapa
|
|
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.
|