Set up python environment for easier development
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
.direnv/
|
||||||
|
__pycache__/
|
||||||
|
.pytest_cache/
|
||||||
|
.ruff_cache/
|
||||||
|
result
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
class Solution:
|
|
||||||
def twoSum(self, nums: List[int], target: int) -> List[int]:
|
|
||||||
|
|
||||||
Generated
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784497964,
|
||||||
|
"narHash": "sha256-vlHUuqAcbcH2RKmHbPiuQzbv1pnzzavXnI62RD0bqCU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "241313f4e8e508cb9b13278c2b0fa25b9ca27163",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
|
devShells.${system}.default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
python313
|
||||||
|
ruff # lint + format
|
||||||
|
basedpyright # LSP / type checking
|
||||||
|
python313Packages.pytest
|
||||||
|
entr
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
d="problems/$1"; mkdir -p "$d"
|
||||||
|
cat > "$d/solution.py" <<'EOF'
|
||||||
|
class Solution:
|
||||||
|
def solve(self):
|
||||||
|
pass
|
||||||
|
EOF
|
||||||
|
cat > "$d/solution_test.py" <<'EOF'
|
||||||
|
from solution import Solution
|
||||||
|
def test_solve():
|
||||||
|
assert Solution().solve() is None
|
||||||
|
EOF
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[tool.ruff]
|
||||||
|
line-length = 100
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
select = ["E", "F", "I", "UP", "B", "SIM"]
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
testpaths = ["."]
|
||||||
|
python_files = ["*_test.py"]
|
||||||
Reference in New Issue
Block a user