toolchain: migrate from requirements.txt to poetry
poetry: add deps from requirements.txt flake: import poetry with poetry2nix doc: update installation section
This commit is contained in:
parent
fa8ad0b686
commit
2e2a346610
20
README.md
20
README.md
@ -2,18 +2,24 @@
|
||||
|
||||
A time domain simulation for WRPLL
|
||||
|
||||
## Installing dependencies
|
||||
## Installation
|
||||
|
||||
### Poetry:
|
||||
```bash
|
||||
poetry install --no-root
|
||||
poetry run jupyter lab
|
||||
```
|
||||
|
||||
### Poetry shell:
|
||||
```bash
|
||||
poetry install --no-root
|
||||
poetry shell
|
||||
```
|
||||
|
||||
### Nix:
|
||||
```bash
|
||||
nix develop
|
||||
```
|
||||
### Others:
|
||||
```bash
|
||||
python -m venv .venv
|
||||
source .venv/bin/activate
|
||||
(venv) pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Quick start
|
||||
- Three notebook examples are included
|
||||
|
116
flake.lock
generated
116
flake.lock
generated
@ -1,5 +1,44 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-github-actions": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1698974481,
|
||||
"narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"rev": "4bb5e752616262457bc7ca5882192a564c0472d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-github-actions",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1702233072,
|
||||
@ -16,9 +55,84 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nix-github-actions": "nix-github-actions",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_2",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1702365004,
|
||||
"narHash": "sha256-IRFvmyP1uk1hchRVxaXTqu6YoZCvMM/NVtUf2hD2Tag=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "c12ac880114d52a3cad5fa02b00f2e2090e89982",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"poetry2nix": "poetry2nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"poetry2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1699786194,
|
||||
"narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
63
flake.nix
63
flake.nix
@ -1,37 +1,50 @@
|
||||
{
|
||||
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; };
|
||||
outputs = { nixpkgs, ... }:
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
poetry2nix = {
|
||||
url = "github:nix-community/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { nixpkgs, poetry2nix, ... }:
|
||||
let
|
||||
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
poetry2nixlib = (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; });
|
||||
|
||||
in
|
||||
rec {
|
||||
poetryEnv = poetry2nixlib.mkPoetryEnv {
|
||||
python = pkgs.python3;
|
||||
projectDir = ./.;
|
||||
pyproject = ./pyproject.toml;
|
||||
poetrylock = ./poetry.lock;
|
||||
overrides = poetry2nixlib.overrides.withDefaults (self: super: {
|
||||
trace-updater = super.trace-updater.overridePythonAttrs (
|
||||
# ModuleNotFoundError: No module named 'setuptools'
|
||||
old: {
|
||||
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
|
||||
});
|
||||
tsdownsample = super.tsdownsample.override {
|
||||
# for bypassing building with maturin
|
||||
preferWheel = true;
|
||||
};
|
||||
plotly-resampler = super.plotly-resampler.overridePythonAttrs (
|
||||
# ModuleNotFoundError: No module named 'poetry'
|
||||
old: {
|
||||
buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry-core ];
|
||||
});
|
||||
scipy = super.scipy.override {
|
||||
# fail to build
|
||||
preferWheel = true;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
in rec {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
name = "WRPLL-sim";
|
||||
venvDir = "./.venv";
|
||||
buildInputs = with pkgs; [
|
||||
nixpkgs-fmt
|
||||
python3Packages.python
|
||||
python3Packages.numba
|
||||
python3Packages.numpy
|
||||
python3Packages.notebook # use jupyter notebook without missing libstdc++.so.6
|
||||
python3Packages.venvShellHook
|
||||
|
||||
];
|
||||
|
||||
# Only run once when venv is created
|
||||
postVenvCreation = ''
|
||||
unset SOURCE_DATE_EPOCH
|
||||
pip install -r requirements.txt
|
||||
'';
|
||||
|
||||
postShellHook = ''
|
||||
# allow pip to install wheels
|
||||
unset SOURCE_DATE_EPOCH
|
||||
'';
|
||||
buildInputs = with pkgs; [ poetryEnv poetry nixpkgs-fmt ];
|
||||
|
||||
};
|
||||
};
|
||||
|
2742
poetry.lock
generated
Normal file
2742
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
pyproject.toml
Normal file
23
pyproject.toml
Normal file
@ -0,0 +1,23 @@
|
||||
[tool.poetry]
|
||||
name = "wrpll-simulation"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["morgan <mc@m-labs.hk>"]
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
scipy = "^1.11.4"
|
||||
numpy = "^1.26.2"
|
||||
ipykernel = "^6.27.1"
|
||||
ipywidgets = "^8.1.1"
|
||||
jupyter = "^1.0.0"
|
||||
numba = "^0.58.1"
|
||||
pandas = "^2.1.4"
|
||||
plotly = "^5.18.0"
|
||||
plotly-resampler = "^0.9.1"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
@ -1,11 +0,0 @@
|
||||
scipy
|
||||
numpy
|
||||
ipykernel
|
||||
ipywidgets
|
||||
jupyter
|
||||
jupyterlab
|
||||
notebook
|
||||
numba
|
||||
pandas
|
||||
plotly
|
||||
plotly-resampler
|
Loading…
Reference in New Issue
Block a user