Skip to content

Commit

Permalink
Fix script and format
Browse files Browse the repository at this point in the history
  • Loading branch information
glesica committed Feb 29, 2020
1 parent c6a6f09 commit 1c8ffdf
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ __pycache__/
*.ipynb_checkpoints/
.DS_Store
dist/
pyrs990.egg-info/

9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ help:
@echo analyze - run the type checker
@echo check - run tests
@echo check-fast - run non-network, non-subprocess tests
@echo clean - delete build artifacts
@echo format - format the code

analyze:
poetry run mypy . tests/

check:
check: analyze
poetry run pytest

check-fast:
check-fast: analyze
poetry run pytest -m "not network and not subprocess"

clean:
rm -rf dist/
rm -rf pyrs990.egg-info/

format:
poetry run isort --recursive --use-parentheses --trailing-comma -y -w 80
poetry run autoflake -r --in-place --remove-unused-variables .
Expand Down
28 changes: 27 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyrs990"
version = "0.1.2"
version = "0.1.3"
description = "A tool for fetching and filtering IRS 990 data."
authors = [
"George Lesica <george@lesica.com>",
Expand All @@ -22,7 +22,7 @@ classifiers = [
]

[tool.poetry.scripts]
pyrs990 = "pyrs990"
pyrs990 = "pyrs990.entry_point:entry_point"

[tool.poetry.dependencies]
python = "^3.8"
Expand All @@ -35,6 +35,7 @@ black = "^19.10b0"
pytest = "^5.3.5"
mypy = "^0.761"
isort = "^4.3.21"
autoflake = "^1.3.1"

[build-system]
requires = ["poetry>=0.12"]
Expand Down
21 changes: 2 additions & 19 deletions pyrs990/__main__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
import sys

from . import app
from ._options import Options, _log_levels, parser
from pyrs990.entry_point import entry_point

if __name__ == "__main__":
import logging

logging.basicConfig()
logger = logging.getLogger(__package__)

args = parser.parse_args(sys.argv[1:])

# We do this kinda janky like without the Options instance
# so that we can log inside the Options factory.
if args.log_level != "none":
logger.setLevel(_log_levels[args.log_level])

options = Options.from_args(args)

app.run(options)
entry_point()
22 changes: 22 additions & 0 deletions pyrs990/entry_point.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys

from . import app
from ._options import Options, _log_levels, parser


def entry_point():
import logging

logging.basicConfig()
logger = logging.getLogger(__package__)

args = parser.parse_args(sys.argv[1:])

# We do this kinda janky like without the Options instance
# so that we can log inside the Options factory.
if args.log_level != "none":
logger.setLevel(_log_levels[args.log_level])

options = Options.from_args(args)

app.run(options)

0 comments on commit 1c8ffdf

Please sign in to comment.