Skip to content

Commit

Permalink
setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ablx committed Nov 17, 2017
1 parent 291c49a commit 9b5ed7b
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 4 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion jobimtext-api/jobimtext.py → jobimtextapi/jobimtext.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys
import hammock
from responses import *

from jobimtextapi.responses import *


class JoBimText():
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions jobimtextapi/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = 1
112 changes: 112 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine

import io
import os
import sys
from shutil import rmtree

from setuptools import find_packages, setup, Command

# Package meta-data.
NAME = 'jobimtextapi'
DESCRIPTION = 'Python API for JoBimText'
URL = 'https://github.com/ablx/jobimtextapi/'
EMAIL = '[email protected]'
AUTHOR = 'ablx'

# What packages are required for this module to be executed?
REQUIRED = [
'hammock', 'requests'
]

# The rest you shouldn't have to touch too much :)
# ------------------------------------------------
# Except, perhaps the License and Trove Classifiers!
# If you do change the License, remember to change the Trove Classifier for that!

here = os.path.abspath(os.path.dirname(__file__))

# Import the README and use it as the long-description.
# Note: this will only work if 'README.rst' is present in your MANIFEST.in file!
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = '\n' + f.read()

# Load the package's version.py module as a dictionary.
about = {}
with open(os.path.join(here, NAME, 'version.py')) as f:
exec(f.read(), about)


class UploadCommand(Command):
"""Support setup.py upload."""

description = 'Build and publish the package.'
user_options = []

@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except OSError:
pass

self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))

self.status('Uploading the package to PyPi via Twine…')
os.system('twine upload dist/*')

sys.exit()


# Where the magic happens:
setup(
name=NAME,
version=about['__version__'],
description=DESCRIPTION,
long_description=long_description,
author=AUTHOR,
author_email=EMAIL,
url=URL,
packages=find_packages(exclude=('tests',)),
# If your package is a single module, use this instead of 'packages':
# py_modules=['mypackage'],

# entry_points={
# 'console_scripts': ['mycli=mymodule:cli'],
# },
install_requires=REQUIRED,
include_package_data=True,
license='MIT',
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
],
# $ setup.py publish support.
cmdclass={
'upload': UploadCommand,
},
)
Empty file removed tests/__init__.py
Empty file.
8 changes: 5 additions & 3 deletions tests/test_jobimtext.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import unittest
from jobimtext import JoBimText
import sys
import os

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from jobimtextapi.jobimtext import JoBimText
import requests
from pprint import pprint as pp


class TestJoBimText(unittest.TestCase):
Expand Down Expand Up @@ -81,7 +84,6 @@ def test_sense_cuis(self):
resp = self.api.sense_cuis('mouse', 'NN', holingtype='stanford')
assert not resp.has_error()


def test_similar_score(self):
resp = self.api.similar_score('mouse', 'NN', 'cat', 'NN')
assert resp.score > 70
Expand Down

0 comments on commit 9b5ed7b

Please sign in to comment.