From 5f915f95009446c4317eb34505d70e223934b69b Mon Sep 17 00:00:00 2001 From: Hung Tran <35638399+Pegasust@users.noreply.github.com> Date: Tue, 14 Mar 2023 15:55:21 -0700 Subject: [PATCH] +docs: build binary with `mkPoetryApplication` and build webserver wrapper binary --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index b5910be..502ace5 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,13 @@ Creates a Python application using the Python interpreter specified based on the Other attributes are passed through to `buildPythonApplication`. +Make sure to add in your `pyproject.toml` the py-object for your `main()`. Otherwise, the result is empty. + +```toml +[tool.poetry.scripts] +poetry = "poetry.console.application:main" +``` + #### Example ```nix poetry2nix.mkPoetryApplication { @@ -77,6 +84,8 @@ $ result/bin/python -m admin $ result/bin/gunicorn web:app ``` +If you prefer to build a single binary that runs `gunicorn web:app`, use [`pkgs.writeShellApplication`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L317) for a simple wrapper. + Note: If you need to perform overrides on the application, use `app.dependencyEnv.override { app = app.override { ... }; }`. See [./tests/dependency-environment/default.nix](./tests/dependency-environment/default.nix) for a full example. ### mkPoetryEnv