From 594bb0d6cf80d6787c98bc7de14127770b8f5811 Mon Sep 17 00:00:00 2001 From: Senhaji Rhazi Hamza Date: Wed, 13 Nov 2024 00:22:18 +0100 Subject: [PATCH] feat : add version file --- .github/workflows/release-python.yml | 33 ++++++++++------------------ polodb/__init__.py | 3 ++- polodb/version.py | 12 ++++++++++ pyproject.toml | 6 +++-- uv.lock | 6 ++++- 5 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 polodb/version.py diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index e31ae98..98765f5 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -4,8 +4,8 @@ on: push: branches: - main - tags: - - "v*.*.*" # Optional: only run on version tags + # tags: + # - "v*.*.*" # Optional: only run on version tags # pull_request: # branches: # - main @@ -46,16 +46,19 @@ jobs: needs: create-dist strategy: matrix: - os: [ubuntu-latest, macos-14, windows-latest] + os: [ubuntu-latest, macos-14, macos-13, windows-latest] # os: [macos-14] - python-version: ["3.9", "3.10"] + python-version: ["3.9"] # , "3.10" # python-version: ["3.10"] - architecture: [x86_64, aarch64] # Explicitly define architectures + architecture: [x86_64, arm64] # Explicitly define architectures # architecture: [aarch64] # Explicitly define architectures exclude: - os: windows-latest - architecture: aarch64 - + architecture: arm64 + - os: macos-13 + arch: arm64 # macOS 13 on GitHub Actions is only x86_64 (Intel) + - os: macos-14 + arch: x86_6 steps: - name: Check out the code uses: actions/checkout@v4 @@ -124,17 +127,5 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} run: | ls -R artifacts/ - twine upload artifacts/**/*.tar.gz artifacts/**/*.whl - release: - name: Release pushed tag - runs-on: ubuntu-22.04 - steps: - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref_name }} - run: | - gh release create "$tag" \ - --repo="$GITHUB_REPOSITORY" \ - --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ - --generate-notes \ No newline at end of file + twine upload artifacts/**/*.tar.gz + twine upload artifacts/**/*.whl diff --git a/polodb/__init__.py b/polodb/__init__.py index f15d9cf..2c772a8 100644 --- a/polodb/__init__.py +++ b/polodb/__init__.py @@ -1,3 +1,4 @@ from .core import PoloDB, Collection +from .version import __version__ -__all__ = ["PoloDB", "Collection"] +__all__ = ["PoloDB", "Collection", "__version__"] diff --git a/polodb/version.py b/polodb/version.py new file mode 100644 index 0000000..233c8d5 --- /dev/null +++ b/polodb/version.py @@ -0,0 +1,12 @@ +import tomli +import os + + +def get_version(): + pyproject_path = os.path.join(os.path.dirname(__file__), "..", "pyproject.toml") + with open(pyproject_path, "rb") as f: + pyproject_data = tomli.load(f) + return pyproject_data["project"]["version"] # Adjust if using a different tool + + +__version__ = get_version() diff --git a/pyproject.toml b/pyproject.toml index da88ea3..75f7803 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "polodb-python" -version = "0.1.12" +version = "0.1.13" description = "Add your description here" readme = "README.md" requires-python = ">=3.9" @@ -11,7 +11,9 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = [] +dependencies = [ + "tomli>=2.0.2", +] [build-system] requires = ["maturin>=1,<2"] diff --git a/uv.lock b/uv.lock index 5554925..cf088de 100644 --- a/uv.lock +++ b/uv.lock @@ -259,8 +259,11 @@ wheels = [ [[package]] name = "polodb-python" -version = "0.1.11" +version = "0.1.12" source = { editable = "." } +dependencies = [ + { name = "tomli" }, +] [package.dev-dependencies] dev = [ @@ -274,6 +277,7 @@ dev = [ ] [package.metadata] +requires-dist = [{ name = "tomli", specifier = ">=2.0.2" }] [package.metadata.requires-dev] dev = [