Factor prefer wheels deps into new `ahot_overrides`

Makes it easier to pass the overrides to multiple p2n functions (like
hopefully `.mkPoetryEnv`). Also, add some commented attempts at using
`mkPoetryEnv` and todo list for "why", remove the `poetry` CLI main
point from the pyproject.toml, bump the poetry lock file.
poetry2nix
Tyler Goodlet 2023-08-17 15:56:28 -04:00
parent e6ecbb7892
commit 555f4a69e8
4 changed files with 125 additions and 63 deletions

View File

@ -59,11 +59,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1692084312, "lastModified": 1692174805,
"narHash": "sha256-Za++qKVK6ovjNL9poQZtLKRM/re663pxzbJ+9M4Pgwg=", "narHash": "sha256-xmNPFDi/AUMIxwgOH/IVom55Dks34u1g7sFKKebxUm0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8353344d3236d3fda429bb471c1ee008857d3b7c", "rev": "caac0eb6bdcad0b32cb2522e03e4002c8975c62e",
"type": "github" "type": "github"
}, },
"original": { "original": {

131
flake.nix
View File

@ -82,16 +82,53 @@
) pypkgs-build-requirements ) pypkgs-build-requirements
); );
in # override some ahead-of-time compiled extensions
{ # to be built with their wheels.
# let ahot_overrides = p2n-overrides.extend(
# devEnv = poetry2nix.mkPoetryEnv { final: prev: {
# projectDir = ./.;
# };
# llvmlite = prev.llvmlite.override {
# preferWheel = false;
# };
# TODO: get this workin with p2n and nixpkgs..
# pyqt6 = prev.pyqt6.override {
# preferWheel = true;
# };
# NOTE: this DOESN'T work atm but after a fix
# to poetry2nix, it will and actually this line
# won't be needed - thanks @k900:
# https://github.com/nix-community/poetry2nix/pull/1257
pyqt5 = prev.pyqt5.override {
withWebkit = false;
preferWheel = true;
};
# see PR from @k900:
# https://github.com/nix-community/poetry2nix/pull/1257
# pyqt5-qt5 = prev.pyqt5-qt5.override {
# withWebkit = false;
# preferWheel = true;
# };
# TODO: patch in an override for polars to build
# from src! See the details likely needed from
# the cryptography entry:
# https://github.com/nix-community/poetry2nix/blob/master/overrides/default.nix#L426-L435
polars = prev.polars.override {
preferWheel = true;
};
}
);
# WHY!? -> output-attrs that `nix develop` scans for:
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html#flake-output-attributes
in {
packages = { packages = {
# piker = poetry2nix.legacyPackages.x86_64-linux.mkPoetryEditablePackage { # piker = poetry2nix.legacyPackages.x86_64-linux.mkPoetryEditablePackage {
# editablePackageSources = { piker = ./piker; }; # editablePackageSources = { piker = ./piker; };
piker = p2npkgs.mkPoetryApplication { piker = p2npkgs.mkPoetryApplication {
projectDir = projectDir; projectDir = projectDir;
@ -99,55 +136,43 @@
# buncha deps with extras.. like `setuptools` mostly. # buncha deps with extras.. like `setuptools` mostly.
# TODO: maybe propose a patch to p2n to show that you # TODO: maybe propose a patch to p2n to show that you
# can even do this in the edgecases docs? # can even do this in the edgecases docs?
overrides = p2n-overrides.extend( overrides = ahot_overrides;
final: prev: {
# TODO: get this workin with p2n and nixpkgs.. # XXX: won't work on llvmlite..
# pyqt6 = prev.pyqt6.override { # preferWheels = true;
# preferWheel = true;
# };
# NOTE: this DOESN'T work atm but after a fix
# to poetry2nix, it will and actually this line
# won't be needed - thanks @k900:
# https://github.com/nix-community/poetry2nix/pull/1257
pyqt5 = prev.pyqt5.override {
withWebkit = false;
preferWheel = true;
};
# see PR from @k900:
# https://github.com/nix-community/poetry2nix/pull/1257
# pyqt5-qt5 = prev.pyqt5-qt5.override {
# withWebkit = false;
# preferWheel = true;
# };
# TODO: patch in an override for polars to build
# from src! See the details likely needed from
# the cryptography entry:
# https://github.com/nix-community/poetry2nix/blob/master/overrides/default.nix#L426-L435
polars = prev.polars.override {
preferWheel = true;
};
}
);
}; };
}; };
# output-attr that `nix-develop` scans for: devShells.default = pkgs.mkShell {
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html#flake-output-attributes # packages = [ poetry2nix.packages.${system}.poetry ];
devShells.default = pkgs.mkShell { packages = [ poetry2nix.packages.x86_64-linux.poetry ];
# packages = [ poetry2nix.packages.${system}.poetry ]; inputsFrom = [ self.packages.x86_64-linux.piker ];
packages = [ poetry2nix.packages.x86_64-linux.poetry ];
inputsFrom = [ self.packages.x86_64-linux.piker ];
# TODO: boot xonsh inside the poetry virtualenv when # TODO: boot xonsh inside the poetry virtualenv when
# defined via a custom entry point? # defined via a custom entry point?
# NOTE XXX: apparently DON'T do these..? # NOTE XXX: apparently DON'T do these..?
# shellHook = "poetry run xonsh"; # shellHook = "poetry run xonsh";
# shellHook = "poetry shell"; # shellHook = "poetry shell";
}; };
}
);
# TODO: grok the difference here..
# - avoid re-cloning git repos on every develop entry..
# - ideally allow hacking on the src code of some deps
# (tractor, pyqtgraph, tomlkit, etc.) WITHOUT having to
# re-install them every time a change is made.
# devShells.default = (p2npkgs.mkPoetryEnv {
# # let {
# # devEnv = p2npkgs.mkPoetryEnv {
# projectDir = projectDir;
# overrides = ahot_overrides;
# inputsFrom = [ self.packages.x86_64-linux.piker ];
# }).env.overrideAttrs (old: {
# buildInputs = [ packages.piker ];
# }
# );
}
); # end of .outputs scope
} }

