From 47154d1f6c7bf0b1d7150c24ba18e2f1dffd9cc1 Mon Sep 17 00:00:00 2001 From: skuruppu Date: Tue, 26 May 2020 12:34:40 +1000 Subject: [PATCH] fix: update pypi package name (#454) * feat: add PyPI release support * fix: update package name Fixes #455 * deps: remove dependency on google-cloud * chore: added extra fields to setup.py * fix: single-source the version * fix: made setup.py consistent with client lib * fix: removed comment that no longer applies * fix: only support python version >=3.5 * add missing os import * add missing io import * fix README file extension * add missing pkg_resources import * fix import ordering Co-authored-by: larkee --- django_spanner/__init__.py | 3 ++- setup.py | 42 +++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/django_spanner/__init__.py b/django_spanner/__init__.py index b329da70db..b08f08f460 100644 --- a/django_spanner/__init__.py +++ b/django_spanner/__init__.py @@ -9,6 +9,7 @@ # do that. from uuid import uuid4 +import pkg_resources from django.db.models.fields import AutoField, Field # Monkey-patch google.DatetimeWithNanoseconds's __eq__ compare against datetime.datetime. from google.api_core.datetime_helpers import DatetimeWithNanoseconds @@ -18,7 +19,7 @@ from .lookups import register_lookups from .utils import check_django_compatability -__version__ = '2.2a0' +__version__ = pkg_resources.get_distribution("django-google-spanner").version check_django_compatability() register_expressions() diff --git a/setup.py b/setup.py index 2e7e7ca58a..e82752e4c4 100644 --- a/setup.py +++ b/setup.py @@ -4,30 +4,50 @@ # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd +import io +import os + from setuptools import find_packages, setup -version = '2.2a0' +# Package metadata. -install_requires = [ +name = "django-google-spanner" +description = "Bridge to enable using Django with Spanner." +version = "2.2a0" +# Should be one of: +# 'Development Status :: 3 - Alpha' +# 'Development Status :: 4 - Beta' +# 'Development Status :: 5 - Production/Stable' +release_status = "Development Status :: 3 - Alpha" +dependencies = [ 'sqlparse >= 0.3.0', - 'google-cloud >= 0.34.0', 'google-cloud-spanner >= 1.8.0', ] +extras = {} + + +# Setup boilerplate below this line. + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.md") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + setup( - name='django-spanner', - # Duplicate version here rather than using - # __import__('django_spanner').__version__ because that file imports - # django and google.cloud which may not be installed. + name=name, version=version, + description=description, + long_description=readme, author='Google LLC', author_email='cloud-spanner-developers@googlegroups.com', - description=('Bridge to enable using Django with Spanner.'), license='BSD', packages=find_packages(exclude=['tests']), - install_requires=install_requires, + install_requires=dependencies, + url="https://github.com/googleapis/python-spanner-django", classifiers=[ - 'Development Status :: 4 - Beta', + release_status, 'Environment :: Web Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD', @@ -40,4 +60,6 @@ 'Framework :: Django', 'Framework :: Django :: 2.2', ], + extras_require=extras, + python_requires=">=3.5", )