Python: Difference between revisions

Include mention of poetry2nix
RobH (talk | contribs)
With pyproject.toml: Add hint for launching IDE with dependency resolution. Also, make it clear pyproject.nix axample uses flakes.
Line 395: Line 395:
[project.scripts]
[project.scripts]
cli = "app.main:main"
cli = "app.main:main"
</syntaxhighlight>We package the application by calling the <code>loadPyproject</code> function from <code>pyproject.nix</code>. Again, we only show a minimal example. More information can be found in the [https://nix-community.github.io/pyproject.nix/use-cases/pyproject.html documentation].<syntaxhighlight lang="nix">
</syntaxhighlight>We package the application by calling the <code>loadPyproject</code> function from <code>pyproject.nix</code>. Again, we only show a minimal example. More information can be found in the [https://nix-community.github.io/pyproject.nix/use-cases/pyproject.html documentation]. Note that this example relies on flakes in contrast to some of the others on this page.<syntaxhighlight lang="nix">
{
{
   description = "A basic flake using pyproject.toml project metadata";
   description = "A basic flake using pyproject.toml project metadata";
Line 438: Line 438:


</syntaxhighlight>To run the application, call <code>nix run</code>.
</syntaxhighlight>To run the application, call <code>nix run</code>.
You can also launch an IDE under <code>nix develop</code> and get full dependency resolution. For example, the following command opens VS Code in the constructed environment:
<syntaxhighlight lang="shell-session">
$ nix develop --command code
</syntaxhighlight>


== Nixpkgs Python contribution guidelines ==
== Nixpkgs Python contribution guidelines ==