fix mypy errors
This commit is contained in:
@@ -5,11 +5,17 @@
|
|||||||
imports = [
|
imports = [
|
||||||
inputs.treefmt-nix.flakeModule
|
inputs.treefmt-nix.flakeModule
|
||||||
];
|
];
|
||||||
perSystem = { pkgs, ... }: {
|
perSystem = { self', pkgs, ... }: {
|
||||||
treefmt.projectRootFile = "flake.nix";
|
treefmt.projectRootFile = "flake.nix";
|
||||||
treefmt.flakeCheck = true;
|
treefmt.flakeCheck = true;
|
||||||
treefmt.flakeFormatter = true;
|
treefmt.flakeFormatter = true;
|
||||||
treefmt.programs.shellcheck.enable = true;
|
treefmt.programs.shellcheck.enable = true;
|
||||||
|
|
||||||
|
treefmt.programs.mypy.enable = true;
|
||||||
|
treefmt.programs.mypy.directories = {
|
||||||
|
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.testDependencies;
|
||||||
|
};
|
||||||
|
|
||||||
treefmt.settings.formatter.nix = {
|
treefmt.settings.formatter.nix = {
|
||||||
command = "sh";
|
command = "sh";
|
||||||
options = [
|
options = [
|
||||||
@@ -38,4 +44,3 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
from types import ModuleType
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from . import admin, secrets, update
|
from . import admin, config, secrets, update
|
||||||
from .errors import ClanError
|
from .errors import ClanError
|
||||||
from .ssh import cli as ssh_cli
|
from .ssh import cli as ssh_cli
|
||||||
|
|
||||||
argcomplete = None
|
argcomplete: Optional[ModuleType] = None
|
||||||
try:
|
try:
|
||||||
import argcomplete
|
import argcomplete # type: ignore[no-redef]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
config = None
|
|
||||||
try:
|
|
||||||
from . import config
|
|
||||||
except ImportError: # jsonschema not installed
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
# this will be the entrypoint under /bin/clan (see pyproject.toml config)
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
@@ -26,7 +22,6 @@ def main() -> None:
|
|||||||
parser_admin = subparsers.add_parser("admin", help="administrate a clan")
|
parser_admin = subparsers.add_parser("admin", help="administrate a clan")
|
||||||
admin.register_parser(parser_admin)
|
admin.register_parser(parser_admin)
|
||||||
|
|
||||||
if config:
|
|
||||||
parser_config = subparsers.add_parser("config", help="set nixos configuration")
|
parser_config = subparsers.add_parser("config", help="set nixos configuration")
|
||||||
config.register_parser(parser_config)
|
config.register_parser(parser_config)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
, black
|
, black
|
||||||
, bubblewrap
|
, bubblewrap
|
||||||
, installShellFiles
|
, installShellFiles
|
||||||
, mypy
|
|
||||||
, nix
|
, nix
|
||||||
, openssh
|
, openssh
|
||||||
, pytest
|
, pytest
|
||||||
@@ -31,7 +30,6 @@ let
|
|||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-subprocess
|
pytest-subprocess
|
||||||
mypy
|
|
||||||
openssh
|
openssh
|
||||||
stdenv.cc
|
stdenv.cc
|
||||||
];
|
];
|
||||||
@@ -60,16 +58,7 @@ python3.pkgs.buildPythonPackage {
|
|||||||
];
|
];
|
||||||
propagatedBuildInputs = dependencies;
|
propagatedBuildInputs = dependencies;
|
||||||
|
|
||||||
passthru.tests = {
|
passthru.tests.clan-pytest = runCommand "clan-tests"
|
||||||
clan-mypy = runCommand "clan-mypy" { } ''
|
|
||||||
export CLAN_OPTIONS_FILE="${CLAN_OPTIONS_FILE}"
|
|
||||||
cp -r ${source} ./src
|
|
||||||
chmod +w -R ./src
|
|
||||||
cd ./src
|
|
||||||
${checkPython}/bin/mypy .
|
|
||||||
touch $out
|
|
||||||
'';
|
|
||||||
clan-pytest = runCommand "clan-tests"
|
|
||||||
{
|
{
|
||||||
nativeBuildInputs = [ age zerotierone bubblewrap sops nix openssh rsync stdenv.cc ];
|
nativeBuildInputs = [ age zerotierone bubblewrap sops nix openssh rsync stdenv.cc ];
|
||||||
} ''
|
} ''
|
||||||
@@ -80,7 +69,6 @@ python3.pkgs.buildPythonPackage {
|
|||||||
NIX_STATE_DIR=$TMPDIR/nix ${checkPython}/bin/python -m pytest -s ./tests
|
NIX_STATE_DIR=$TMPDIR/nix ${checkPython}/bin/python -m pytest -s ./tests
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
passthru.devDependencies = [
|
passthru.devDependencies = [
|
||||||
ruff
|
ruff
|
||||||
@@ -89,6 +77,8 @@ python3.pkgs.buildPythonPackage {
|
|||||||
wheel
|
wheel
|
||||||
] ++ testDependencies;
|
] ++ testDependencies;
|
||||||
|
|
||||||
|
passthru.testDependencies = testDependencies;
|
||||||
|
|
||||||
makeWrapperArgs = [
|
makeWrapperArgs = [
|
||||||
"--set CLAN_FLAKE ${self}"
|
"--set CLAN_FLAKE ${self}"
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user