Skip to content

Commit a5f0af2

Browse files
committed
Rework of __init__.py ; Add __about__.py and __main__.py
1 parent 239cde9 commit a5f0af2

File tree

5 files changed

+49
-16
lines changed

5 files changed

+49
-16
lines changed

setup.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
from setuptools import setup, find_packages
55

6-
import src.clikraken as clikraken
7-
86
# I really prefer Markdown to reStructuredText. PyPi does not. This allows me
97
# to have things how I'd like, but not throw complaints when people are trying
108
# to install the package and they don't have pypandoc or the README in the
@@ -15,18 +13,23 @@
1513
except (IOError, ImportError):
1614
long_description = open('README.md').read()
1715

16+
about = {}
17+
with open('src/clikraken/__about__.py') as f:
18+
exec(f.read(), about)
19+
# now we have a about['__version__'] variable
20+
1821
setup(
19-
name='clikraken',
20-
version=clikraken.__version__,
22+
name=about['__title__'],
23+
version=about['__version__'],
2124
packages=find_packages('src'),
2225
package_dir={'': 'src'},
23-
author='Marc Gallet',
24-
author_email='[email protected]',
25-
license='Apache 2.0',
26-
description='Command-line client for the Kraken exchange',
26+
author=about['__author__'],
27+
author_email=about['__email__'],
28+
license=about['__license__'],
29+
description=about['__summary__'],
2730
long_description=long_description,
2831
include_package_data=True,
29-
url='https://github.com/zertrin/clikraken',
32+
url=about['__url__'],
3033
install_requires=[
3134
'krakenex>=0.1,<1.0',
3235
'arrow',
@@ -35,7 +38,7 @@
3538
],
3639
classifiers=[
3740
"Programming Language :: Python",
38-
"Development Status :: 3 - Alpha",
41+
"Development Status :: 4 - Beta",
3942
"License :: OSI Approved :: Apache Software License",
4043
"Operating System :: OS Independent",
4144
"Programming Language :: Python :: 3",

src/clikraken/__about__.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
__all__ = [
2+
"__title__", "__summary__", "__url__", "__version__",
3+
"__author__", "__email__", "__license__",
4+
]
5+
6+
__title__ = "clikraken"
7+
__summary__ = "Command-line client for the Kraken exchange"
8+
__url__ = "https://zertrin.org/projects/clikraken/"
9+
10+
__version__ = '0.4.0-alpha.1'
11+
12+
__author__ = "Marc Gallet"
13+
__email__ = "[email protected]"
14+
15+
__license__ = "Apache License, Version 2.0"

src/clikraken/__init__.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
# -*- coding: utf-8 -*-
1+
from clikraken.__about__ import (
2+
__title__, __summary__, __url__, __version__,
3+
__author__, __email__, __license__,
4+
)
25

3-
__version__ = '0.3.2'
6+
__all__ = [
7+
"__title__", "__summary__", "__url__", "__version__",
8+
"__author__", "__email__", "__license__",
9+
]

src/clikraken/__main__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Entrypoint module, in case you use `python -mnameless`.
3+
4+
Why does this file exist, and why __main__? For more info, read:
5+
- https://www.python.org/dev/peps/pep-0338/
6+
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
7+
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
8+
"""
9+
10+
from clikraken.clikraken import main
11+
12+
if __name__ == "__main__":
13+
main()

src/clikraken/clikraken.py

-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ def main():
3030

3131
if callable(func):
3232
func(args)
33-
34-
35-
if __name__ == "__main__":
36-
main()

0 commit comments

Comments
 (0)