Housekeeping

main
mat ess 2023-08-13 12:59:32 -04:00
parent accdf78293
commit e985ca230c
7 changed files with 70 additions and 21 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ __pycache__
.*_cache
.pre-commit-config.yaml
.vscode
.coverage

View File

@ -26,5 +26,7 @@ total | 1
## todo
- [ ] roll with (dis)advantage
- [x] roll with (dis)advantage
- [ ] interactive rolling mode
- [x] print criticals
- [ ] use property testing

View File

@ -74,11 +74,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1691579266,
"narHash": "sha256-Ue2iaxU5VxwjXX6bWv/ElOl35O4+Rk630jBjMqQDRRs=",
"lastModified": 1691931346,
"narHash": "sha256-QLK0wLyJEnLU37CTBNnZBY6mNily7w8zeb34XyhSGh0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a14013769370b021e23200e7199d8cfaeb97098a",
"rev": "8f38b58c34bb759ae83a0581120fe2d7fa6bb539",
"type": "github"
},
"original": {
@ -133,11 +133,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1691397944,
"narHash": "sha256-4fa4bX3kPYKpEssgrFRxRCPVXczidArDeSWaUMSzQAU=",
"lastModified": 1691747570,
"narHash": "sha256-J3fnIwJtHVQ0tK2JMBv4oAmII+1mCdXdpeCxtIsrL2A=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e5588ddffd4c3578547a86ef40ec9a6fbdae2986",
"rev": "c5ac3aa3324bd8aebe8622a3fc92eeb3975d317a",
"type": "github"
},
"original": {

View File

@ -26,9 +26,10 @@
pre-commit.settings.hooks = {
autoflake.enable = true;
black.enable = true;
mypy.enable = true;
ruff.enable = true;
pyright.enable = true;
};
pre-commit.settings.settings.mypy.binPath = "${pkgs.python311Packages.mypy}/bin/mypy";
packages.default = package;
devShells.default = pkgs.mkShell {
shellHook = ''

30
justfile Normal file
View File

@ -0,0 +1,30 @@
build:
hatch build
typing:
hatch run typing:check
lint:
hatch run lint:check
fmt:
hatch run lint:fmt
# run all checks
test: typing lint
hatch run check
# create hatch envs
env:
#!/usr/bin/env fish
for env in (hatch env show --json | jq 'keys[]' --raw-output)
hatch env create $env
end
clean:
hatch clean
hatch env purge
rm -r .{mypy,pytest,ruff}_cache
rm -r dist
rm .coverage
fd __pycache__ --no-ignore --exec rm -r

View File

@ -30,7 +30,7 @@ Issues = "https://git.mat.services/mat/roll/issues"
Source = "https://git.mat.services/mat/roll"
[project.scripts]
roll = "roll.cli:roll"
roll = "roll.cli:cli"
[tool.hatch.version]
path = "roll/__about__.py"
@ -47,7 +47,7 @@ cov-report = [
"- coverage combine",
"coverage report",
]
cov = [
check = [
"test-cov",
"cov-report",
]
@ -55,15 +55,18 @@ cov = [
[[tool.hatch.envs.all.matrix]]
python = ["3.11"]
[tool.hatch.envs.typing]
extra-dependencies = ["mypy"]
[tool.hatch.envs.typing.scripts]
check = "mypy --install-types {args:roll tests}"
[tool.hatch.envs.lint]
detached = true
dependencies = [
"black>=23.1.0",
"pyright>=1.1.319",
"ruff>=0.0.243",
]
[tool.hatch.envs.lint.scripts]
typing = "pyright --project pyproject.toml {args:roll tests}"
style = [
"ruff {args:.}",
"black --check --diff {args:.}",
@ -73,19 +76,18 @@ fmt = [
"ruff --fix {args:.}",
"style",
]
all = [
check = [
"style",
"typing",
]
[tool.black]
target-version = ["py311"]
line-length = 120
skip-string-normalization = true
line-length = 100
# skip-string-normalization = true
[tool.ruff]
target-version = "py311"
line-length = 120
line-length = 100
select = [
"A",
"ARG",
@ -153,8 +155,21 @@ roll = ["roll", "*/roll/roll"]
tests = ["tests", "*/roll/tests"]
[tool.coverage.report]
show_missing = true
skip_empty = true
fail_under = 100
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
[tool.mypy]
pretty = true
strict = true
[[tool.mypy.overrides]]
module = "tests.*"
allow_untyped_defs = true
allow_incomplete_defs = true
check_untyped_defs = true

View File

@ -1,6 +1,6 @@
import sys
if __name__ == "__main__":
from roll.cli import roll
import sys
sys.exit(roll())
from roll.cli import cli
sys.exit(cli())