Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VERSION.txt
3 changes: 3 additions & 0 deletions helloworld.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env python

"""Top-level script to invoke helloworld implementation."""

import sys
import helloworld.main

Expand Down
1 change: 1 addition & 0 deletions helloworld/VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1
5 changes: 5 additions & 0 deletions helloworld/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def __read_version_txt():
import pkgutil
return pkgutil.get_data('helloworld', 'VERSION.txt').decode('utf-8').strip()

__version__ = __read_version_txt()
17 changes: 17 additions & 0 deletions helloworld/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
"""Top-level implementation of the helloworld program."""

import argparse
import sys

import helloworld


parser = argparse.ArgumentParser(
description='A simple example program to print a friendly greeting.')
parser.add_argument('--version', action='version',
version='helloworld ' + helloworld.__version__)


def main(argv=None):
if argv is None:
argv = sys.argv

# The helloworld program doesn't expect any arguments.
# This just checks for the special --version and --help arguments and
# ensures the user hasn't passed any other unrecognized arguments.
parser.parse_args(argv[1:])

print("Hello, world")

return 0
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import sys
import io
import os.path
from setuptools import setup

VERSION_PATH = os.path.join(
os.path.dirname(__file__), 'helloworld/VERSION.txt')
with io.open(VERSION_PATH, 'r', encoding='utf-8') as f:
version = f.read().strip()

setup(
name = "helloworld", # what you want to call the archive/egg
version = "0.1",
version = version,
packages=["helloworld"], # top-level python modules you can import like
# 'import foo'
dependency_links = [], # custom links to a specific project
install_requires=[],
extras_require={}, # optional features that other packages can require
# like 'helloworld[foo]'
package_data = {},
package_data = {"helloworld": ["VERSION.txt"]},
author="David Barnett",
author_email = "davidbarnett2@gmail.com",
description = "The familiar example program in Python",
Expand Down