Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODOs #1

Open
7 tasks
PedroRegisPOAR opened this issue Feb 21, 2021 · 2 comments
Open
7 tasks

TODOs #1

PedroRegisPOAR opened this issue Feb 21, 2021 · 2 comments

Comments

@PedroRegisPOAR
Copy link
Contributor

PedroRegisPOAR commented Feb 21, 2021

NYLUG Presents: Sneaking in Nix - Building Production Containers with Nix +
Optimising Docker Layers for Better Caching with Nix
+
Developing Python with Poetry & Poetry2nix: Reproducible flexible Python environments

Use the same poetry version by all team members. Apparently poetry does not version... poetry ;
From: https://stackoverflow.com/a/65627679

Replicate this Pillow is missing libX11 on WSL

About musl + position independent executables PIE: Small, Simple, and Secure: Alpine Linux under the Microscope

About ruby and gems lock: Long Shipit! Presents: How Shopify Uses Nix, short Shipit! Presents: How Shopify Uses Nix

Breaking changes in system dependencies. Packages built with Nix depend only on other packages managed by Nix, not on system libraries, so our packages are now independent of the host OS; we can deploy the same package to Ubuntu 18.04 and 20.04.
https://rzetterberg.github.io/kubernetes-nixos.html

poetry add -vvv git+https://github.com/matemax/test_poetry_submodule.git
python-poetry/poetry#1828

Manage dependencies of git submodules with poetry

Anaconda was messing the PATH environment variable: How do I deal with certificates using cURL while trying to access an HTTPS url?

Make as example:

TODO: document it https://stackoverflow.com/a/58092909

preferWheel = true;
From: nix-community/poetry2nix#42 (comment)

export LD_LIBRARY_PATH=${stdenv.cc.cc.lib}/lib/:$LD_LIBRARY_PATH

From: nix-community/poetry2nix#46

Or you may uncompress the archive and use setup.py directly with either pip or python
TODO: build an OCI image with python and try make it install a unpacked .whl
From: https://stackoverflow.com/a/36014474, other user with the same mindset python-poetry/poetry#3514 (comment)

TODO: https://discourse.nixos.org/t/preparing-a-nix-flake-for-a-python-program-migra-using-poetry/12030/9

TODO:

Why netbase is only in the debian image? How is the python (especially the python3Minimal) from nixpkgs dealing with this tzdata dependency?

https://search.nixos.org/packages?channel=21.05&show=tzdata&from=0&size=50&sort=relevance&query=tzdata

Init poetry project

Bloated:

nix \
profile \
install \
nixpkgs#auditwheel \
nixpkgs#binutils.out \
nixpkgs#glibc.bin \
nixpkgs#git \
nixpkgs#patchelf \
nixpkgs#poetry \
nixpkgs#python3Full \
nixpkgs#python3Packages.wheel \
nixpkgs#python3Packages.wheel-filename \
nixpkgs#python3Packages.wheel-inspect \
nixpkgs#twine
python --version \
&& mkdir -p "$HOME"/test \
&& cd "$HOME"/test


# Should run only once?
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .

poetry init --no-interaction \
&& poetry lock \
&& poetry show --tree \
&& poetry add flask \
&& poetry lock \
&& poetry show --tree 

cat <<WRAP > "$HOME"/test/flake.nix
{
  description = "A usefull description";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";

  outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
    flake-utils.lib.eachDefaultSystem (system:
    let
        pkgsAllowUnfree = import nixpkgs {
          system = "x86_64-linux";
          config = { allowUnfree = true; };
        };

        pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };

        config = {
          projectDir = ./.;
        };
    in
    {

      devShell = pkgsAllowUnfree.mkShell {

        buildInputs = with pkgsAllowUnfree; [
                       poetry
                       (pkgsAllowUnfree.poetry2nix.mkPoetryEnv config)
                     ];

          shellHook = ''
            unset SOURCE_DATE_EPOCH
          '';
        };
  });
}
WRAP

nix \
flake \
lock \
--override-input nixpkgs github:NixOS/nixpkgs/ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b


nix \
flake \
lock \
--override-input nixpkgs github:NixOS/nixpkgs/12bdeb01ff9e2d3917e6a44037ed7df6e6c3df9d
# nix flake lock


