Pkg with `poetry`, `poetry2nix` and a `flake.nix`
parent
4aa04e1c8e
commit
6e8d07852c
|
@ -0,0 +1,85 @@
|
|||
# NOTE: to convert to a poetry2nix env like this here are the
|
||||
# steps:
|
||||
# - install poetry in your system nix config
|
||||
# - convert the repo to use poetry using `poetry init`:
|
||||
# https://python-poetry.org/docs/basic-usage/#initialising-a-pre-existing-project
|
||||
# - then manually ensuring all deps are converted over:
|
||||
{
|
||||
description = "piker: trading gear for hackers (pkged with poetry2nix)";
|
||||
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.poetry2nix = {
|
||||
url = "github:nix-community/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
poetry2nix,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
# use PWD as sources
|
||||
projectDir = ./.;
|
||||
pyproject = ./pyproject.toml;
|
||||
poetrylock = ./poetry.lock;
|
||||
|
||||
# TODO: port to 3.11 and support both versions?
|
||||
python = "python3.10";
|
||||
|
||||
# see https://github.com/nix-community/poetry2nix/tree/master#api
|
||||
# for more functions and examples.
|
||||
# inherit
|
||||
# (poetry2nix.legacyPackages.${system})
|
||||
# mkPoetryApplication;
|
||||
# pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
||||
in
|
||||
{
|
||||
# let
|
||||
# devEnv = poetry2nix.mkPoetryEnv {
|
||||
# projectDir = ./.;
|
||||
# };
|
||||
|
||||
packages = {
|
||||
piker = poetry2nix.mkPoetryEditablePackage {
|
||||
# env = poetry2nix.mkPoetryEnv {
|
||||
|
||||
# NOTE: taken from surrounding inputs
|
||||
# projectDir = projectDir;
|
||||
editablePackageSources = { piker = ./piker; };
|
||||
|
||||
# override msgspec to include setuptools as input
|
||||
# https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md#modulenotfounderror-no-module-named-packagenamed
|
||||
overrides = poetry2nix.defaultPoetryOverrides.extend
|
||||
(self: super: {
|
||||
msgspec = super.msgspec.overridePythonAttrs
|
||||
(
|
||||
old: {
|
||||
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# boot xonsh inside the poetry virtualenv when
|
||||
# define the custom entry point via an expected
|
||||
# output-attr that `nix-develop` scans for:
|
||||
# https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html#flake-output-attributes
|
||||
devShells.default = pkgs.mkShell {
|
||||
# packages = [ poetry2nix.packages.${system}.poetry ];
|
||||
packages = [ poetry2nix.packages.x86_64-linux.poetry ];
|
||||
shellHook = "poetry run xonsh";
|
||||
# shellHook = "poetry shell";
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,52 @@
|
|||
[tool.poetry]
|
||||
name = "piker"
|
||||
version = "0.1.0.alpha0.dev0"
|
||||
description = "trading gear for hackers"
|
||||
authors = ["Tyler Goodlet <jgbt@protonmail.com>"]
|
||||
license = "AGPLv3"
|
||||
readme = "README.md"
|
||||
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
tomli = "^2.0.1"
|
||||
tomli-w = "^1.0.0"
|
||||
colorlog = "^6.7.0"
|
||||
attrs = "^23.1.0"
|
||||
pygments = "^2.16.1"
|
||||
colorama = "^0.4.6"
|
||||
msgspec = "^0.18.0"
|
||||
typer = "^0.9.0"
|
||||
rich = "^13.5.2"
|
||||
trio = "^0.22.2"
|
||||
trio-websocket = "^0.10.3"
|
||||
trio-util = "^0.7.0"
|
||||
async-generator = "^1.10"
|
||||
asks = "^3.0.0"
|
||||
ib-insync = "^0.9.86"
|
||||
pendulum = "^2.1.2"
|
||||
bidict = "^0.22.1"
|
||||
cython = "^3.0.0"
|
||||
numpy = "1.24"
|
||||
numba = "^0.57.1"
|
||||
polars = "^0.18.13"
|
||||
pyqt5 = "^5.15.9"
|
||||
qdarkstyle = ">=3.0.2"
|
||||
fuzzywuzzy = {extras = ["speedup"], version = "^0.18.0"}
|
||||
xonsh = "^0.14.0"
|
||||
|
||||
# pinned from git
|
||||
tractor = { path = '../tractor/', develop = true }
|
||||
# tractor = { git = 'https://github.com/goodboy/tractor.git', branch = 'piker_pin' }
|
||||
pyqtgraph = { git = 'https://github.com/pikers/pyqtgraph.git' }
|
||||
asyncvnc = { git = 'https://github.com/pikers/asyncvnc.git', branch = 'main' }
|
||||
tomlkit = { git = 'https://github.com/pikers/tomlkit.git', branch = 'piker_pin' }
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
|
||||
[tool.poetry.scripts]
|
||||
poetry = "poetry.console.application:main"
|
Loading…
Reference in New Issue