From 21d7c3a9d6243fa6fc44724f7338be77074cc51e Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Mon, 27 Nov 2023 20:49:55 -0700 Subject: [PATCH] Demonstrate bundling a console application. --- specs/poetry/template/app/__init__.py | 2 ++ specs/poetry/template/flake.nix | 8 +++++--- specs/poetry/template/main.py | 2 -- specs/poetry/template/pyproject.toml | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 specs/poetry/template/app/__init__.py delete mode 100644 specs/poetry/template/main.py diff --git a/specs/poetry/template/app/__init__.py b/specs/poetry/template/app/__init__.py new file mode 100644 index 0000000..e3095b2 --- /dev/null +++ b/specs/poetry/template/app/__init__.py @@ -0,0 +1,2 @@ +def main(): + print("hello world") diff --git a/specs/poetry/template/flake.nix b/specs/poetry/template/flake.nix index d4d4f8e..040ddf5 100644 --- a/specs/poetry/template/flake.nix +++ b/specs/poetry/template/flake.nix @@ -64,21 +64,23 @@ in { packages = { - tmpl-app = mkPoetryApplication { + app = mkPoetryApplication { projectDir = ./.; overrides = poetry2nix-overrides; }; - default = self.packages.${system}.tmpl-app; + + default = self.packages.${system}.app; }; devShells.default = pkgs.mkShell { - inputsFrom = [ self.packages.${system}.tmpl-app ]; + inputsFrom = [ self.packages.${system}.app ]; packages = [ pkgs.poetry ] ++ (with pkgs.python311Packages; [ black debugpy mccabe + mypy pycodestyle pyflakes python-lsp-black diff --git a/specs/poetry/template/main.py b/specs/poetry/template/main.py deleted file mode 100644 index 54b08a6..0000000 --- a/specs/poetry/template/main.py +++ /dev/null @@ -1,2 +0,0 @@ -if __name__ == '__main__': - pass diff --git a/specs/poetry/template/pyproject.toml b/specs/poetry/template/pyproject.toml index 81a6cff..0c087b2 100644 --- a/specs/poetry/template/pyproject.toml +++ b/specs/poetry/template/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "tmpl" +name = "app" version = "0.1.0" description = "" authors = ["Your Name "] @@ -12,3 +12,6 @@ python = "^3.11" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +app = "app:main"