add uv
This commit is contained in:
parent
6595888fc8
commit
91c94a59e0
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.venv
|
||||
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
||||
3.13
|
||||
25
flake.lock
generated
Normal file
25
flake.lock
generated
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764667669,
|
||||
"narHash": "sha256-7WUCZfmqLAssbDqwg9cUDAXrSoXN79eEEq17qhTNM/Y=",
|
||||
"rev": "418468ac9527e799809c900eda37cbff999199b6",
|
||||
"revCount": 905402,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.905402%2Brev-418468ac9527e799809c900eda37cbff999199b6/019ae5d7-2ce4-7dbb-90bd-21ec6e69adb4/source.tar.gz?rev=418468ac9527e799809c900eda37cbff999199b6&revCount=905402"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
96
flake.nix
Normal file
96
flake.nix
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
description = "A Nix-flake-based Python development environment";
|
||||
|
||||
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
|
||||
|
||||
outputs =
|
||||
{ self, ... }@inputs:
|
||||
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forEachSupportedSystem =
|
||||
f:
|
||||
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f {
|
||||
pkgs = import inputs.nixpkgs { inherit system; };
|
||||
}
|
||||
);
|
||||
|
||||
/*
|
||||
Change this value ({major}.{min}) to
|
||||
update the Python virtual-environment
|
||||
version. When you do this, make sure
|
||||
to delete the `.venv` directory to
|
||||
have the hook rebuild it for the new
|
||||
version, since it won't overwrite an
|
||||
existing one. After this, reload the
|
||||
development shell to rebuild it.
|
||||
You'll see a warning asking you to
|
||||
do this when version mismatches are
|
||||
present. For safety, removal should
|
||||
be a manual step, even if trivial.
|
||||
*/
|
||||
version = "3.13";
|
||||
in
|
||||
{
|
||||
devShells = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
let
|
||||
concatMajorMinor =
|
||||
v:
|
||||
pkgs.lib.pipe v [
|
||||
pkgs.lib.versions.splitVersion
|
||||
(pkgs.lib.sublist 0 2)
|
||||
pkgs.lib.concatStrings
|
||||
];
|
||||
|
||||
python = pkgs."python${concatMajorMinor version}";
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShellNoCC {
|
||||
venvDir = ".venv";
|
||||
|
||||
postShellHook = ''
|
||||
venvVersionWarn() {
|
||||
local venvVersion
|
||||
venvVersion="$("$venvDir/bin/python" -c 'import platform; print(platform.python_version())')"
|
||||
|
||||
[[ "$venvVersion" == "${python.version}" ]] && return
|
||||
|
||||
cat <<EOF
|
||||
Warning: Python version mismatch: [$venvVersion (venv)] != [${python.version}]
|
||||
Delete '$venvDir' and reload to rebuild for version ${python.version}
|
||||
EOF
|
||||
}
|
||||
|
||||
venvVersionWarn
|
||||
'';
|
||||
|
||||
packages = with python.pkgs; [
|
||||
venvShellHook
|
||||
pip
|
||||
|
||||
uv
|
||||
|
||||
# Add whatever else you'd like here.
|
||||
# pkgs.basedpyright
|
||||
|
||||
pkgs.black
|
||||
# or
|
||||
# python.pkgs.black
|
||||
|
||||
pkgs.ruff
|
||||
# or
|
||||
# python.pkgs.ruff
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
6
main.py
Normal file
6
main.py
Normal file
@ -0,0 +1,6 @@
|
||||
def main():
|
||||
print("Hello from exploration!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
11
pyproject.toml
Normal file
11
pyproject.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[project]
|
||||
name = "exploration"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"jupyter>=1.1.1",
|
||||
"numpy>=2.3.5",
|
||||
"pandas>=2.3.3",
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user