-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #790 from vespa-engine/thomasht86/pyvespa-release-…
…pipeline CI: pyvespa release pipeline
- Loading branch information
Showing
6 changed files
with
167 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: pyvespa - Release and upload PyPI | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
jobs: | ||
|
||
update_version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e .[build] | ||
- name: Set version from ref tag that triggered the workflow (strip prefix 'v' from tag) | ||
id: set_version | ||
run: echo "version=${{ format('v{0}', github.ref_name) }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Update version | ||
run: | | ||
echo "Updating pyvespa version to ${{ steps.set_version.outputs.version }}" | ||
python vespa/utils/update_version.py --version ${{ steps.set_version.outputs.version }} | ||
- name: Build | ||
run: | | ||
python -m build | ||
- name: Upload to PyPI | ||
if: github.event_name == 'release' | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN_PYVESPA }} #TODO: this must be added to secrets | ||
run: python -m twine upload dist/* | ||
|
||
- name: Create Pull Request | ||
if: github.event_name == 'release' | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Update pyvespa version to ${{ steps.set_version.outputs.version }}" | ||
title: "Update pyvespa version to ${{ steps.set_version.outputs.version }}" | ||
body: "This PR updates the pyvespa version to ${{ steps.set_version.outputs.version }}" | ||
branch: "update-pyvespa-version-${{ steps.set_version.outputs.version }}" | ||
base: "master" | ||
labels: "pyvespa" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
[build-system] | ||
requires = ["setuptools>=69", "wheel", "build", "twine", "versioneer[toml]"] | ||
build-backend = "setuptools.build_meta" | ||
|
@@ -8,9 +10,7 @@ version = "0.40.0" | |
description = "Python API for vespa.ai" | ||
readme = "README.md" | ||
keywords = ["vespa", "search engine", "data science"] | ||
classifiers = [ | ||
"License :: OSI Approved :: Apache Software License" | ||
] | ||
classifiers = ["License :: OSI Approved :: Apache Software License"] | ||
dependencies = [ | ||
"requests", | ||
"requests_toolbelt", | ||
|
@@ -19,13 +19,10 @@ dependencies = [ | |
"cryptography", | ||
"aiohttp", | ||
"tenacity", | ||
"typing_extensions" | ||
"typing_extensions", | ||
] | ||
requires-python = ">=3.8" | ||
|
||
[project.urls] | ||
homepage = "https://pypi.org/project/pyvespa" | ||
repository = "https://github.com/vespa-engine/pyvespa" | ||
requires-python = ">=3.8" | ||
|
||
[[project.authors]] | ||
name = "Thiago G. Martins" | ||
|
@@ -34,7 +31,10 @@ name = "Thiago G. Martins" | |
name = "Thomas Thoresen" | ||
email = "[email protected]" | ||
|
||
# License file | ||
[project.urls] | ||
homepage = "https://pypi.org/project/pyvespa" | ||
repository = "https://github.com/vespa-engine/pyvespa" | ||
|
||
[project.license] | ||
file = "LICENSE" | ||
|
||
|
@@ -47,42 +47,66 @@ dev = [ | |
"nbconvert", | ||
"runnb", | ||
"ruff", | ||
"pre-commit" | ||
"pre-commit", | ||
] | ||
build = [ | ||
"setuptools==69.0.3", | ||
"build==1.0.3", | ||
"twine==4.0.1", | ||
"toml==0.10.2", | ||
"requests~=2.26.0", | ||
"bump-my-version==0.21.0", | ||
"setuptools==69.0.3", | ||
"build==1.0.3", | ||
"twine==4.0.1", | ||
"toml==0.10.2", | ||
"requests~=2.26.0", | ||
"ruff", | ||
] | ||
|
||
[tool.setuptools] | ||
packages = ["vespa"] | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".ipynb_checkpoints", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pyenv", | ||
".pytest_cache", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
".vscode", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"site-packages", | ||
"venv", | ||
] | ||
line-length = 88 | ||
indent-width = 4 | ||
|
||
[tool.setuptools.package-data] | ||
vespa = ["py.typed","templates/*"] | ||
vespa = ["py.typed", "templates/*"] | ||
|
||
[tool.ruff.lint] | ||
select = ["E4", "E7", "E9", "F"] | ||
ignore = [] | ||
fixable = ["ALL"] | ||
unfixable = [] | ||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
|
||
[tool.bumpversion] | ||
current_version = "0.40.0" | ||
excluded_paths = ["docs", "vespacli", "setup.py"] | ||
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" | ||
serialize = ["{major}.{minor}.{patch}"] | ||
search = "{current_version}" | ||
replace = "{new_version}" | ||
regex = false | ||
ignore_missing_version = false | ||
ignore_missing_files = false | ||
tag = true | ||
sign_tags = true | ||
tag_name = "v{new_version}" | ||
tag_message = "Bump version: {current_version} → {new_version}" | ||
allow_dirty = false | ||
commit = true | ||
message = "Bump version: {current_version} → {new_version}" | ||
commit_args = "" | ||
[[tool.bumpversion.files]] | ||
filename = "pyproject.toml" | ||
[[tool.bumpversion.files]] | ||
filename = "vespa/__init__.py" | ||
[tool.ruff.format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
skip-magic-trailing-comma = false | ||
line-ending = "auto" | ||
docstring-code-format = false | ||
docstring-code-line-length = "dynamic" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. | ||
|
||
# This script should modify top level pyproject.toml to update the version of pyvespa | ||
# And modify vespa/__init__.py to update the version of pyvespa | ||
|
||
import sys | ||
import re | ||
from pathlib import Path | ||
import argparse | ||
|
||
PYPROJECT_TOML_PATH = Path(__file__).parent.parent.parent / "pyproject.toml" | ||
VERSION_FILE_PATH = Path(__file__).parent.parent / "__init__.py" | ||
|
||
|
||
def update_version(new_version: str): | ||
# Update version in pyproject.toml | ||
with open(PYPROJECT_TOML_PATH, "r") as f: | ||
content = f.read() | ||
new_content = re.sub(r'version = ".*"', f'version = "{new_version}"', content) | ||
with open(PYPROJECT_TOML_PATH, "w") as f: | ||
f.write(new_content) | ||
|
||
# Update version in vespacli/_version_generated.py | ||
with open(VERSION_FILE_PATH, "r") as f: | ||
content = f.read() | ||
new_content = re.sub( | ||
r'__version__ = ".*"', f'__version__ = "{new_version}"', content | ||
) | ||
with open(VERSION_FILE_PATH, "w") as f: | ||
f.write(new_content) | ||
print(f"Updated version to {new_version}") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Update pyvespa version") | ||
parser.add_argument( | ||
"-v", "--version", type=str, help="New version to set", required=True | ||
) | ||
args = parser.parse_args() | ||
update_version(args.version) | ||
sys.exit(0) |