check on build
This commit is contained in:
parent
a8ce29a3a8
commit
7d1795cd89
3 changed files with 15 additions and 20 deletions
15
Pipfile
15
Pipfile
|
@ -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"
|
15
default.nix
15
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)
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue