Python: Difference between revisions
Add Installing Multiple Versions |
fixed broken link for pyproject use-cases |
||
(One intermediate revision by one other user not shown) | |||
Line 205: | Line 205: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== Using <code>buildFHSEnv</code> ==== | ==== Using <code>buildFHSEnv</code> (Recommended) ==== | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
#!/usr/bin/env nix-shell | #!/usr/bin/env nix-shell | ||
Line 531: | Line 531: | ||
if __name__ == '__main__': | if __name__ == '__main__': | ||
app.run(host="0.0.0.0", port=8080) | app.run(host="0.0.0.0", port=8080) | ||
</syntaxhighlight>Also, you need to define the <code>pyproject.toml</code>. Here, we only show some of the important parts. Please refer to <code>pyproject.nix</code> [https://nix | </syntaxhighlight>Also, you need to define the <code>pyproject.toml</code>. Here, we only show some of the important parts. Please refer to <code>pyproject.nix</code> [https://pyproject-nix.github.io/pyproject.nix/use-cases/pyproject.html documentation] for a full example.<syntaxhighlight lang="toml"> | ||
[project] | [project] | ||
name = "my-app" | name = "my-app" |