diff --git a/.github/prod.py b/.github/prod.py index a8e5c4b..c468ad8 100644 --- a/.github/prod.py +++ b/.github/prod.py @@ -1,19 +1,22 @@ -import httpx -import toml +import json import os +import urllib + +import toml with open("Cargo.toml", mode="r") as file: text: str = file.read() +# convert get_version to use native python libs def get_version(): uri = "https://pypi.org/pypi/pysqlx-core/json" for _ in range(3): - resp = httpx.get(uri) - if resp.is_success: + resp = urllib.request.urlopen(uri) + if resp.status == 200: break - json: dict = resp.json() - return json["info"]["version"] + data: dict = json.loads(resp.read()) + return data["info"]["version"] version: str = get_version() @@ -40,4 +43,4 @@ def get_version(): env_file = os.getenv('GITHUB_ENV') with open(env_file, mode="a") as file: - file.write(f"\nPY_SQLX_VERSION=v{new_version}") \ No newline at end of file + file.write(f"\nPY_SQLX_VERSION=v{new_version}") diff --git a/.github/release.py b/.github/release.py index 77895f3..1a3ca67 100644 --- a/.github/release.py +++ b/.github/release.py @@ -1,4 +1,6 @@ -import httpx +import json +import urllib + import toml with open("Cargo.toml", mode="r") as file: @@ -8,24 +10,27 @@ def get_version(): uri = "https://pypi.org/pypi/pysqlx-core/json" for _ in range(3): - resp = httpx.get(uri) - if resp.is_success: + resp = urllib.request.urlopen(uri) + if resp.status == 200: break - json: dict = resp.json() + data: dict = json.loads(resp.read()) - releases = json["releases"] - versions = sorted(releases.keys(), key=lambda x: int(x.replace(".", "").replace("b", "").replace("a", "")), reverse=True) + releases = data["releases"] + versions = sorted( + releases.keys(), key=lambda x: int(x.replace(".", "").replace("b", "").replace("a", "")), reverse=True + ) versions = [v for v in versions if "b" in v] - current_version = json["info"]["version"] + current_version = data["info"]["version"] if versions: if int(current_version.replace(".", "")) > int(versions[0].split("b")[0].replace(".", "")): return current_version return versions[0] - + return current_version + version: str = get_version() file_version = toml.loads(text)["package"]["version"] @@ -53,4 +58,4 @@ def get_version(): raise Exception("Could not update version, check the Cargo.toml file.") with open("Cargo.toml", mode="w") as file: - file.write(new_text) \ No newline at end of file + file.write(new_text) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d835256..60b83ba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -147,7 +147,7 @@ jobs: with: components: llvm-tools - - run: pip install -U twine 'black>=22.3.0,<23' typing_extensions httpx toml + - run: pip install -U twine 'black>=22.3.0,<23' typing_extensions toml - name: production - check package version if: github.ref == 'refs/heads/main' @@ -214,7 +214,7 @@ jobs: with: components: llvm-tools - - run: pip install -U twine 'black>=22.3.0,<23' typing_extensions httpx toml + - run: pip install -U twine 'black>=22.3.0,<23' typing_extensions toml - name: production - check package version if: github.ref == 'refs/heads/main' @@ -260,7 +260,7 @@ jobs: python-version: "3.10" - name: install deps - run: pip install -U twine httpx toml + run: pip install -U twine toml - name: production - check package version if: github.ref == 'refs/heads/main' diff --git a/Cargo.lock b/Cargo.lock index 611ef4e..0bfdee5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1889,7 +1889,7 @@ dependencies = [ [[package]] name = "pysqlx-core" -version = "0.1.37" +version = "0.1.47" dependencies = [ "convert", "database", diff --git a/Cargo.toml b/Cargo.toml index 943f23f..a83b87a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pysqlx-core" -version = "0.1.37" +version = "0.1.47" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html