feat(python): add python template
This commit is contained in:
parent
01bc222af3
commit
c993013203
8 changed files with 102 additions and 0 deletions
1
templates/python/.envrc
Normal file
1
templates/python/.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake .#
|
4
templates/python/.gitignore
vendored
Normal file
4
templates/python/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/.direnv
|
||||||
|
\.\#*
|
||||||
|
\#*\#
|
||||||
|
*~
|
27
templates/python/flake.lock
generated
Normal file
27
templates/python/flake.lock
generated
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1740695751,
|
||||||
|
"narHash": "sha256-D+R+kFxy1KsheiIzkkx/6L63wEHBYX21OIwlFV8JvDs=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "6313551cd05425cd5b3e63fe47dbc324eabb15e4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
26
templates/python/flake.nix
Normal file
26
templates/python/flake.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {self, nixpkgs, ...}: let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
systems = ["x86_64-linux" "aarch64-linux"];
|
||||||
|
forAllSystems = f: lib.genAttrs systems (
|
||||||
|
system: f system (import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
packages = forAllSystems (system: pkgs: {
|
||||||
|
REPLACE_ME = pkgs.callPackage ./flake/package.nix {};
|
||||||
|
default = self.packages.${system}.REPLACE_ME;
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forAllSystems (_: pkgs: {
|
||||||
|
default = pkgs.callPackage ./flake/shell.nix {};
|
||||||
|
});
|
||||||
|
|
||||||
|
formatter = forAllSystems (_: pkgs: pkgs.callPackage ./flake/formatter.nix {});
|
||||||
|
};
|
||||||
|
}
|
16
templates/python/flake/package.nix
Normal file
16
templates/python/flake/package.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
python3Packages
|
||||||
|
}: let
|
||||||
|
ps = python3Packages;
|
||||||
|
in ps.buildPythonApplication {
|
||||||
|
pname = "sm64pcport-for-dummies";
|
||||||
|
version = "2025.03";
|
||||||
|
|
||||||
|
src = builtins.filterSource (path: _: baseNameOf path != ".git") ../.;
|
||||||
|
|
||||||
|
pyproject = true;
|
||||||
|
|
||||||
|
build-system = [
|
||||||
|
ps.setuptools
|
||||||
|
];
|
||||||
|
}
|
11
templates/python/flake/shell.nix
Normal file
11
templates/python/flake/shell.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{mkShell, python3, ruff, ruff-lsp}: let
|
||||||
|
python3' = python3.withPackages (ps: []);
|
||||||
|
in
|
||||||
|
mkShell {
|
||||||
|
name = "python-env";
|
||||||
|
packages = [
|
||||||
|
python3'
|
||||||
|
ruff
|
||||||
|
ruff-lsp
|
||||||
|
];
|
||||||
|
}
|
11
templates/python/pyproject.toml
Normal file
11
templates/python/pyproject.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[project]
|
||||||
|
name = "REPLACE_ME"
|
||||||
|
description = "Dumbed-down frontend for the SM64 PC Port compiler."
|
||||||
|
version = "2025.03"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
REPLACE_ME = "REPLACE_ME.__main__:main"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools >= 61.0"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
6
templates/python/src/REPLACE_ME/__main__.py
Normal file
6
templates/python/src/REPLACE_ME/__main__.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
def main():
|
||||||
|
print("Hello, world!")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Add table
Add a link
Reference in a new issue