create setup.py and ttbp package

master
nathaniel smith 2017-11-20 18:48:32 -08:00
parent c44860dc72
commit 5763834132
13 changed files with 105 additions and 4 deletions

30
setup.py 100644
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
from setuptools import setup
setup(
name='ttbp',
version='0.10.0',
description='command line social blogging tool used on tilde.town',
url='https://github.com/modgethanc/ttbp',
author='~endorphant',
author_email='endorphant@tilde.town',
license='MIT',
classifiers=[
'Topic :: Artistic Software',
'License :: OSI Approved :: MIT License',
],
keywords='blog',
packages=['ttbp'],
install_requires = [
'inflect==0.2.5',
'mistune==0.8.1'
],
include_package_data = True,
entry_points = {
'console_scripts': [
'feels = ttbp.ttbp:start',
'ttbp = ttbp.ttbp:start',
]
},
)

0
ttbp/__init__.py 100644
View File

69
ttbp/chatter.py 100644
View File

@ -0,0 +1,69 @@
import json
import os
import random
DEFAULT_LANG = {
"greet":[
"hi",
"hey",
"howdy",
"good morning",
"good afternoon",
"good day",
"good evening",
"welcome back",
"nice to see you"
],
"bye":[
"see you later, space cowboy",
"bye, townie",
"until next time, friend",
"come back whenever"
],
"friend":[
"friend",
"pal",
"buddy",
"townie"
],
"months":{
"01":"january",
"02":"february",
"03":"march",
"04":"april",
"05":"may",
"06":"june",
"07":"july",
"08":"august",
"09":"september",
"10":"october",
"11":"november",
"12":"december"
}
}
if os.path.exists("/home/endorphant/lib/python/chatterlib.json"):
with open("/home/endorphant/lib/python/chatterlib.json", 'r') as f:
LANG = json.load(f)
else:
LANG = DEFAULT_LANG
def say(keyword):
'''
takes a keyword and randomly returns from language dictionary to match that keyword
returns None if keyword doesn't exist
TODO: validate keyword?
'''
return random.choice(LANG.get(keyword))
def month(num):
'''
takes a MM and returns lovercase full name of that month
TODO: validate num?
'''
return LANG["months"].get(num)

View File

@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
the complete codebase is available at: the complete codebase is available at:
https://github.com/modgethanc/ttbp https://github.com/modgethanc/ttbp
''' '''
from __future__ import absolute_import
import os import os
import random import random
@ -41,12 +42,13 @@ import json
from email.mime.text import MIMEText; from email.mime.text import MIMEText;
import re import re
import core
import chatter
import inflect import inflect
import util
__version__ = "0.9.2" from . import core
from . import chatter
from . import util
__version__ = "0.10.0"
__author__ = "endorphant <endorphant@tilde.town)" __author__ = "endorphant <endorphant@tilde.town)"
## system globals ## system globals