Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/development/python/poetry/poetry-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In this directory, run:

`devbox shell`

This will automatically activate your poetry shell via the `init_hook`.
To activate your poetry shell add `"eval $(poetry env activate)"` to the `init_hook` otherwise use poetry to run commands, e.g. `poetry run pytest`.

To exit the poetry shell, use `exit`. To exit your devbox shell, use `exit` again.

Expand Down
1 change: 0 additions & 1 deletion examples/development/python/poetry/poetry-demo/devbox.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"packages": [
"python@latest",
"poetry@latest"
],
"shell": {
Expand Down
91 changes: 17 additions & 74 deletions examples/development/python/poetry/poetry-demo/devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,128 +2,71 @@
"lockfile_version": "1",
"packages": {
"github:NixOS/nixpkgs/nixpkgs-unstable": {
"last_modified": "2025-06-18T03:01:18Z",
"resolved": "github:NixOS/nixpkgs/5395fb3ab3f97b9b7abca147249fa2e8ed27b192?lastModified=1750215678&narHash=sha256-Rc%2FytpamXRf6z8UA2SGa4aaWxUXRbX2MAWIu2C8M%2Bok%3D"
"last_modified": "2025-09-01T03:15:32Z",
"resolved": "github:NixOS/nixpkgs/58dcbf1ec551914c3756c267b8b9c8c86baa1b2f?lastModified=1756696532&narHash=sha256-6FWagzm0b7I%2FIGigOv9pr6LL7NQ86mextfE8g8Q6HBg%3D"
},
"poetry@latest": {
"last_modified": "2024-02-10T18:15:24Z",
"last_modified": "2025-08-11T23:54:17Z",
"plugin_version": "0.0.4",
"resolved": "github:NixOS/nixpkgs/10b813040df67c4039086db0f6eaf65c536886c6#poetry",
"resolved": "github:NixOS/nixpkgs/5a983011e0f4b3b286aaa73e011ce32b1449a528#poetry",
"source": "devbox-search",
"version": "1.7.1",
"version": "2.1.4",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/0pf30mblcl4clvagdzybfgfyzjqkjkqi-python3.11-poetry-1.7.1",
"path": "/nix/store/40wdkwvhgyak26dvm7nvk79sazsp70p0-python3.13-poetry-2.1.4",
"default": true
},
{
"name": "dist",
"path": "/nix/store/rs4ya5784629m6842b4g1fc360dscc9n-python3.11-poetry-1.7.1-dist"
"path": "/nix/store/pqnpbi6kfcgpliwlw3d07n73iwd4zq10-python3.13-poetry-2.1.4-dist"
}
],
"store_path": "/nix/store/0pf30mblcl4clvagdzybfgfyzjqkjkqi-python3.11-poetry-1.7.1"
"store_path": "/nix/store/40wdkwvhgyak26dvm7nvk79sazsp70p0-python3.13-poetry-2.1.4"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/knc1livlnrnaxbnfs9118nq69i78jj39-python3.11-poetry-1.7.1",
"path": "/nix/store/1wcnin7zb7p3kgb0a5rdr123k1zm5m79-python3.13-poetry-2.1.4",
"default": true
},
{
"name": "dist",
"path": "/nix/store/xmfkj29vxivcmzsy02lvxrk8fagzp71b-python3.11-poetry-1.7.1-dist"
"path": "/nix/store/x1y9vaw30ibdsp0c3q4k6kb9lsy125ah-python3.13-poetry-2.1.4-dist"
}
],
"store_path": "/nix/store/knc1livlnrnaxbnfs9118nq69i78jj39-python3.11-poetry-1.7.1"
"store_path": "/nix/store/1wcnin7zb7p3kgb0a5rdr123k1zm5m79-python3.13-poetry-2.1.4"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/qf2px4ic22dpra0s6mlmjm5q4vvc6dr7-python3.11-poetry-1.7.1",
"path": "/nix/store/ag8lzpbpacp6jfy7z7wjnkwbfic1ikms-python3.13-poetry-2.1.4",
"default": true
},
{
"name": "dist",
"path": "/nix/store/0xg2c7pcfa5kcazibw503ni49lclprj7-python3.11-poetry-1.7.1-dist"
"path": "/nix/store/4hjin62zaapxgysj7z72729s6ww7wk00-python3.13-poetry-2.1.4-dist"
}
],
"store_path": "/nix/store/qf2px4ic22dpra0s6mlmjm5q4vvc6dr7-python3.11-poetry-1.7.1"
"store_path": "/nix/store/ag8lzpbpacp6jfy7z7wjnkwbfic1ikms-python3.13-poetry-2.1.4"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/fq4cf1xzwlvbhg98ih8dvsq2hsalhzyp-python3.11-poetry-1.7.1",
"path": "/nix/store/0in2k6jizc97cw3w4yivn2v3nipplfrb-python3.13-poetry-2.1.4",
"default": true
},
{
"name": "dist",
"path": "/nix/store/jgn140k0ag3yyl1ysqgz7wikbzgzifdh-python3.11-poetry-1.7.1-dist"
"path": "/nix/store/k5hi65p5y654wi6llza3azcz1xx0l7i5-python3.13-poetry-2.1.4-dist"
}
],
"store_path": "/nix/store/fq4cf1xzwlvbhg98ih8dvsq2hsalhzyp-python3.11-poetry-1.7.1"
}
}
},
"python@latest": {
"last_modified": "2024-02-10T18:15:24Z",
"plugin_version": "0.0.4",
"resolved": "github:NixOS/nixpkgs/10b813040df67c4039086db0f6eaf65c536886c6#python312",
"source": "devbox-search",
"version": "3.12.1",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/s1mr5bmvfcy4hm7669d2xx3gqgj481qk-python3-3.12.1",
"default": true
}
],
"store_path": "/nix/store/s1mr5bmvfcy4hm7669d2xx3gqgj481qk-python3-3.12.1"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/qv710q1p74qb7bswpwh59px28gfj51b1-python3-3.12.1",
"default": true
},
{
"name": "debug",
"path": "/nix/store/6i8r0lq7m7rf7lcqjrwizkcaznmhd2cm-python3-3.12.1-debug"
}
],
"store_path": "/nix/store/qv710q1p74qb7bswpwh59px28gfj51b1-python3-3.12.1"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/051hdrw5qmgbplch184mplcnv4djfb8a-python3-3.12.1",
"default": true
}
],
"store_path": "/nix/store/051hdrw5qmgbplch184mplcnv4djfb8a-python3-3.12.1"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/y4dxr00qg40pwgxx9nxj61091zk8bsvl-python3-3.12.1",
"default": true
},
{
"name": "debug",
"path": "/nix/store/n8jysaqvk89q6fbif4mlacni6wwq0sgc-python3-3.12.1-debug"
}
],
"store_path": "/nix/store/y4dxr00qg40pwgxx9nxj61091zk8bsvl-python3-3.12.1"
"store_path": "/nix/store/0in2k6jizc97cw3w4yivn2v3nipplfrb-python3.13-poetry-2.1.4"
}
}
}
Expand Down
19 changes: 16 additions & 3 deletions examples/development/python/poetry/poetry-demo/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
from emoji import emojize


