Skip to content

Commit

Permalink
Add example and tests for Python directory option
Browse files Browse the repository at this point in the history
  • Loading branch information
totoroot committed Mar 4, 2024
1 parent bf833fd commit f1f49e7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/python-directory/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Devenv
.devenv*
devenv.local.nix

10 changes: 10 additions & 0 deletions examples/python-directory/.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -exu
POETRY_VENV="$PWD/directory/.venv"
[ -d "$POETRY_VENV" ]
[ "$(poetry env info --path)" = "$POETRY_VENV" ]
[ "$(command -v python)" = "$POETRY_VENV/bin/python" ]
python --version
poetry --version
poetry run python -c 'import requests'
python -c 'import requests'
13 changes: 13 additions & 0 deletions examples/python-directory/devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ pkgs, config, ... }:

{
languages.python = {
enable = true;
directory = "./directory";
poetry = {
enable = true;
install.enable = true;
activate.enable = true;
};
};
}
7 changes: 7 additions & 0 deletions examples/python-directory/devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
nixpkgs-python:
url: github:cachix/nixpkgs-python
17 changes: 17 additions & 0 deletions examples/python-directory/directory/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "python-directory"
version = "0.1.0"
description = ""
authors = [
"Bob van der Linden <bobvanderlinden@gmail.com>",
"Matthias Thym <git@thym.at>"
]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.30"

0 comments on commit f1f49e7

Please sign in to comment.