git config --global user.email "you@example.com"
git config --global user.name "Your Name"


git init \
&& git add . \
&& git commit -m 'First nix flake commit'

nix develop --command python -c 'import flask'
nix shell nixpkgs#bashInteractive
nix profile install nixpkgs#coreutils
nix profile install nixpkgs#poetry
nix profile install nixpkgs#python3

python --version \
&& mkdir -p "$HOME"/test \
&& cd "$HOME"/test \
&& poetry init --no-interaction --dev-dependency numpy \
&& poetry lock \
&& poetry show --tree \
&& poetry add pillow \
&& poetry lock
cat <<WRAP > "$HOME"/test/flake.nix
{
  description = "A usefull description";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.flake-utils.url = "github:numtide/flake-utils";
  inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";

  outputs = { self, nixpkgs, flake-utils, poetry2nix-src }:
    flake-utils.lib.eachDefaultSystem (system:
    let
        pkgsAllowUnfree = import nixpkgs {
          system = "x86_64-linux";
          config = { allowUnfree = true; };
        };

        pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };

        config = {
          projectDir = ./.;
        };
    in
    {

      devShell = pkgsAllowUnfree.mkShell {

        buildInputs = with pkgsAllowUnfree; [
                       poetry
                       (pkgsAllowUnfree.poetry2nix.mkPoetryEnv config)
                     ];

          shellHook = ''
            unset SOURCE_DATE_EPOCH
          '';
        };
  });
}
WRAP

nix flake lock
nix develop --command python -c 'import numpy'

https://github.com/numpy/numpy/blob/76930e7d0c22e227c9ff9249a90a6254c5a6b547/doc/HOWTO_RELEASE.rst.txt#make-sure-current-branch-builds-a-package-correctly

TODO:

@PedroRegisPOAR
Copy link
Contributor Author

PedroRegisPOAR commented Aug 10, 2021

TODO:

nix \
profile \
install \
nixpkgs#python3Full \
nixpkgs#python3Full.pkgs.pip \
nixpkgs#python3Full.pkgs.virtualenv \
nixpkgs#python3Full.pkgs.setuptools \
nixpkgs#python3Full.pkgs.wheel \
nixpkgs#python3Full.pkgs.venvShellHook \
&& nix store gc
nix \
shell \
--impure \
--expr \
'
  (
    with builtins.getFlake "github:NixOS/nixpkgs/d639b2dfacdb3464faa11936a8c751ea3ff57775";
    with legacyPackages.${builtins.currentSystem};
      python3.withPackages (p: with p; [ 
        pip
        virtualenv
        setuptools
        wheel
        venvShellHook
        numpy 
      ])
  )
' \
--command \
python3 -c 'import numpy as np; np.show_config(); print(np.__version__)'
nix \
shell \
nixpkgs#{python37,python38,python39,python310}
python3.7 --version
python3.8 --version
python3.9 --version
python3.10 --version

@PedroRegisPOAR
Copy link
Contributor Author

PedroRegisPOAR commented Oct 10, 2021

TODO: how to test it?
platform_machine targetMachine

A test for manylinux1:
Refs.:

_manylinux.py has been removed
Refs.:

nix \
shell \
--impure \
--expr \
'(
  with builtins.getFlake "github:NixOS/nixpkgs/d639b2dfacdb3464faa11936a8c751ea3ff57775";
  with legacyPackages.${builtins.currentSystem};
  python3.withPackages (p: with p; [ numpy ])
)' \
--command \
python3 -c 'import numpy as np; np.show_config(); print(np.__version__)'

Refs.:

{ nix \
shell \
--impure \
--expr \
'(
  with builtins.getFlake "github:NixOS/nixpkgs/d639b2dfacdb3464faa11936a8c751ea3ff57775";
  with legacyPackages.${builtins.currentSystem};
  python3.withPackages (p: with p; [ packaging ])
)' \
--command \
python \
-c \
"from packaging import tags; print('\n'.join([str(t) for t in tags.sys_tags()]))" } | curl -F 'f:1=<-' ix.io

Refs.:

TODO: read all this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant