Skip to content

Commit

Permalink
Merge pull request #24 from letuananh/dev
Browse files Browse the repository at this point in the history
version 0.1a2
  • Loading branch information
letuananh authored Jul 19, 2018
2 parents 9d2d7b9 + 29234e4 commit 951c85b
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 17 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include README.md
include CHANGES.md
include requirements*.txt
recursive-include yawlib/data *.json
recursive-include yawlib/glosswordnet/script *.sql
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ Note: Extract the glosstag folder and sqlite-30.db to ~/wordnet. The directory s

Go to yawlib folder, execute the config script and then run wntk.sh to generate the glosstab DB file.
```
cd ~/workspace
git clone https://github.com/letuananh/yawlib
cd yawlib
bash config.sh
./wntk.sh -c
# create virtual environment
python3 -m venv yawlib_py3
. yawlib_py3/bin/activate
# install required packages
pip install -r requirements.txt
pip install -r requirements-optional.txt
# to show information
python -m yawlib info
```
4 changes: 4 additions & 0 deletions logging.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"handlers": ["file_handler_important", "file_handler_verbose"],
"propagate": "no"
},
"chirptext": {
"level": "WARNING",
"handlers": ["file_handler_verbose"]
},
"puchikarui.puchikarui": {
"level": "WARNING",
"handlers": ["file_handler_verbose"]
Expand Down
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

pandoc --from=markdown --to=rst README.md -o README.rst
# pandoc --from=markdown --to=rst README.md -o README.rst
python3 setup.py sdist
3 changes: 2 additions & 1 deletion requirements-optional.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
flask
flask >= 1.0
django >= 2.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lxml
fuzzywuzzy
python-levenshtein
chirptext>=0.1a16
chirptext>=0.1a18
puchikarui>=0.1a1
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ def read(*filenames, **kwargs):
return sep.join(buf)


readme_file = 'README.rst' if os.path.isfile('README.rst') else 'README.md'
# readme_file = 'README.rst' if os.path.isfile('README.rst') else 'README.md'
readme_file = 'README.md'
long_description = read(readme_file)
pkg_info = {}
exec(read('yawlib/__version__.py'), pkg_info)


with open('requirements.txt', 'r') as infile:
requirements = infile.read().splitlines()
print(requirements)


setup(
name='yawlib', # package file name (<package-name>-version.tar.gz)
version=pkg_info['__version__'],
Expand All @@ -65,11 +71,12 @@ def read(*filenames, **kwargs):
keywords="princeton wordnet glosstag omw",
license=pkg_info['__license__'],
author=pkg_info['__author__'],
tests_require=['lxml', 'fuzzywuzzy', 'python-levenshtein', 'chirptext>=0.1a16', 'puchikarui'],
install_requires=['lxml', 'fuzzywuzzy', 'python-levenshtein', 'chirptext>=0.1a16', 'puchikarui'],
tests_require=requirements,
install_requires=requirements,
author_email=pkg_info['__email__'],
description=pkg_info['__description__'],
long_description=long_description,
long_description_content_type='text/markdown',
packages=['yawlib',
'yawlib.glosswordnet',
'yawlib.yawol',
Expand Down
1 change: 1 addition & 0 deletions yawlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:license: MIT, see LICENSE for more details.
'''

from . import __version__ as version_info
from .__version__ import __author__, __email__, __copyright__, __maintainer__
from .__version__ import __credits__, __license__, __description__, __url__
from .__version__ import __version_major__, __version_long__, __version__, __status__
Expand Down
2 changes: 1 addition & 1 deletion yawlib/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
__url__ = "https://github.com/letuananh/yawlib"
__maintainer__ = "Le Tuan Anh"
__version_major__ = "0.1"
__version__ = "{}a1".format(__version_major__)
__version__ = "{}a2".format(__version_major__)
__version_long__ = "{} - Alpha".format(__version_major__)
__status__ = "Prototype"
5 changes: 5 additions & 0 deletions yawlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def home_dir():
return yhome if yhome else __yawlib_home


def config_file_path():
''' get config location '''
return _get_config_manager().locate_config()


def get_file(file_key):
_config = read_config()
return _config.get(file_key).format(YAWLIB_HOME=home_dir())
Expand Down
23 changes: 16 additions & 7 deletions yawlib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

from .models import SynsetID, SynsetCollection
from yawlib import YLConfig
from yawlib import config
from yawlib import version_info
from yawlib.glosswordnet.gwnmodels import GlossedSynset
from yawlib import GWordnetXML as GWNXML
from yawlib import GWordnetSQLite as GWNSQL
Expand Down Expand Up @@ -325,12 +327,19 @@ def add_wordnet_config(parser):
def show_info(cli, args):
''' Show configuration information
'''
print("GlossWordNet XML folder: %s" % args.gloss_xml)
print("GlossWordNet SQlite DB : %s" % args.glossdb)
print("Princeton WordnetSQL DB: %s" % args.wnsql)
print("OMW DB : %s" % args.omw)
print("Use mockup data : %s" % args.mockup)
report = TextReport(args.output) if 'output' in args else TextReport()
report.header("{} - Version: {}".format(version_info.__description__, version_info.__version__), level='h0')
report.header("Basic Configuration")
report.print("YAWLIB_HOME : {}".format(config.home_dir()))
report.print("Configuration file: {}".format(config.config_file_path()))
report.header("Data files")
report.print("GlossWordNet XML folder: %s" % args.gloss_xml)
report.print("GlossWordNet SQlite DB : %s" % args.glossdb)
report.print("Princeton WordnetSQL DB: %s" % args.wnsql)
report.print("OMW DB : %s" % args.omw)
report.header("Other settings")
report.print("Use mockup data : %s" % args.mockup)
if args.verbose:
print("--verbose : %s" % args.verbose)
report.print("--verbose : %s" % args.verbose)
if args.quiet:
print("--quiet : %s" % args.quiet)
report.print("--quiet : %s" % args.quiet)
1 change: 1 addition & 0 deletions yawlib/wntk.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def main():

# show info
task = app.add_task('info', func=show_info)
task.add_argument('-o', '--output', help='Write information to a text file')
# run app
app.run()

Expand Down

0 comments on commit 951c85b

Please sign in to comment.