templates: add python-uv
This commit is contained in:
parent
62ddec5c23
commit
ca98b8367c
7 changed files with 178 additions and 0 deletions
|
|
@ -7,6 +7,10 @@
|
|||
path = ./c++-meson;
|
||||
description = "A C++ project using Meson";
|
||||
};
|
||||
"python-uv" = {
|
||||
path = ./python-uv;
|
||||
description = "A Python project using uv";
|
||||
};
|
||||
"rust-cargo" = {
|
||||
path = ./rust-cargo;
|
||||
description = "A Rust project using Cargo";
|
||||
|
|
|
|||
6
templates/python-uv/.envrc
Normal file
6
templates/python-uv/.envrc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# shellcheck shell=bash
|
||||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg="
|
||||
fi
|
||||
|
||||
use flake
|
||||
6
templates/python-uv/.gitignore
vendored
Normal file
6
templates/python-uv/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Virtual environments
|
||||
.venv
|
||||
|
||||
# Nix generated files
|
||||
/.pre-commit-config.yaml
|
||||
/result
|
||||
31
templates/python-uv/.woodpecker/check.yml
Normal file
31
templates/python-uv/.woodpecker/check.yml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
labels:
|
||||
backend: local
|
||||
|
||||
steps:
|
||||
- name: pre-commit check
|
||||
image: bash
|
||||
commands:
|
||||
- nix develop --command pre-commit run --all
|
||||
|
||||
- name: nix flake check
|
||||
image: bash
|
||||
commands:
|
||||
- nix flake check
|
||||
|
||||
- name: notify
|
||||
image: bash
|
||||
environment:
|
||||
ADDRESS:
|
||||
from_secret: matrix_homeserver
|
||||
ROOM:
|
||||
from_secret: matrix_roomid
|
||||
USER:
|
||||
from_secret: matrix_username
|
||||
PASS:
|
||||
from_secret: matrix_password
|
||||
commands:
|
||||
- nix run github:ambroisie/matrix-notifier
|
||||
when:
|
||||
status:
|
||||
- failure
|
||||
- success
|
||||
112
templates/python-uv/flake.nix
Normal file
112
templates/python-uv/flake.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{
|
||||
description = "A Python project";
|
||||
|
||||
inputs = {
|
||||
futils = {
|
||||
type = "github";
|
||||
owner = "numtide";
|
||||
repo = "flake-utils";
|
||||
ref = "main";
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
type = "github";
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
ref = "nixos-unstable";
|
||||
};
|
||||
|
||||
git-hooks = {
|
||||
type = "github";
|
||||
owner = "cachix";
|
||||
repo = "git-hooks.nix";
|
||||
ref = "master";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, futils, nixpkgs, git-hooks }:
|
||||
{
|
||||
overlays = {
|
||||
default = final: _prev: {
|
||||
project = with final; python3.pkgs.buildPythonApplication {
|
||||
pname = "project";
|
||||
version = (final.lib.importTOML ./pyproject.toml).project.version;
|
||||
pyproject = true;
|
||||
|
||||
src = self;
|
||||
|
||||
build-system = with python3.pkgs; [ setuptools ];
|
||||
|
||||
pythonImportsCheck = [ "project" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Python project";
|
||||
homepage = "https://git.belanyi.fr/ambroisie/project";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ ambroisie ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} // futils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
self.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
pre-commit = git-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
|
||||
hooks = {
|
||||
mypy = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
ruff = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
ruff-format = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
inherit (self.packages.${system}) project;
|
||||
|
||||
inherit pre-commit;
|
||||
};
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [
|
||||
self.packages.${system}.project
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
uv
|
||||
self.checks.${system}.pre-commit.enabledPackages
|
||||
];
|
||||
|
||||
inherit (pre-commit) shellHook;
|
||||
};
|
||||
};
|
||||
|
||||
packages = futils.lib.flattenTree {
|
||||
default = pkgs.project;
|
||||
inherit (pkgs) project;
|
||||
};
|
||||
});
|
||||
}
|
||||
17
templates/python-uv/pyproject.toml
Normal file
17
templates/python-uv/pyproject.toml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
|
||||
[project]
|
||||
name = "project"
|
||||
version = "0.0.0"
|
||||
description = "project description"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = []
|
||||
|
||||
[project.scripts]
|
||||
project = "project:main"
|
||||
|
||||
[dependency-groups]
|
||||
dev = []
|
||||
2
templates/python-uv/src/project/__init__.py
Normal file
2
templates/python-uv/src/project/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def main() -> None:
|
||||
print("Hello, world!")
|
||||
Loading…
Add table
Add a link
Reference in a new issue