feat(python): add python template

This commit is contained in:
Artur Manuel 2025-03-01 23:20:20 +00:00
commit c993013203
Signed by: amadaluzia
SSH key fingerprint: SHA256:Zwg7gBuZyaG48ucAZneJwltiXu0+tJb7c3lYt9AYlLg
8 changed files with 102 additions and 0 deletions

1
templates/python/.envrc Normal file
View file

@ -0,0 +1 @@
use flake .#

4
templates/python/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/.direnv
\.\#*
\#*\#
*~

27
templates/python/flake.lock generated Normal file
View 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
}

View 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 {});
};
}

View 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
];
}

View 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
];
}

View 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"

View file

@ -0,0 +1,6 @@
def main():
print("Hello, world!")
if __name__ == "__main__":
main()