Skip to content

Commit

Permalink
reallow python -m buzzword coz it's so nice
Browse files Browse the repository at this point in the history
  • Loading branch information
interrogator committed May 5, 2020
1 parent f1a628b commit 26d5c87
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
5 changes: 0 additions & 5 deletions bin/buzzword-create

This file was deleted.

28 changes: 28 additions & 0 deletions buzzword/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python

"""
python -m buzzword
python -m buzzword runserver
python -m buzzword reload
etc
"""
import os
import sys

import pathlib

from django.core.management import execute_from_command_line

manage_dir = pathlib.Path(__file__).parent.parent.absolute()
os.chdir(manage_dir)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "buzzword.settings")

if len(sys.argv) == 1 and "__main__.py" in sys.argv[0]:
argv = ["manage.py", "runserver"]
elif len(sys.argv) > 1:
argv = ["manage.py", *sys.argv[1:]]
else:
argv = sys.argv

execute_from_command_line(argv)
4 changes: 2 additions & 2 deletions explorer/parts/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def configure_buzzword():
trues = {"1", "true", "True", "Y", "y", "yes", True}
env_path = os.path.abspath(".env")
if not os.path.isfile(env_path):
raise ValueError(f'Please configure {env_path}')
raise ValueError(f"Please configure {env_path}")
load_dotenv(dotenv_path=env_path)
drop_columns = os.getenv("BUZZWORD_DROP_COLUMNS")
if drop_columns:
Expand All @@ -40,5 +40,5 @@ def configure_buzzword():
max_dataset_rows=max_dataset_rows,
drop_columns=drop_columns,
table_size=table_size,
load_layouts=os.getenv("BUZZWORD_LOAD_LAYOUTS", True) in trues
load_layouts=os.getenv("BUZZWORD_LOAD_LAYOUTS", True) in trues,
)
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ def read(fname):
zip_safe=False,
packages=["buzzword", "docs", "explorer/parts"],
package_dir={"explorer/parts/assets": "explorer/parts/assets", "docs": "docs"},
scripts=["bin/buzzword", "bin/buzzword-create"],
package_data={"buzzword/parts": assets, "docs": docs},
data_files=[("explorer/parts/assets", assets), ("docs", docs)],
author_email="daniel.mcdonald@uzh.ch",
license="MIT",
keywords=[],
keywords=["nlp", "linguistics", "corpora"],
install_requires=[
"buzz>=3.0.10",
"buzz>=3.0.12",
"django==3.0.5",
"python-dotenv==0.10.3",
"django-plotly-dash==1.3.1",
Expand Down

0 comments on commit 26d5c87

Please sign in to comment.