Housekeeping
parent
accdf78293
commit
e985ca230c
|
@ -5,3 +5,4 @@ __pycache__
|
||||||
.*_cache
|
.*_cache
|
||||||
.pre-commit-config.yaml
|
.pre-commit-config.yaml
|
||||||
.vscode
|
.vscode
|
||||||
|
.coverage
|
||||||
|
|
|
@ -26,5 +26,7 @@ total | 1
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
- [ ] roll with (dis)advantage
|
- [x] roll with (dis)advantage
|
||||||
- [ ] interactive rolling mode
|
- [ ] interactive rolling mode
|
||||||
|
- [x] print criticals
|
||||||
|
- [ ] use property testing
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -74,11 +74,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691579266,
|
"lastModified": 1691931346,
|
||||||
"narHash": "sha256-Ue2iaxU5VxwjXX6bWv/ElOl35O4+Rk630jBjMqQDRRs=",
|
"narHash": "sha256-QLK0wLyJEnLU37CTBNnZBY6mNily7w8zeb34XyhSGh0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a14013769370b021e23200e7199d8cfaeb97098a",
|
"rev": "8f38b58c34bb759ae83a0581120fe2d7fa6bb539",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -133,11 +133,11 @@
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691397944,
|
"lastModified": 1691747570,
|
||||||
"narHash": "sha256-4fa4bX3kPYKpEssgrFRxRCPVXczidArDeSWaUMSzQAU=",
|
"narHash": "sha256-J3fnIwJtHVQ0tK2JMBv4oAmII+1mCdXdpeCxtIsrL2A=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "pre-commit-hooks.nix",
|
"repo": "pre-commit-hooks.nix",
|
||||||
"rev": "e5588ddffd4c3578547a86ef40ec9a6fbdae2986",
|
"rev": "c5ac3aa3324bd8aebe8622a3fc92eeb3975d317a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -26,9 +26,10 @@
|
||||||
pre-commit.settings.hooks = {
|
pre-commit.settings.hooks = {
|
||||||
autoflake.enable = true;
|
autoflake.enable = true;
|
||||||
black.enable = true;
|
black.enable = true;
|
||||||
|
mypy.enable = true;
|
||||||
ruff.enable = true;
|
ruff.enable = true;
|
||||||
pyright.enable = true;
|
|
||||||
};
|
};
|
||||||
|
pre-commit.settings.settings.mypy.binPath = "${pkgs.python311Packages.mypy}/bin/mypy";
|
||||||
packages.default = package;
|
packages.default = package;
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
|
@ -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
|
|
@ -30,7 +30,7 @@ Issues = "https://git.mat.services/mat/roll/issues"
|
||||||
Source = "https://git.mat.services/mat/roll"
|
Source = "https://git.mat.services/mat/roll"
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
roll = "roll.cli:roll"
|
roll = "roll.cli:cli"
|
||||||
|
|
||||||
[tool.hatch.version]
|
[tool.hatch.version]
|
||||||
path = "roll/__about__.py"
|
path = "roll/__about__.py"
|
||||||
|
@ -47,7 +47,7 @@ cov-report = [
|
||||||
"- coverage combine",
|
"- coverage combine",
|
||||||
"coverage report",
|
"coverage report",
|
||||||
]
|
]
|
||||||
cov = [
|
check = [
|
||||||
"test-cov",
|
"test-cov",
|
||||||
"cov-report",
|
"cov-report",
|
||||||
]
|
]
|
||||||
|
@ -55,15 +55,18 @@ cov = [
|
||||||
[[tool.hatch.envs.all.matrix]]
|
[[tool.hatch.envs.all.matrix]]
|
||||||
python = ["3.11"]
|
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]
|
[tool.hatch.envs.lint]
|
||||||
detached = true
|
detached = true
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"black>=23.1.0",
|
"black>=23.1.0",
|
||||||
"pyright>=1.1.319",
|
|
||||||
"ruff>=0.0.243",
|
"ruff>=0.0.243",
|
||||||
]
|
]
|
||||||
[tool.hatch.envs.lint.scripts]
|
[tool.hatch.envs.lint.scripts]
|
||||||
typing = "pyright --project pyproject.toml {args:roll tests}"
|
|
||||||
style = [
|
style = [
|
||||||
"ruff {args:.}",
|
"ruff {args:.}",
|
||||||
"black --check --diff {args:.}",
|
"black --check --diff {args:.}",
|
||||||
|
@ -73,19 +76,18 @@ fmt = [
|
||||||
"ruff --fix {args:.}",
|
"ruff --fix {args:.}",
|
||||||
"style",
|
"style",
|
||||||
]
|
]
|
||||||
all = [
|
check = [
|
||||||
"style",
|
"style",
|
||||||
"typing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
target-version = ["py311"]
|
target-version = ["py311"]
|
||||||
line-length = 120
|
line-length = 100
|
||||||
skip-string-normalization = true
|
# skip-string-normalization = true
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
target-version = "py311"
|
target-version = "py311"
|
||||||
line-length = 120
|
line-length = 100
|
||||||
select = [
|
select = [
|
||||||
"A",
|
"A",
|
||||||
"ARG",
|
"ARG",
|
||||||
|
@ -153,8 +155,21 @@ roll = ["roll", "*/roll/roll"]
|
||||||
tests = ["tests", "*/roll/tests"]
|
tests = ["tests", "*/roll/tests"]
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
|
show_missing = true
|
||||||
|
skip_empty = true
|
||||||
|
fail_under = 100
|
||||||
exclude_lines = [
|
exclude_lines = [
|
||||||
"no cov",
|
"no cov",
|
||||||
"if __name__ == .__main__.:",
|
"if __name__ == .__main__.:",
|
||||||
"if TYPE_CHECKING:",
|
"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
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from roll.cli import roll
|
import sys
|
||||||
|
|
||||||
sys.exit(roll())
|
from roll.cli import cli
|
||||||
|
|
||||||
|
sys.exit(cli())
|
||||||
|
|
Loading…
Reference in New Issue