Talk:Python: Difference between revisions

imported>L0b0
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Conda ==
== Conda ==


conda-env does not exist after entering the conda-shell without first calling conda-install, so I think the wiki is missleading here, or the package has a bug.
conda-env does not exist after entering the conda-shell without first calling conda-install, so I think the wiki is missleading here, or the package has a bug.
conda-shell, conda-install have no effect and nothing happens. Bash just says it can't find that command.


== shellHook explanation ==
== shellHook explanation ==
Line 12: Line 13:


[[User:L0b0|L0b0]] ([[User talk:L0b0|talk]]) 22:01, 19 September 2021 (UTC)
[[User:L0b0|L0b0]] ([[User talk:L0b0|talk]]) 22:01, 19 September 2021 (UTC)
== Flake example for use with nix develop ==
I was trying to get python with packages as defined by a flake, and found https://dev.to/deciduously/workspace-management-with-nix-flakes-jupyter-notebook-example-2kke a useful discussion.  I propose to add an example:
<syntaxHighlight lang="nix">
{
  description = "Python environment";
  inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
  outputs = {nixpkgs, ...}: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {inherit system;};
  in {
    devShells.${system}.default = pkgs.mkShell {
      buildInputs = [
        (pkgs.python3.withPackages (p: [
          p.requests
        ]))
      ];
      shellHook = "python";
    };
  };
}
</syntaxHighlight>
== Full ==
Can we add a section about Full (e.g. python312Full) and non-Full (e.g. python312) versions? Whats the difference and in which situation use on or the other?
== Update the packaging section ==
Seems like the format was updated and the wiki is no longer accurate? Specifically the <code>setup.py</code> format
Wiki says that the result of <code>main.py</code> will be in bin/app.py but the resulting filename isn't being renamed, so it should be main.py
Setuptools now aren't included by default and need to be explicitly mentioned, and pyproject variable set to true, so the example nix file would look something like this:
<syntaxhighlight lang="nix">
{ pkgs ? import <nixpkgs> { } }:
pkgs.python3Packages.buildPythonApplication {
  pname = "myFlaskApp";
  version = "0.1.0";
  src = ./src;
  build-system = with pkgs.python3Packages; [
    setuptools
  ];
  propagatedBuildInputs = with pkgs.python3Packages; [
    flask
  ];
  pyproject = true;
}
</syntaxhighlight> [[User:Danbulant|Danbulant]] ([[User talk:Danbulant|talk]]) 10:07, 25 April 2026 (UTC)
Return to "Python" page.