check on build

This commit is contained in:
Michael Zhang 2021-10-01 13:44:08 -05:00
parent a8ce29a3a8
commit 7d1795cd89
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
3 changed files with 15 additions and 20 deletions

15
Pipfile
View file

@ -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"

View file

@ -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)
'';
}

View file

@ -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()