Skip to content

Add package version #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
file_tag=$(grep 'version=' setup.py | cut -d '=' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
file_tag=$(grep '__version__ =' meilisearch/version.py | cut -d '=' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',')
if [ "$current_tag" != "$file_tag" ]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$current_tag vs $file_tag"
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ _[Read more about this](https://github.com/meilisearch/integration-guides/blob/m

⚠️ Before doing anything, make sure you got through the guide about [Releasing an Integration](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md).

Make a PR modifying the file [`setup.py`](/setup.py) with the right version.
Make a PR modifying the file [`meilisearch/version.py`](/meilisearch/version.py) with the right version.

```python
version="X.X.X"
__version__ = "X.X.X"
```

Once the changes are merged on `main`, you can publish the current draft release via the [GitHub interface](https://github.com/meilisearch/meilisearch-python/releases): on this page, click on `Edit` (related to the draft release) > update the description (be sure you apply [these recommandations](https://github.com/meilisearch/integration-guides/blob/main/resources/integration-release.md#writting-the-release-description)) > when you are ready, click on `Publish release`.
Expand Down
6 changes: 6 additions & 0 deletions meilisearch/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__version__ = "0.18.0"

def qualified_version() -> str:
"""Get the qualified version of this module."""

return f"Meilisearch Python (v{__version__})"
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from setuptools import setup, find_packages
from meilisearch.version import __version__

with open("README.md", "r", encoding="utf8") as fh:
long_description = fh.read()
Expand All @@ -8,7 +9,7 @@
"requests"
],
name="meilisearch",
version="0.18.0",
version=__version__,
author="Charlotte Vermandel",
author_email="[email protected]",
description="The python client for Meilisearch API.",
Expand Down
12 changes: 12 additions & 0 deletions tests/client/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# pylint: disable=invalid-name

import re

from meilisearch.version import __version__, qualified_version


def test_get_version():
assert re.match(r'^(\d+\.)?(\d+\.)?(\*|\d+)$', __version__)

def test_get_qualified_version():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't seem necessary so if it is removed this test can also be removed.

assert qualified_version() == f"Meilisearch Python (v{__version__})"