Skip to content
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

fix: update pypi package name #454

Merged
merged 13 commits into from May 26, 2020
3 changes: 2 additions & 1 deletion django_spanner/__init__.py
Expand Up @@ -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
Expand All @@ -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()
Expand Down
42 changes: 32 additions & 10 deletions setup.py
Expand Up @@ -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"
Copy link
Contributor Author

@skuruppu skuruppu May 19, 2020

Choose a reason for hiding this comment

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

I assume release-please will replace this version since this doesn't look like the version number it's proposing in #453

Copy link
Contributor

@timgraham timgraham May 20, 2020

Choose a reason for hiding this comment

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

That wouldn't be ideal. The README explains the typical versioning of database backends: "Use the version of django-spanner that corresponds to your version of Django. For example, django-spanner 2.2.x works with Django 2.2.y. (This is the only supported version at this time.)"

The specifics of the alternate proposal are unclear but I'd think the maintenance burden and user confusion about which version to use would be higher.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timgraham thanks for that info. But see my comment. There are lots of existing django packages that are published by Google and they all consistently use the versioning scheme used by release-please.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sem-var versioning is typical for other Django libraries that often support multiple versions of Django. Database backends are different. The best practice is to create separate release branches for each version of Django that's supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spoke to @larkee and they explained that the manual releasing won't be so painful.

re: versions

I would prefer semver for consistency with other packages. It also makes it easier for folks to pin on this library (e.g., google-django-spanner>=0.1.0,<1.0.0

@timgraham do you have any thoughts on the issue of pinning releases when you have non-semver versioning?

Copy link
Contributor

Choose a reason for hiding this comment

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

If using Django 2.2.x, use django-google-spanner>=2.2,<3.0. I think django-google-spanner==2.2.* would be equivalent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, @timgraham or @odeke-em could you update the README to explain why the versioning is the way it is? Please include links to the Django README as a reference.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I quoted is from the README in this repo.

# 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',
odeke-em marked this conversation as resolved.
Show resolved Hide resolved
'google-cloud-spanner >= 1.8.0',
]
extras = {}


# Setup boilerplate below this line.

package_root = os.path.abspath(os.path.dirname(__file__))
larkee marked this conversation as resolved.
Show resolved Hide resolved

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',
Expand All @@ -40,4 +60,6 @@
'Framework :: Django',
'Framework :: Django :: 2.2',
],
extras_require=extras,
python_requires=">=3.5",
)