def main():
"""Prints a greeting message.

This is a separate function so that it can be used as a script in the pyproject.toml
"""
print(emojize(":rocket: Devbox with Poetry :rocket:"))


if __name__ == "__main__":
print(emojize(":rocket: Devbox with Poetry :rocket:"))
main()

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ authors = ["John Lago <[email protected]>"]
python = "^3.8"
emoji = "^2.1.0"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
pytest = "^7.2.2"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
demo = "poetry_demo.__main__:main"
2 changes: 1 addition & 1 deletion plugins/poetry.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "poetry",
"version": "0.0.4",
"description": "This plugin automatically configures poetry to use the version of python installed in your Devbox shell, instead of the Python version that it is bundled with. The pyproject.toml location can be configured by setting DEVBOX_PYPROJECT_DIR (defaults to the devbox.json's directory).",
"description": "This plugin lets poetry configure the version of python installed. The pyproject.toml location can be configured by setting DEVBOX_PYPROJECT_DIR (defaults to the devbox.json's directory).",
"env": {
"DEVBOX_DEFAULT_PYPROJECT_DIR": "{{ .DevboxProjectDir }}",
"POETRY_VIRTUALENVS_IN_PROJECT": "true",
Expand Down
2 changes: 1 addition & 1 deletion plugins/poetry/initHook.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

poetry env use $(command -v python) --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2
poetry env --directory="${DEVBOX_PYPROJECT_DIR:-$DEVBOX_DEFAULT_PYPROJECT_DIR}" --no-interaction --quiet >&2