Skip to content

Commit eccbead

Browse files
authored
release-2024-10-17 (#145)
The new update brings several changes. Mainly in the core, all SQL and parameters are now rust-prepared using pysqlx-core. The PySQLX Engine maintains almost all compatibility with version 0.2.*. This release brings an extra layer of security for your SQL parameters. ***Note: You may need some revisions or small changes to your code.*** - (`Native SQL Params`): Add native support to send the parameters separately to the database. Now, the PySQLX Engine supports sending the SQL and Parameters to the database. - (`New Pool`): Add new Pool async and sync. This release includes a new pool class for the PySQLX Engine to support concurrency connections. - (`Dev Mode`): Now the SQL built could be showing using the env var `PYSQLX_DEV_MODE`; this SQL is not sent to the database; it is just a help to dev identify possible bugs previously.
1 parent d19f01f commit eccbead

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7082
-6383
lines changed

.github/prod.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import toml
44

55
with open("pyproject.toml", mode="r") as file:
6-
text: str = file.read()
6+
text: str = file.read()
77

88

99
def get_version():
10-
uri = "https://pypi.org/pypi/pysqlx-engine/json"
11-
for _ in range(3):
12-
resp = httpx.get(uri)
13-
if resp.is_success:
14-
break
15-
json: dict = resp.json()
10+
uri = "https://pypi.org/pypi/pysqlx-engine/json"
11+
for _ in range(3):
12+
resp = httpx.get(uri)
13+
if resp.is_success:
14+
break
15+
json: dict = resp.json()
1616

17-
return json["info"]["version"]
17+
return json["info"]["version"]
1818

1919

2020
file_version = toml.loads(text)["tool"]["poetry"]["version"]
@@ -23,11 +23,11 @@ def get_version():
2323
print("Package version:", current_version)
2424

2525
if file_version.replace(".", "") > current_version.replace(".", ""):
26-
MAJOR, MINOR, PATCH = file_version.split(".")
26+
MAJOR, MINOR, PATCH = file_version.split(".")
2727

2828
else:
29-
MAJOR, MINOR, PATCH = current_version.split(".")
30-
PATCH = str(int(PATCH) + 1)
29+
MAJOR, MINOR, PATCH = current_version.split(".")
30+
PATCH = str(int(PATCH) + 1)
3131

3232
new_version: str = ".".join([MAJOR, MINOR, PATCH])
3333

@@ -36,9 +36,9 @@ def get_version():
3636
new_text = text.replace(f'version = "{file_version}"', f'version = "{new_version}"')
3737

3838
with open("pyproject.toml", mode="w") as file:
39-
file.write(new_text)
39+
file.write(new_text)
4040

4141
env_file = os.getenv("GITHUB_ENV")
4242

4343
with open(env_file, mode="a") as file:
44-
file.write(f"\nPY_SQLX_VERSION=v{new_version}")
44+
file.write(f"\nPY_SQLX_VERSION=v{new_version}")

.github/release.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
import toml
33

44
with open("pyproject.toml", mode="r") as file:
5-
text: str = file.read()
5+
text: str = file.read()
66

77

88
def get_version():
9-
uri = "https://pypi.org/pypi/pysqlx-engine/json"
10-
for _ in range(3):
11-
resp = httpx.get(uri)
12-
if resp.is_success:
13-
break
14-
json: dict = resp.json()
9+
uri = "https://pypi.org/pypi/pysqlx-engine/json"
10+
for _ in range(3):
11+
resp = httpx.get(uri)
12+
if resp.is_success:
13+
break
14+
json: dict = resp.json()
1515

16-
releases = json["releases"]
17-
versions = sorted(releases.keys(), key=lambda x: int(x.replace(".", "").replace("b", "")), reverse=True)
18-
versions = [v for v in versions if v.startswith("0.2.0") and "b" in v]
19-
return versions[0]
16+
releases = json["releases"]
17+
versions = sorted(releases.keys(), key=lambda x: int(x.replace(".", "").replace("b", "")), reverse=True)
18+
versions = [v for v in versions if v.startswith("0.3.0") and "b" in v]
19+
return versions[0] if versions else "0.3.0b-1"
2020

2121

2222
file_version = toml.loads(text)["tool"]["poetry"]["version"]
@@ -40,4 +40,4 @@ def get_version():
4040
new_text = text.replace(f'version = "{file_version}"', f'version = "{new_version}"')
4141

4242
with open("pyproject.toml", mode="w") as file:
43-
file.write(new_text)
43+
file.write(new_text)

.github/workflows/ci.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
max-parallel: 6
2222
matrix:
2323
os: [ubuntu-latest]
24-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
24+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2525
fail-fast: false
2626

2727
steps:
2828
- name: checkout
2929
uses: actions/checkout@v3
3030

3131
- name: setup python
32-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
3333
with:
3434
python-version: ${{ matrix.python-version }}
3535

@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: up database
4444
run: cp tests/docker/docker-compose.yml docker-compose.yml &&
45-
docker-compose up --build --detach
45+
docker compose up --build --detach
4646

4747
- name: wait container up
4848
run: |
@@ -86,7 +86,7 @@ jobs:
8686
run: |
8787
pip install pydantic --upgrade
8888
pip freeze | grep pydantic
89-
poetry run pytest --ignore=tests/benchmark --cov=pysqlx_engine --cov=tests --cov-report=term-missing:skip-covered --cov-report=xml tests ${@}
89+
poetry run pytest --cov-report=xml tests ${@}
9090
9191
- name: upload coverage v2
9292
uses: codecov/codecov-action@v3
@@ -99,27 +99,32 @@ jobs:
9999
runs-on: ubuntu-latest
100100
needs: [test]
101101
steps:
102-
- name: checkout
102+
- name: Checkout
103103
uses: actions/checkout@v3
104104

105-
- name: release - check package version
106-
if: github.ref != 'refs/heads/main'
105+
- name: Setup python
106+
uses: actions/setup-python@v5
107+
with:
108+
python-version: '3.11'
109+
110+
- name: Release - check package version
111+
if: contains(github.ref, 'release')
107112
run: |
108113
pip install --upgrade httpx toml
109114
python .github/release.py
110115
111-
- name: prod - check package version
116+
- name: Main - check package version
112117
if: github.ref == 'refs/heads/main'
113118
run: |
114119
pip install --upgrade httpx toml
115120
python .github/prod.py
116121
117-
- name: build and publish to pypi
122+
- name: Build and Publish to pypi
118123
uses: JRubics/poetry-publish@v1.13
119124
with:
120125
pypi_token: ${{ secrets.PYPI_TOKEN }}
121126

122-
- name: create celease
127+
- name: Create Release
123128
if: github.ref == 'refs/heads/main'
124129
id: create_release
125130
uses: actions/create-release@v1

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ ipython_config.py
242242
# This is especially recommended for binary packages to ensure reproducibility, and is more
243243
# commonly ignored for libraries.
244244
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
245-
#poetry.lock
245+
poetry.lock
246246

247247
# pdm
248248
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
@@ -348,5 +348,3 @@ $RECYCLE.BIN/
348348
*.lnk
349349

350350
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,python,windows,macos,linux,pycharm+all
351-
352-
test.py

.vscode/settings.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
"files.watcherExclude": {
55
"**/__pycache__/**": true,
66
},
7+
"files.exclude": {
8+
"**/.git": true,
9+
"**/.svn": true,
10+
"**/.hg": true,
11+
"**/CVS": true,
12+
"**/.DS_Store": true,
13+
"**/Thumbs.db": true,
14+
"**/__pycache__/**": true,
15+
"**/.pytest_cache/**": true,
16+
"**.coverage": true,
17+
},
718
"[python]": {
819
"editor.rulers": [
920
120
@@ -12,7 +23,7 @@
1223
"editor.codeActionsOnSave": {
1324
"source.organizeImports": "explicit"
1425
},
15-
"editor.defaultFormatter": "ms-python.black-formatter",
26+
"editor.defaultFormatter": "charliermarsh.ruff",
1627
"editor.bracketPairColorization.enabled": true
1728
},
1829
}

makefile

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)