diff --git a/.github/workflows/check_milvus_proto.yml b/.github/workflows/check_milvus_proto.yml index 870af92dd..5f3cfe3d1 100644 --- a/.github/workflows/check_milvus_proto.yml +++ b/.github/workflows/check_milvus_proto.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.11] + python-version: [3.8, 3.11] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/code_checker.yml b/.github/workflows/code_checker.yml index ca6aff38e..96e38c3b7 100644 --- a/.github/workflows/code_checker.yml +++ b/.github/workflows/code_checker.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.11] + python-version: [3.8, 3.11] steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d9ce774ed..ac6a31017 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.11] + python-version: [3.8, 3.11] steps: - name: Checkout code diff --git a/README.md b/README.md index 3860b36dd..1259c5b90 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ The following collection shows Milvus versions and recommended PyMilvus versions | 2.0.\* | 2.0.2 | | 2.1.\* | 2.1.3 | | 2.2.\* | 2.2.15 | -| 2.3.\* | 2.3.0 | +| 2.3.\* | 2.3.4 | ## Installation -You can install PyMilvus via `pip` or `pip3` for Python 3.7+: +You can install PyMilvus via `pip` or `pip3` for Python 3.8+: ```shell $ pip3 install pymilvus @@ -40,7 +40,7 @@ $ pip3 install pymilvus You can install a specific version of PyMilvus by: ```shell -$ pip3 install pymilvus==2.3.0 +$ pip3 install pymilvus==2.3.4 ``` You can upgrade PyMilvus to the latest version by: @@ -97,13 +97,13 @@ Documentation is available online: https://milvus.io/api-reference/pymilvus/v2.3 The commits on the development branch of each version will be packaged and uploaded to [Test PyPI](https://test.pypi.org/). -The package name generated by the development branch is x.y.z.dev, where is the number of commits that differ from the most recent release. +The package name generated by the development branch is x.y.z.rc, where is the number of commits that differ from the most recent release. -- For example, after the release of 2.0.1, two commits were submitted on the 2.0 branch. -The version number of the latest commit of 2.0 branch is **2.0.2.dev2**. +- For example, after the release of **2.3.4**, two commits were submitted on the 2.3 branch. +The version number of the latest commit of 2.3 branch is **2.3.5.rc2**. -- For example, after the release of 2.0.1, 10 commits were submitted on the master branch. -The version number of the latest commit of master branch is **2.1.0.dev10**. +- For example, after the release of **2.3.4**, 10 commits were submitted on the master branch. +The version number of the latest commit of master branch is **2.4.0.rc10**. To install the package on Test PyPi, you need to append `--extra-index-url` after pip, for example: diff --git a/_version_helper.py b/_version_helper.py new file mode 100644 index 000000000..32718d817 --- /dev/null +++ b/_version_helper.py @@ -0,0 +1,95 @@ +""" +this module is a hack only in place to allow for setuptools +to use the attribute for the versions + +it works only if the backend-path of the build-system section +from pyproject.toml is respected +""" +from __future__ import annotations + +import logging +from typing import Callable + +from setuptools import build_meta as build_meta # noqa + +from setuptools_scm import _types as _t +from setuptools_scm import Configuration +from setuptools_scm import get_version +from setuptools_scm import git +from setuptools_scm import hg +from setuptools_scm.fallbacks import parse_pkginfo +from setuptools_scm.version import ( + get_no_local_node, + _parse_version_tag, + guess_next_simple_semver, + SEMVER_MINOR, + guess_next_version, + ScmVersion, +) + +log = logging.getLogger("setuptools_scm") +# todo: take fake entrypoints from pyproject.toml +try_parse: list[Callable[[_t.PathT, Configuration], ScmVersion | None]] = [ + parse_pkginfo, + git.parse, + hg.parse, + git.parse_archival, + hg.parse_archival, +] + + +def parse(root: str, config: Configuration) -> ScmVersion | None: + for maybe_parse in try_parse: + try: + parsed = maybe_parse(root, config) + except OSError as e: + log.warning("parse with %s failed with: %s", maybe_parse, e) + else: + if parsed is not None: + return parsed + +fmt = "{guessed}.rc{distance}" + +def custom_version(version: ScmVersion) -> str: + if version.exact: + return version.format_with("{tag}") + if version.branch is not None: + # Does the branch name (stripped of namespace) parse as a version? + branch_ver_data = _parse_version_tag( + version.branch.split("/")[-1], version.config + ) + if branch_ver_data is not None: + branch_ver = branch_ver_data["version"] + if branch_ver[0] == "v": + # Allow branches that start with 'v', similar to Version. + branch_ver = branch_ver[1:] + # Does the branch version up to the minor part match the tag? If not it + # might be like, an issue number or something and not a version number, so + # we only want to use it if it matches. + tag_ver_up_to_minor = str(version.tag).split(".")[:SEMVER_MINOR] + branch_ver_up_to_minor = branch_ver.split(".")[:SEMVER_MINOR] + if branch_ver_up_to_minor == tag_ver_up_to_minor: + # We're in a release/maintenance branch, next is a patch/rc/beta bump: + return version.format_next_version(guess_next_version, fmt=fmt) + # We're in a development branch, next is a minor bump: + return version.format_next_version(guess_next_simple_semver, retain=SEMVER_MINOR, fmt=fmt) + + +def scm_version() -> str: + return get_version( + relative_to=__file__, + parse=parse, + version_scheme=custom_version, + local_scheme=get_no_local_node, + ) + + +version: str + + +def __getattr__(name: str) -> str: + if name == "version": + global version + version = scm_version() + return version + raise AttributeError(name) diff --git a/pyproject.toml b/pyproject.toml index d43417546..9e70df868 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,13 +7,13 @@ requires = [ ] build-backend = "setuptools.build_meta" + [project] name="pymilvus" authors = [ {name='Milvus Team', email="milvus-team@zilliz.com"}, ] -requires-python = '>=3.7' - +requires-python = '>=3.8' description = "Python Sdk for Milvus" readme = "README.md" dependencies=[ @@ -38,9 +38,10 @@ dynamic = ["version"] [project.urls] "repository" = 'https://github.com/milvus-io/pymilvus' +[tool.setuptools.dynamic] +version = { attr = "_version_helper.version"} + [tool.setuptools_scm] -'local_scheme'= 'no-local-version' -'version_scheme'= 'no-guess-dev' [tool.black] line-length = 100 @@ -166,3 +167,4 @@ builtins-ignorelist = [ "dict", # TODO "filter", ] +