Skip to content

Commit

Permalink
chore: run black
Browse files Browse the repository at this point in the history
  • Loading branch information
numb3r3 committed Dec 29, 2023
1 parent 1fd6525 commit 69b22ef
Show file tree
Hide file tree
Showing 40 changed files with 1,342 additions and 1,339 deletions.
6 changes: 3 additions & 3 deletions client/clip_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
__version__ = '0.8.4'
__version__ = "0.8.4"

import os

from clip_client.client import Client

if 'NO_VERSION_CHECK' not in os.environ:
if "NO_VERSION_CHECK" not in os.environ:
from clip_client.helper import is_latest_version

is_latest_version(github_repo='clip-as-service')
is_latest_version(github_repo="clip-as-service")
434 changes: 217 additions & 217 deletions client/clip_client/client.py

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions client/clip_client/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,30 @@

def _version_check(package: str = None, github_repo: str = None):
try:

if not package:
package = vars(sys.modules[__name__])['__package__']
package = vars(sys.modules[__name__])["__package__"]
if not github_repo:
github_repo = package

cur_ver = Version(pkg_resources.get_distribution(package).version)
req = Request(
f'https://pypi.python.org/pypi/{package}/json',
headers={'User-Agent': 'Mozilla/5.0'},
f"https://pypi.python.org/pypi/{package}/json",
headers={"User-Agent": "Mozilla/5.0"},
)
with urlopen(
req, timeout=1
) as resp: # 'with' is important to close the resource after use
j = json.load(resp)
releases = j.get('releases', {})
releases = j.get("releases", {})
latest_release_ver = max(
Version(v) for v in releases.keys() if '.dev' not in v
Version(v) for v in releases.keys() if ".dev" not in v
)
if cur_ver < latest_release_ver:
print(
Panel(
f'You are using [b]{package} {cur_ver}[/b], but [bold green]{latest_release_ver}[/] is available. '
f'You may upgrade it via [b]pip install -U {package}[/b]. [link=https://github.com/jina-ai/{github_repo}/releases]Read Changelog here[/link].',
title=':new: New version available!',
f"You are using [b]{package} {cur_ver}[/b], but [bold green]{latest_release_ver}[/] is available. "
f"You may upgrade it via [b]pip install -U {package}[/b]. [link=https://github.com/jina-ai/{github_repo}/releases]Read Changelog here[/link].",
title=":new: New version available!",
width=50,
)
)
Expand Down
112 changes: 56 additions & 56 deletions client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,89 @@
from setuptools import setup

if sys.version_info < (3, 7, 0):
raise OSError(f'CLIP-as-service requires Python >=3.7, but yours is {sys.version}')
raise OSError(f"CLIP-as-service requires Python >=3.7, but yours is {sys.version}")

try:
pkg_name = 'clip-client'
pkg_name = "clip-client"
libinfo_py = path.join(
path.dirname(__file__), pkg_name.replace('-', '_'), '__init__.py'
path.dirname(__file__), pkg_name.replace("-", "_"), "__init__.py"
)
libinfo_content = open(libinfo_py, 'r', encoding='utf8').readlines()
version_line = [l.strip() for l in libinfo_content if l.startswith('__version__')][
libinfo_content = open(libinfo_py, "r", encoding="utf8").readlines()
version_line = [l.strip() for l in libinfo_content if l.startswith("__version__")][
0
]
exec(version_line) # gives __version__
except FileNotFoundError as ex:
__version__ = '0.0.0'
__version__ = "0.0.0"

try:
with open('../README.md', encoding='utf8') as fp:
with open("../README.md", encoding="utf8") as fp:
_long_description = fp.read()
except FileNotFoundError:
_long_description = ''
_long_description = ""

setup(
name=pkg_name,
packages=find_packages(),
version=__version__,
include_package_data=True,
description='Embed images and sentences into fixed-length vectors via CLIP',
author='Jina AI',
author_email='[email protected]',
license='Apache 2.0',
url='https://github.com/jina-ai/clip-as-service',
download_url='https://github.com/jina-ai/clip-as-service/tags',
description="Embed images and sentences into fixed-length vectors via CLIP",
author="Jina AI",
author_email="[email protected]",
license="Apache 2.0",
url="https://github.com/jina-ai/clip-as-service",
download_url="https://github.com/jina-ai/clip-as-service/tags",
long_description=_long_description,
long_description_content_type='text/markdown',
long_description_content_type="text/markdown",
zip_safe=False,
setup_requires=['setuptools>=18.0', 'wheel'],
setup_requires=["setuptools>=18.0", "wheel"],
install_requires=[
'jina>=3.12.0',
'docarray[common]>=0.19.0,<0.30.0',
'packaging',
"jina>=3.12.0",
"docarray[common]>=0.19.0,<0.30.0",
"packaging",
],
extras_require={
'test': [
'pytest',
'pytest-timeout',
'pytest-mock',
'pytest-asyncio',
'pytest-cov',
'pytest-repeat',
'pytest-reraise',
'mock',
'pytest-custom_exit_code',
'black',
"test": [
"pytest",
"pytest-timeout",
"pytest-mock",
"pytest-asyncio",
"pytest-cov",
"pytest-repeat",
"pytest-reraise",
"mock",
"pytest-custom_exit_code",
"black",
],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Unix Shell',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Topic :: Database :: Database Engines/Servers',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
'Topic :: Scientific/Engineering :: Image Recognition',
'Topic :: Multimedia :: Video',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Unix Shell",
"Environment :: Console",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
"Topic :: Scientific/Engineering :: Image Recognition",
"Topic :: Multimedia :: Video",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
],
project_urls={
'Documentation': 'https://clip-as-service.jina.ai',
'Source': 'https://github.com/jina-ai/clip-as-service/',
'Tracker': 'https://github.com/jina-ai/clip-as-service/issues',
"Documentation": "https://clip-as-service.jina.ai",
"Source": "https://github.com/jina-ai/clip-as-service/",
"Tracker": "https://github.com/jina-ai/clip-as-service/issues",
},
keywords='jina openai clip deep-learning cross-modal multi-modal neural-search',
keywords="jina openai clip deep-learning cross-modal multi-modal neural-search",
)
Loading

0 comments on commit 69b22ef

Please sign in to comment.