49
poetry.lock generated
View File

@ -179,13 +179,13 @@ pycparser = "*"
[[package]] [[package]]
name = "click" name = "click"
version = "8.1.6" version = "8.1.7"
description = "Composable command line interface toolkit" description = "Composable command line interface toolkit"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "click-8.1.6-py3-none-any.whl", hash = "sha256:fa244bb30b3b5ee2cae3da8f55c9e5e0c0e86093306301fb418eb9dc40fbded5"}, {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
{file = "click-8.1.6.tar.gz", hash = "sha256:48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd"}, {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
] ]
[package.dependencies] [package.dependencies]
@ -410,6 +410,25 @@ files = [
{file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"},
] ]
[[package]]
name = "importlib-metadata"
version = "6.8.0"
description = "Read metadata from Python packages"
optional = false
python-versions = ">=3.8"
files = [
{file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"},
{file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"},
]
[package.dependencies]
zipp = ">=0.5"
[package.extras]
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
perf = ["ipython"]
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"]
[[package]] [[package]]
name = "keysymdef" name = "keysymdef"
version = "1.2.0" version = "1.2.0"
@ -1108,17 +1127,20 @@ sortedcontainers = "*"
[[package]] [[package]]
name = "trio-typing" name = "trio-typing"
version = "0.8.0" version = "0.9.0"
description = "Static type checking support for Trio and related projects" description = "Static type checking support for Trio and related projects"
optional = false optional = false
python-versions = "*" python-versions = "*"
files = [ files = [
{file = "trio-typing-0.8.0.tar.gz", hash = "sha256:f14264a27b45cec5dabd25b686255ac7d841984200c54b2057bc98a099318a97"}, {file = "trio-typing-0.9.0.tar.gz", hash = "sha256:678d4879205c4d28cbf458cf8a7c60d6feaed0fabfa8bb2129235f769b6df3ec"},
{file = "trio_typing-0.8.0-py3-none-any.whl", hash = "sha256:3734fa3f61cab047fdc97aa0030c72e910455cf85f18ca18c3ff336781b144bb"}, {file = "trio_typing-0.9.0-py3-none-any.whl", hash = "sha256:219e73f72f07fbc97e7019dad3bd49a8bf13d2e53136f3467ae2ee1fcca7a0b9"},
] ]
[package.dependencies] [package.dependencies]
async-generator = "*"
importlib-metadata = "*"
mypy-extensions = ">=0.4.2" mypy-extensions = ">=0.4.2"
packaging = "*"
trio = ">=0.16.0" trio = ">=0.16.0"
typing-extensions = ">=3.7.4" typing-extensions = ">=3.7.4"
@ -1323,6 +1345,21 @@ ptk = ["prompt-toolkit (>=3.0.29)", "pyperclip"]
pygments = ["pygments (>=2.2)"] pygments = ["pygments (>=2.2)"]
test = ["coverage (>=5.3.1)", "prompt-toolkit (>=3.0.29)", "pygments (>=2.2)", "pyte (>=0.8.0)", "pytest (>=7)", "pytest-cov", "pytest-mock", "pytest-rerunfailures", "pytest-subprocess", "pytest-timeout", "restructuredtext-lint", "virtualenv (>=20.16.2)", "xonsh[bestshell]"] test = ["coverage (>=5.3.1)", "prompt-toolkit (>=3.0.29)", "pygments (>=2.2)", "pyte (>=0.8.0)", "pytest (>=7)", "pytest-cov", "pytest-mock", "pytest-rerunfailures", "pytest-subprocess", "pytest-timeout", "restructuredtext-lint", "virtualenv (>=20.16.2)", "xonsh[bestshell]"]
[[package]]
name = "zipp"
version = "3.16.2"
description = "Backport of pathlib-compatible object wrapper for zip files"
optional = false
python-versions = ">=3.8"
files = [
{file = "zipp-3.16.2-py3-none-any.whl", hash = "sha256:679e51dd4403591b2d6838a48de3d283f3d188412a9782faadf845f298736ba0"},
{file = "zipp-3.16.2.tar.gz", hash = "sha256:ebc15946aa78bd63458992fc81ec3b6f7b1e92d51c35e6de1c3804e73b799147"},
]
[package.extras]
docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"]
testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"

View File

@ -58,7 +58,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts] [tool.poetry.scripts]
poetry = "poetry.console.application:main" # poetry = "poetry.console.application:main"
piker = 'piker.cli:cli' piker = 'piker.cli:cli'
pikerd = 'piker.cli:pikerd' pikerd = 'piker.cli:pikerd'
ledger = 'pikerd.accounting.cli:ledger' ledger = 'pikerd.accounting.cli:ledger'