Skip to content

Commit 2bb224e

Browse files
author
Sam Partee
authored
PyPI Infrastructure (#38)
PyPI release infrastructure
1 parent 3c955f7 commit 2bb224e

File tree

9 files changed

+111
-7
lines changed

9 files changed

+111
-7
lines changed

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: deploy-release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [master]
7+
8+
jobs:
9+
build_release:
10+
if: |
11+
${{ github.event.pull_request.merged == true }}
12+
&& ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
13+
name: Build Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Python 3.10
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.10"
21+
22+
- name: check-version
23+
run: echo ::set_output name=version::$(python setup.py --version)
24+
25+
- name: create python package
26+
run: python setup.py bdist_wheel
27+
28+
- name: Create Release
29+
uses: ncipollo/release-action@v1
30+
with:
31+
artifacts: "dist/*"
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
draft: false
34+
generateReleaseNotes: true
35+
tag: v${{ steps.check-version.outputs.version }}
36+
commit: master
37+
38+
- uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
user: __token__
41+
password: ${{ secrets.PYPI }}
42+
repository_url: https://test.pypi.org/legacy/

redisvl/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
from redisvl.version import __version__
4+
5+
all = ["__version__"]

redisvl/cli/index.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from redisvl.utils.connection import get_redis_connection
1010
from redisvl.utils.utils import convert_bytes
1111

12-
logger = get_logger(__name__)
13-
12+
logger = get_logger("[RedisVL]")
1413

1514
class Index:
1615
usage = "\n".join(

redisvl/cli/log.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
# constants for logging
77
coloredlogs.DEFAULT_DATE_FORMAT = "%H:%M:%S"
88
coloredlogs.DEFAULT_LOG_FORMAT = (
9-
"%(asctime)s %(hostname)s %(name)s[%(process)d] %(levelname)s %(message)s"
9+
"%(asctime)s %(name)s %(levelname)s %(message)s"
1010
)
1111

12-
1312
def get_logger(name, log_level="info", fmt=None):
1413
"""Return a logger instance"""
1514

redisvl/cli/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import sys
33

44
from redisvl.cli.index import Index
5+
from redisvl.cli.version import Version
56
from redisvl.cli.log import get_logger
67

78
logger = get_logger(__name__)
@@ -12,6 +13,7 @@ def _usage():
1213
"rvl <command> [<args>]\n",
1314
"Commands:",
1415
"\tindex Index manipulation (create, delete, etc.)",
16+
"\tversion Obtain the version of RedisVL",
1517
]
1618
return "\n".join(usage) + "\n"
1719

@@ -37,3 +39,7 @@ def __init__(self):
3739
def index(self):
3840
Index()
3941
exit(0)
42+
43+
def version(self):
44+
Version()
45+
exit(0)

redisvl/cli/version.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
import argparse
3+
from argparse import Namespace
4+
5+
from redisvl import __version__
6+
from redisvl.cli.log import get_logger
7+
logger = get_logger("[RedisVL]")
8+
9+
10+
class Version:
11+
usage = "\n".join(
12+
[
13+
"rvl version [<args>]\n",
14+
"\n",
15+
]
16+
)
17+
18+
def __init__(self):
19+
parser = argparse.ArgumentParser(usage=self.usage)
20+
parser.add_argument(
21+
"-s", "--short", help="Print only the version number", action="store_true"
22+
)
23+
24+
args = parser.parse_args(sys.argv[2:])
25+
self.version(args)
26+
27+
def version(self, args: Namespace):
28+
if args.short:
29+
print(__version__)
30+
else:
31+
logger.info(f"RedisVL version {__version__}")

redisvl/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.0.1"

setup.cfg

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[metadata]
2+
name = redisvl
3+
description = Python client library and CLI for using Redis as a vector database
4+
long_description = file: README.md
5+
long_description_content_type=text/markdown
6+
7+
url = https://github.com/RedisVentures/redisvl
8+
project_urls =
9+
Source = https://github.com/RedisVentures/redisvl
10+
Documentation = https://www.redisvl.com
11+
12+
author = Redis Inc.
13+
contact = Sam Partee
14+
contact_email = sam.partee@redis.com
15+
license = MIT
16+
keywords = ai, redis, redis-client, vector-database, vector-search
17+
classifiers =
18+
Programming Language :: Python :: 3.7
19+
Programming Language :: Python :: 3.8
20+
Programming Language :: Python :: 3.9
21+
Programming Language :: Python :: 3.10
22+
License :: OSI Approved :: MIT License

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ def read_dev_requirements():
2222

2323
setup(
2424
name="redisvl",
25-
description="Vector loading utility for Redis vector search",
26-
license="BSD-3-Clause",
27-
version="0.1.0",
25+
version="0.0.1",
2826
python_requires=">=3.7",
2927
install_requires=read_requirements(),
3028
extras_require=extras_require,
3129
packages=find_packages(),
30+
package_data = {"redisvl": ["requirements.txt", "requirements-dev.txt"]},
3231
zip_safe=False,
3332
entry_points={
3433
"console_scripts": [

0 commit comments

Comments
 (0)