diff --git a/Pipfile b/Pipfile deleted file mode 100644 index f51e95a..0000000 --- a/Pipfile +++ /dev/null @@ -1,15 +0,0 @@ -[[source]] -url = "https://pypi.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -lark-parser = "*" - -[dev-packages] -mypy = "*" -furo = "*" -sphinx = "*" - -[requires] -python_version = "3.9" diff --git a/default.nix b/default.nix index 85c69cd..1090e42 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,20 @@ -{ buildPythonApplication, nix-gitignore, lark-parser, click }: +{ python, buildPythonApplication, nix-gitignore, lark-parser, click, mypy }: +let + pythonBuildInputs = [ click lark-parser ]; + pythonWithBuildInputs = python.withPackages (_: pythonBuildInputs); +in buildPythonApplication { pname = "agtest"; version = "0.1.0"; - propagatedBuildInputs = [ lark-parser click ]; + propagatedBuildInputs = pythonBuildInputs; + checkInputs = [ mypy ]; src = nix-gitignore.gitignoreSource [] ./.; + + checkPhase = '' + (cd src; mypy \ + --python-executable ${pythonWithBuildInputs}/bin/python \ + --strict agtest) + ''; } diff --git a/src/agtest/driver.py b/src/agtest/driver.py index 85cd2c6..a8e54cc 100644 --- a/src/agtest/driver.py +++ b/src/agtest/driver.py @@ -1,7 +1,6 @@ -import importlib import json -import os import sys +from typing import TextIO from io import StringIO from os import path @@ -20,7 +19,7 @@ p = lark.Lark(open(grammar_path).read(), start="program", parser="lalr") @click.command() @click.option("--show-only", is_flag=True) @click.argument("input", type=click.File("r")) -def run(input, show_only): +def run(input: TextIO, show_only: bool) -> None: data = input.read() input.close()