move to poetry

This commit is contained in:
Valentin Boettcher 2021-12-08 15:27:02 +01:00
parent 544417bbfa
commit 4bc5a8b1db
4 changed files with 75 additions and 107 deletions

81
flake.lock generated
View file

@ -17,11 +17,11 @@
},
"flake-utils_2": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"lastModified": 1610051610,
"narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc",
"type": "github"
},
"original": {
@ -30,42 +30,7 @@
"type": "github"
}
},
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 1637687243,
"narHash": "sha256-Qm0hPR9ZT1EP7lRW4udAPeb4yv6D2ONcw9ayterTP18=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "31b21203a1350bff7c541e9dfdd4e07f76d874be",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1622797669,
"narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1638806821,
"narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=",
@ -80,27 +45,45 @@
"type": "indirect"
}
},
"pypi-deps-db": {
"flake": false,
"nixpkgs_2": {
"locked": {
"lastModified": 1622970040,
"narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "be6591698c67a86a69c81fef72167e38d038a9fc",
"lastModified": 1610729867,
"narHash": "sha256-bk/SBaBLqZX/PEqal27DMQwAHHl0dcZMp8NNksQr80s=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "04af07c659c6723a2259bb6bc00a47ec53330f20",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1638854297,
"narHash": "sha256-mt5gMwAThp8FpcvRsKhs/y/VxLDNgH4MJJLlFbbs4gk=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "a4b769203284c91529480adcbb4f17f04d3ff67b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix"
}
}
},

View file

@ -3,32 +3,45 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
mach-nix.url = "github:DavHau/mach-nix";
poetry2nix.url = "github:nix-community/poetry2nix";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, mach-nix }:
let
python = "python39";
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
let
name = "binfootprint";
in {
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(final: prev: {
${name} = (prev.poetry2nix.mkPoetryApplication {
projectDir = ./.;
doCheck = false;
});
})
in flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
];
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
rec {
packages = {
${name} = pkgs.${name};
};
binfootprint = (mach-nix-wrapper.buildPythonPackage {
src = ./.;
});
defaultPackage = packages.${name};
devShell = (pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
pythonShell = mach-nix-wrapper.mkPython {
packagesExtra = [binfootprint];
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [pythonShell black pyright];
};
defaultPackage = binfootprint;
});
editablePackageSources = {
${name} = ./${name};
};
}).env.overrideAttrs (oldAttrs: {
buildInputs = [ pkgs.poetry pkgs.black pkgs.pyright ];
});
}));
}

View file

@ -4,11 +4,17 @@ version = "0.1.0"
description = "binary representation for simple data structures"
authors = ["Richard Hartmann <richard.hartmann@tu-dresden.de>"]
license = "BSD (3 clause)"
classifiers = [
"Operating System :: OS Independent",
"Intended Audience :: Developers"
]
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
numpy = "^1.5.1"
[tool.poetry.dev-dependencies]
#mypy = "*"
#black = "*"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.core.masonry.api"

View file

@ -1,34 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# To create a distribution package for pip or easy-install:
# python setup.py sdist
from setuptools import setup
author = u"Richard Hartmann"
authors = [author]
description = 'binary representation for simple data structured'
name = 'binfootprint'
version = '0.1.0'
if __name__ == "__main__":
setup(
name=name,
author=author,
author_email='richard.hartmann@tu-dresden.de',
url='https://github.com/cimatosa/binfootprint',
version=version,
packages=[name],
package_dir={name: name},
license="BSD (3 clause)",
description=description,
install_requires=["NumPy >= 1.5.1"],
keywords=["binary","footprint", "pickle", "key"],
classifiers= [
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Intended Audience :: Developers'],
platforms=['ALL']
)