forked from clan/clan-core
matrix-bot: Init git commit summarizer
This commit is contained in:
parent
a666a6b126
commit
881196188c
|
@ -8,6 +8,7 @@
|
|||
./schemas/flake-module.nix
|
||||
./webview-ui/flake-module.nix
|
||||
./distro-packages/flake-module.nix
|
||||
./matrix-bot/flake-module.nix
|
||||
];
|
||||
|
||||
perSystem =
|
||||
|
|
6
pkgs/matrix-bot/.envrc
Normal file
6
pkgs/matrix-bot/.envrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
source_up
|
||||
|
||||
watch_file flake-module.nix shell.nix default.nix
|
||||
|
||||
# Because we depend on nixpkgs sources, uploading to builders takes a long time
|
||||
use flake .#matrix-bot --builders ''
|
36
pkgs/matrix-bot/default.nix
Normal file
36
pkgs/matrix-bot/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ python3, setuptools, ... }:
|
||||
|
||||
|
||||
let
|
||||
|
||||
pythonDependencies = [
|
||||
|
||||
];
|
||||
|
||||
runtimeDependencies = [ ];
|
||||
|
||||
testDependencies =
|
||||
runtimeDependencies ++ [
|
||||
];
|
||||
|
||||
in
|
||||
python3.pkgs.buildPythonApplication {
|
||||
name = "matrix-bot";
|
||||
src = ./.;
|
||||
format = "pyproject";
|
||||
|
||||
nativeBuildInputs = [
|
||||
setuptools
|
||||
];
|
||||
|
||||
propagatedBuildInputs = pythonDependencies;
|
||||
|
||||
passthru.testDependencies = testDependencies;
|
||||
|
||||
# Clean up after the package to avoid leaking python packages into a devshell
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
|
||||
meta.mainProgram = "matrix-bot";
|
||||
}
|
15
pkgs/matrix-bot/flake-module.nix
Normal file
15
pkgs/matrix-bot/flake-module.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ self', pkgs, ... }:
|
||||
{
|
||||
|
||||
devShells.matrix-bot = pkgs.callPackage ./shell.nix { inherit (self'.packages) matrix-bot; };
|
||||
packages = {
|
||||
matrix-bot = pkgs.python3.pkgs.callPackage ./default.nix { };
|
||||
default = self'.packages.matrix-bot;
|
||||
};
|
||||
|
||||
checks = { };
|
||||
};
|
||||
}
|
0
pkgs/matrix-bot/matrix_bot/__init__.py
Normal file
0
pkgs/matrix-bot/matrix_bot/__init__.py
Normal file
0
pkgs/matrix-bot/matrix_bot/__main__.py
Normal file
0
pkgs/matrix-bot/matrix_bot/__main__.py
Normal file
3
pkgs/matrix-bot/matrix_bot/main.py
Normal file
3
pkgs/matrix-bot/matrix_bot/main.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
def main():
|
||||
print("Hello, world!")
|
59
pkgs/matrix-bot/pyproject.toml
Normal file
59
pkgs/matrix-bot/pyproject.toml
Normal file
|
@ -0,0 +1,59 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "matrix-bot"
|
||||
description = "matrix bot for release messages from git commits"
|
||||
dynamic = ["version"]
|
||||
scripts = { clan = "matrix_bot:main" }
|
||||
license = {text = "MIT"}
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://clan.lol/"
|
||||
Documentation = "https://docs.clan.lol/"
|
||||
Repository = "https://git.clan.lol/clan/clan-core"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
exclude = ["result"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
matrix_bot = ["py.typed"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = "tests"
|
||||
faulthandler_timeout = 60
|
||||
log_level = "DEBUG"
|
||||
log_format = "%(levelname)s: %(message)s\n %(pathname)s:%(lineno)d::%(funcName)s"
|
||||
addopts = "--cov . --cov-report term --cov-report html:.reports/html --no-cov-on-fail --durations 5 --color=yes --new-first" # Add --pdb for debugging
|
||||
norecursedirs = "tests/helpers"
|
||||
markers = ["impure", "with_core"]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.11"
|
||||
warn_redundant_casts = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_defs = true
|
||||
no_implicit_optional = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "argcomplete.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "ipdb.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "pytest.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = "setuptools.*"
|
||||
ignore_missing_imports = true
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py311"
|
||||
line-length = 88
|
||||
lint.select = [ "E", "F", "I", "U", "N", "RUF", "ANN", "A" ]
|
||||
lint.ignore = ["E501", "E402", "E731", "ANN101", "ANN401", "A003"]
|
33
pkgs/matrix-bot/shell.nix
Normal file
33
pkgs/matrix-bot/shell.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
matrix-bot,
|
||||
mkShell,
|
||||
ruff,
|
||||
python3,
|
||||
}:
|
||||
let
|
||||
devshellTestDeps =
|
||||
matrix-bot.passthru.testDependencies
|
||||
++ (with python3.pkgs; [
|
||||
rope
|
||||
setuptools
|
||||
wheel
|
||||
ipdb
|
||||
pip
|
||||
]);
|
||||
in
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
|
||||
ruff
|
||||
] ++ devshellTestDeps;
|
||||
|
||||
PYTHONBREAKPOINT = "ipdb.set_trace";
|
||||
|
||||
shellHook = ''
|
||||
export GIT_ROOT="$(git rev-parse --show-toplevel)"
|
||||
export PKG_ROOT="$GIT_ROOT/pkgs/matrix-bot"
|
||||
|
||||
# Add clan command to PATH
|
||||
export PATH="$PKG_ROOT/bin":"$PATH"
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user