Skip to content

Commit 4de6461

Browse files
General code Improvements
1 parent 83c91c1 commit 4de6461

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

contentstack/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from contentstack.stack import Stack
1111
from .utility import Utils
1212

13-
__title__ = 'contentstack-python'
13+
__title__ = 'contentstack-delivery-python'
1414
__author__ = 'contentstack'
1515
__status__ = 'debug'
1616
__version__ = 'v1.8.1'

contentstack/stack.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
from contentstack.contenttype import ContentType
99
from contentstack.https_connection import HTTPSConnection
1010
from contentstack.image_transform import ImageTransform
11+
from contentstack import __author__
12+
from contentstack import __developer_email__
13+
from contentstack import __license__
14+
from contentstack import __version__
1115

12-
__author__ = "ishaileshmishra ([email protected])"
13-
__license__ = "MIT"
14-
__version__ = '1.8.1'
1516

1617
log = logging.getLogger(__name__)
1718
DEFAULT_HOST = 'cdn.contentstack.io'

setup.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,25 @@
44
# as the name and version) as well as which code files to include
55

66
import os
7+
import re
8+
import sys
79

810
try:
9-
from setuptools import setup
11+
from setuptools import setup, find_packages
1012
except ImportError:
1113
from distutils.core import setup
1214

15+
package = "contentstack"
16+
17+
def get_version(package):
18+
"""
19+
Return package version as listed in `__version__` in `init.py`.
20+
"""
21+
init_py = open(os.path.join(package, '__init__.py')).read()
22+
return re.search("^__version__ = ['\"]([^'\"]+)['\"]",
23+
init_py, re.MULTILINE).group(1)
24+
25+
1326
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
1427
long_description = readme.read()
1528

@@ -25,7 +38,7 @@
2538
type="process",
2639
created="09 Jun 2020",
2740
keywords="contentstack-python",
28-
version="1.8.1",
41+
version=get_version(package),
2942
author="Contentstack",
3043
3144
description="Contentstack is a headless CMS with an API-first approach.",

0 commit comments

Comments
 (0)