Skip to content

Commit

Permalink
Merge pull request #77 from jazzband/modernize-setupcfg
Browse files Browse the repository at this point in the history
modernize setup.cfg and pyproject.toml
  • Loading branch information
shimizukawa authored Mar 8, 2021
2 parents 16dcd4a + 66dc1fe commit 7b1b735
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 56 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGES
General:

* #76 fix test failing on django-dev with py36,py37
* #77 Mondernize setup.cfg and pyproject.toml

Bug Fixes:

Expand Down
1 change: 1 addition & 0 deletions dev-requires.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ setuptools
wheel
setuptools_scm
tox>=3.5
build
-e ./
20 changes: 14 additions & 6 deletions django_redshift_backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
try: # py38 or later
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version("package-name")
except PackageNotFoundError:
# package is not installed
pass
except ImportError: # py36, py37
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
10 changes: 9 additions & 1 deletion doc/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Setup development environment
* Requires supported Python version
* do setup under django-redshift-backend.git repository root as::

$ pip install -U pip setuptools wheel setuptools_scm
$ pip install -U pip setuptools
$ pip install -r dev-requires.txt

Testing
Expand Down Expand Up @@ -51,6 +51,14 @@ Pull Request
* https://github.com/jazzband/django-redshift-backend/pulls


Build package
=============

Use build::

$ build


Releasing
=========

Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]

[tool.setuptools_scm]
# this empty section means: use_scm_version=True
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"

47 changes: 47 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
[metadata]
name = django-redshift-backend
url= https://github.com/jazzband/django-redshift-backend
author = shimizukawa
author_email = [email protected]
license = Apache Software License
license_file = LICENSE
description = Redshift database backend for Django
long_description = file: README.rst, CHANGES.rst
long_description_content_type = text/x-rst
keywords = django, redshift
classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: Apache Software License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Framework :: Django
Framework :: Django :: 2.2
Framework :: Django :: 3.0
Framework :: Django :: 3.1
Intended Audience :: Developers
Environment :: Plugins
Topic :: Software Development :: Libraries :: Python Modules
project_urls =
Documentation = https://django-redshift-backend.readthedocs.io/
Release notes = https://django-redshift-backend.readthedocs.io/en/master/changes.html
Source = https://github.com/jazzband/django-redshift-backend
Tracker = https://github.com/jazzband/django-redshift-backend/issues

[options]
python_requires = >=3.6, <4
packages = find:
include_package_data = false
zip_safe = false
install_requires =
django
setup_requires =
setuptools_scm

[options.extras_require]
psycopg2-binary = psycopg2-binary
psycopg2 = psycopg2

[wheel]
universal = 1

Expand Down
51 changes: 2 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
from setuptools import setup, find_packages
import os
from setuptools import setup

requires = [
'django',
]


def read(filename):
fpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)
with open(fpath) as f:
return f.read()


setup(
name='django-redshift-backend',
setup_requires=['setuptools_scm'],
use_scm_version=True,
packages=find_packages(),
url='https://github.com/jazzband/django-redshift-backend',
license='Apache Software License',
author='shimizukawa',
author_email='[email protected]',
description='Redshift database backend for Django',
long_description=read('README.rst') + read('CHANGES.rst'),
long_description_content_type='text/x-rst',
install_requires=requires,
extra_requires={
'psycopg2-binary': ['psycopg2-binary'],
'psycopg2': ['psycopg2'],
},
python_requires='>=3.6, <4',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'Environment :: Plugins',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
setup()

0 comments on commit 7b1b735

Please sign in to comment.