From ac2981afa10e14193cf983f2c27afa92c5a3a51c Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Wed, 16 Oct 2024 12:02:35 -0600 Subject: [PATCH] Initial python poetry environment --- python-poetry/.flox/.gitignore | 4 + python-poetry/.flox/env.json | 4 + python-poetry/.flox/env/manifest.lock | 540 ++++++++++++++++++++++++++ python-poetry/.flox/env/manifest.toml | 102 +++++ python-poetry/poetry.lock | 17 + python-poetry/pyproject.toml | 16 + python-poetry/test.sh | 21 + 7 files changed, 704 insertions(+) create mode 100644 python-poetry/.flox/.gitignore create mode 100644 python-poetry/.flox/env.json create mode 100644 python-poetry/.flox/env/manifest.lock create mode 100644 python-poetry/.flox/env/manifest.toml create mode 100644 python-poetry/poetry.lock create mode 100644 python-poetry/pyproject.toml create mode 100755 python-poetry/test.sh diff --git a/python-poetry/.flox/.gitignore b/python-poetry/.flox/.gitignore new file mode 100644 index 0000000..15d71a1 --- /dev/null +++ b/python-poetry/.flox/.gitignore @@ -0,0 +1,4 @@ +run/ +cache/ +lib/ +log/ diff --git a/python-poetry/.flox/env.json b/python-poetry/.flox/env.json new file mode 100644 index 0000000..006be23 --- /dev/null +++ b/python-poetry/.flox/env.json @@ -0,0 +1,4 @@ +{ + "name": "python-poetry", + "version": 1 +} diff --git a/python-poetry/.flox/env/manifest.lock b/python-poetry/.flox/env/manifest.lock new file mode 100644 index 0000000..ac8384e --- /dev/null +++ b/python-poetry/.flox/env/manifest.lock @@ -0,0 +1,540 @@ +{ + "lockfile-version": 1, + "manifest": { + "version": 1, + "install": { + "coreutils": { + "pkg-path": "coreutils" + }, + "gum": { + "pkg-path": "gum" + }, + "poetry": { + "pkg-path": "poetry" + }, + "python": { + "pkg-path": "python3", + "version": "3.11.*" + } + }, + "vars": {}, + "hook": { + "on-activate": "\nexport POETRY_VIRTUALENVS_PATH=\"$FLOX_ENV_CACHE/python-poetry/venvs\"\nexport FLOX_HOME=$(realpath -s \"$FLOX_ENV_CACHE/../..\")\n\nif [ ! -f \"$FLOX_HOME/pyproject.toml\" ]; then\n echo \"❌ No pyproject.toml found in $FLOX_HOME. Cannot activate environment.\"\n exit 1\nfi\n\nexport FLOX_PYENV_PATH=$(poetry env info --path)\n\ncreate_python_env() {\n poetry env use python\n}\nexport -f create_python_env\n\nactivate_python_env() {\n source \"$FLOX_PYENV_PATH/bin/activate\"\n}\nexport -f activate_python_env\n\ninstall_python_dependencies() {\n poetry install\n}\nexport -f install_python_dependencies\n\n\nif [ -z \"$FLOX_PYENV_PATH\" ]; then\n if [[ \"$FLOX_ENVS_TESTING\" == \"1\" ]]; then\n create_python_env\n else\n gum spin --spinner dot --title \"Creating python environment\" -- bash -c create_python_env\n fi\n echo \"✅ Python environment created\"\nelse\n echo \"✅ Python environment already exists\"\nfi\n\n\nif [[ \"$FLOX_ENVS_TESTING\" == \"1\" ]]; then\n activate_python_env\nelse\n gum spin --spinner dot --title \"Activating python environment\" -- bash -c activate_python_env\nfi\necho \"✅ Python environment activated\"\n\n\nif [[ \"$FLOX_ENVS_TESTING\" == \"1\" ]]; then\n install_python_dependencies\nelse\n gum spin --spinner dot --title \"Installing python dependencies\" -- bash -c install_python_dependencies\nfi\necho \"✅ Python project dependencies installed\"\n\n" + }, + "profile": { + "common": "echo \"\"\necho \" ╔═════════════════════════════════════╗\"\necho \" ║ ║\"\necho \" ║ Your python environment is ready! ║\"\necho \" ║ ║\"\necho \" ╚═════════════════════════════════════╝\"\necho \"\"\n", + "bash": " source \"$(poetry env info --path)/bin/activate\"\n", + "zsh": " source \"$(poetry env info --path)/bin/activate\"\n", + "fish": " source \"$(poetry env info --path)/bin/activate.fish\"\n", + "tcsh": " source \"$(poetry env info --path)/bin/activate.csh\"\n" + }, + "options": { + "systems": [ + "aarch64-darwin", + "aarch64-linux", + "x86_64-darwin", + "x86_64-linux" + ], + "allow": { + "licenses": [] + }, + "semver": {} + }, + "services": {}, + "build": {} + }, + "packages": [ + { + "attr_path": "coreutils", + "broken": false, + "derivation": "/nix/store/8p2qkx08p8skiw6xz3bp3yj19b804dnr-coreutils-9.5.drv", + "description": "GNU Core Utilities", + "install_id": "coreutils", + "license": "GPL-3.0-or-later", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "coreutils-9.5", + "pname": "coreutils", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "9.5", + "outputs_to_install": [ + "out" + ], + "outputs": { + "info": "/nix/store/synvgqgdhvbj2b37ja3bn56f2yx08r2r-coreutils-9.5-info", + "out": "/nix/store/47zwbmparr2g3b0hci44vma95k1j8a3v-coreutils-9.5" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "coreutils", + "broken": false, + "derivation": "/nix/store/xi1l0agghjxldrsf03vrsydbzgd0p9ph-coreutils-9.5.drv", + "description": "GNU Core Utilities", + "install_id": "coreutils", + "license": "GPL-3.0-or-later", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "coreutils-9.5", + "pname": "coreutils", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "9.5", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/4nhkjwjckrypgfbg781gap2irradpcn4-coreutils-9.5-debug", + "info": "/nix/store/n62qzcipxl2060qyq8h79wa94mq81cdr-coreutils-9.5-info", + "out": "/nix/store/84yg60swk80b04apprb1432kir41bvzj-coreutils-9.5" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "coreutils", + "broken": false, + "derivation": "/nix/store/nvpqj2ahl0qj49bzwqiz4j7k1d80qxv5-coreutils-9.5.drv", + "description": "GNU Core Utilities", + "install_id": "coreutils", + "license": "GPL-3.0-or-later", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "coreutils-9.5", + "pname": "coreutils", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "9.5", + "outputs_to_install": [ + "out" + ], + "outputs": { + "info": "/nix/store/k9g3chvxb1zff1la6fvswp0dxvriii3g-coreutils-9.5-info", + "out": "/nix/store/nx7b6wz48p7lli49ms54zp9j4s4yjjf5-coreutils-9.5" + }, + "system": "x86_64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "coreutils", + "broken": false, + "derivation": "/nix/store/mapdfbh230kblpdhxrg77zramjaj9nmk-coreutils-9.5.drv", + "description": "GNU Core Utilities", + "install_id": "coreutils", + "license": "GPL-3.0-or-later", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "coreutils-9.5", + "pname": "coreutils", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "9.5", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/8467bx2i423s8d2dnl0529q9q8mpr9h2-coreutils-9.5-debug", + "info": "/nix/store/d33w475g5g30crnr2in1w3b9ifpm46h5-coreutils-9.5-info", + "out": "/nix/store/i7qhgc0bs725qw3wdanznfkdna4z2ns2-coreutils-9.5" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "gum", + "broken": false, + "derivation": "/nix/store/52i3x5mmp7dfm6p8zvk5virx2fw18ylr-gum-0.14.1.drv", + "description": "Tasty Bubble Gum for your shell", + "install_id": "gum", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "gum-0.14.1", + "pname": "gum", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "0.14.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/wrwq2wp1b37aab7g84mwfjrck5qmbdwq-gum-0.14.1" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "gum", + "broken": false, + "derivation": "/nix/store/qrvxw8s7rgd5xs8npmdjksm5m1mv9jw6-gum-0.14.1.drv", + "description": "Tasty Bubble Gum for your shell", + "install_id": "gum", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "gum-0.14.1", + "pname": "gum", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "0.14.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/p5zr5kx07s1q2q2b4x3w7829d90lri3v-gum-0.14.1" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "gum", + "broken": false, + "derivation": "/nix/store/jdjqq2y83dn5hzwq4wn93pfx7whmsp7k-gum-0.14.1.drv", + "description": "Tasty Bubble Gum for your shell", + "install_id": "gum", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "gum-0.14.1", + "pname": "gum", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "0.14.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/y8jq0g1248psylchrp6w4kl2w5aj5b70-gum-0.14.1" + }, + "system": "x86_64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "gum", + "broken": false, + "derivation": "/nix/store/f4mi68wxfg1mkg0kdzlm89zjmv1km4hp-gum-0.14.1.drv", + "description": "Tasty Bubble Gum for your shell", + "install_id": "gum", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "gum-0.14.1", + "pname": "gum", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "0.14.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/kdlpj359v1bzjya79j8iwapg0swzm8mh-gum-0.14.1" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "poetry", + "broken": false, + "derivation": "/nix/store/hgmdvc1wj6ks6brrhjzvwck0brf1pjlf-python3.11-poetry-1.8.3.drv", + "description": "Python dependency management and packaging made easy", + "install_id": "poetry", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "poetry-1.8.3", + "pname": "poetry", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "1.8.3", + "outputs_to_install": [ + "out" + ], + "outputs": { + "dist": "/nix/store/85badakychn4bmpiaqqhlxjnvc4kvl66-python3.11-poetry-1.8.3-dist", + "out": "/nix/store/rxzn7qsm3hpkg4za3z3lcpj514fm7kjv-python3.11-poetry-1.8.3" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "poetry", + "broken": false, + "derivation": "/nix/store/rpw6hnfjbbxnb26vacz1k2i2h98jyl5l-python3.11-poetry-1.8.3.drv", + "description": "Python dependency management and packaging made easy", + "install_id": "poetry", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "poetry-1.8.3", + "pname": "poetry", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "1.8.3", + "outputs_to_install": [ + "out" + ], + "outputs": { + "dist": "/nix/store/swa3b2frx31vrclcs8y77n92fyn4nvwa-python3.11-poetry-1.8.3-dist", + "out": "/nix/store/8402rkyi0s8bsfssmdhq5s183gah79dk-python3.11-poetry-1.8.3" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "poetry", + "broken": false, + "derivation": "/nix/store/16vq0d3j6r9wda5ng73f5p1wcqzkmv05-python3.11-poetry-1.8.3.drv", + "description": "Python dependency management and packaging made easy", + "install_id": "poetry", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "poetry-1.8.3", + "pname": "poetry", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "1.8.3", + "outputs_to_install": [ + "out" + ], + "outputs": { + "dist": "/nix/store/2l6xhvdqfan07ib7lh81rnchnw52360r-python3.11-poetry-1.8.3-dist", + "out": "/nix/store/i01nj2xbsdslq7rh9v58318741y6ics3-python3.11-poetry-1.8.3" + }, + "system": "x86_64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "poetry", + "broken": false, + "derivation": "/nix/store/964q94rf5lai0v3kgyyl352v03r0z9g1-python3.11-poetry-1.8.3.drv", + "description": "Python dependency management and packaging made easy", + "install_id": "poetry", + "license": "MIT", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "poetry-1.8.3", + "pname": "poetry", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "1.8.3", + "outputs_to_install": [ + "out" + ], + "outputs": { + "dist": "/nix/store/4i14gkdh2pjckkvb0yjwhziin9ykf8lb-python3.11-poetry-1.8.3-dist", + "out": "/nix/store/jp27zm8lg646mm4qihs4xr7h2s83ykz0-python3.11-poetry-1.8.3" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "python3", + "broken": false, + "derivation": "/nix/store/wfykwnxr7b3yf52iq1mvrj6xsyki9xh3-python3-3.11.9.drv", + "description": "High-level dynamically-typed programming language", + "install_id": "python", + "license": "Python-2.0", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "python3-3.11.9", + "pname": "python3", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "3.11.9", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/327bf08j5b7l9cnzink3g4vp32y5352j-python3-3.11.9" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "python3", + "broken": false, + "derivation": "/nix/store/k8rfpimvg8943kffa0dhlfc0fcswp6sf-python3-3.11.9.drv", + "description": "High-level dynamically-typed programming language", + "install_id": "python", + "license": "Python-2.0", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "python3-3.11.9", + "pname": "python3", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "3.11.9", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/kl8hjhf6x7dz7brs1ylkxy26qb8argaq-python3-3.11.9-debug", + "out": "/nix/store/q3x28mimkawkdjlvd78jxv3s0fk25vz8-python3-3.11.9" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "python3", + "broken": false, + "derivation": "/nix/store/23x4lr8y0y7d2gch5vnhmxw927ciqm60-python3-3.11.9.drv", + "description": "High-level dynamically-typed programming language", + "install_id": "python", + "license": "Python-2.0", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "python3-3.11.9", + "pname": "python3", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "3.11.9", + "outputs_to_install": [ + "out" + ], + "outputs": { + "out": "/nix/store/9lcbaggnygcqpgzakib5lwisks8gnn5i-python3-3.11.9" + }, + "system": "x86_64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "python3", + "broken": false, + "derivation": "/nix/store/9v1jlbifgwgfw0l9v745kifpj9zdpl60-python3-3.11.9.drv", + "description": "High-level dynamically-typed programming language", + "install_id": "python", + "license": "Python-2.0", + "locked_url": "https://github.com/flox/nixpkgs?rev=9f4128e00b0ae8ec65918efeba59db998750ead6", + "name": "python3-3.11.9", + "pname": "python3", + "rev": "9f4128e00b0ae8ec65918efeba59db998750ead6", + "rev_count": 647193, + "rev_date": "2024-07-03T18:27:49Z", + "scrape_date": "2024-07-05T00:14:29Z", + "stabilities": [ + "staging", + "unstable" + ], + "unfree": false, + "version": "3.11.9", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/61rzpp3v8dsf6h17h3jnnwlm5hwc2brr-python3-3.11.9-debug", + "out": "/nix/store/6b1fqdwb3g56j5pazv8zkx9qd0mv3wiz-python3-3.11.9" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + } + ] +} \ No newline at end of file diff --git a/python-poetry/.flox/env/manifest.toml b/python-poetry/.flox/env/manifest.toml new file mode 100644 index 0000000..fc2f0c5 --- /dev/null +++ b/python-poetry/.flox/env/manifest.toml @@ -0,0 +1,102 @@ +version = 1 + +[install] +gum.pkg-path = "gum" +coreutils.pkg-path = "coreutils" +python.pkg-path = "python3" +python.version = "3.11.*" # <-- Change this to the version of Python you want +poetry.pkg-path = "poetry" + +[vars] + +[hook] +on-activate = ''' + +export POETRY_VIRTUALENVS_PATH="$FLOX_ENV_CACHE/python-poetry/venvs" +export FLOX_HOME=$(realpath -s "$FLOX_ENV_CACHE/../..") + +if [ ! -f "$FLOX_HOME/pyproject.toml" ]; then + echo "❌ No pyproject.toml found in $FLOX_HOME. Cannot activate environment." + exit 1 +fi + +export FLOX_PYENV_PATH=$(poetry env info --path) + +create_python_env() { + poetry env use python +} +export -f create_python_env + +activate_python_env() { + source "$FLOX_PYENV_PATH/bin/activate" +} +export -f activate_python_env + +install_python_dependencies() { + poetry install +} +export -f install_python_dependencies + + +if [ -z "$FLOX_PYENV_PATH" ]; then + if [[ "$FLOX_ENVS_TESTING" == "1" ]]; then + create_python_env + else + gum spin --spinner dot --title "Creating python environment" -- bash -c create_python_env + fi + echo "✅ Python environment created" +else + echo "✅ Python environment already exists" +fi + + +if [[ "$FLOX_ENVS_TESTING" == "1" ]]; then + activate_python_env +else + gum spin --spinner dot --title "Activating python environment" -- bash -c activate_python_env +fi +echo "✅ Python environment activated" + + +if [[ "$FLOX_ENVS_TESTING" == "1" ]]; then + install_python_dependencies +else + gum spin --spinner dot --title "Installing python dependencies" -- bash -c install_python_dependencies +fi +echo "✅ Python project dependencies installed" + +''' + + +[profile] +common = ''' +echo "" +echo " ╔═════════════════════════════════════╗" +echo " ║ ║" +echo " ║ Your python environment is ready! ║" +echo " ║ ║" +echo " ╚═════════════════════════════════════╝" +echo "" +''' +bash = ''' + source "$(poetry env info --path)/bin/activate" +''' +fish = ''' + source "$(poetry env info --path)/bin/activate.fish" +''' +tcsh = ''' + source "$(poetry env info --path)/bin/activate.csh" +''' +zsh = ''' + source "$(poetry env info --path)/bin/activate" +''' + +[services] + +[options] +systems = [ + "aarch64-darwin", + "aarch64-linux", + "x86_64-darwin", + "x86_64-linux", +] diff --git a/python-poetry/poetry.lock b/python-poetry/poetry.lock new file mode 100644 index 0000000..9d4f1d7 --- /dev/null +++ b/python-poetry/poetry.lock @@ -0,0 +1,17 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "pyjokes" +version = "0.8.3" +description = "One line jokes for programmers (jokes as a service)" +optional = false +python-versions = "<4.0,>=3.9" +files = [ + {file = "pyjokes-0.8.3-py3-none-any.whl", hash = "sha256:12836e61bc7a2c1ff302604a040f0f63ac36c5c947c20319fcb5d1ab37bac46e"}, + {file = "pyjokes-0.8.3.tar.gz", hash = "sha256:5735d31e973d5b6934b46b89431505733c3110f9b66eac0ff0be86f7f3646423"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "0be4f66f421ad27e489e7163a85989dec95edb96546b4f1ff8b5d4cc8a5af841" diff --git a/python-poetry/pyproject.toml b/python-poetry/pyproject.toml new file mode 100644 index 0000000..a52b9b5 --- /dev/null +++ b/python-poetry/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "flox-poetry-example" +version = "0.1.0" +description = "" +authors = ["Your Name "] +license = "MIT" +package-mode = false + +[tool.poetry.dependencies] +python = "^3.11" +pyjokes = "^0.8.3" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/python-poetry/test.sh b/python-poetry/test.sh new file mode 100755 index 0000000..66a021e --- /dev/null +++ b/python-poetry/test.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -eo pipefail + +check_command() { + if ! command -v $1 2>&1 >/dev/null + then + echo "Error: '$1' command could not be found." + exit 1 + fi +} + +check_command python +check_command poetry +check_command pyjokes + +python -c "import pyjokes" +echo ">>> pyjokes python package installed" + +pyjokes +echo ">>> pyjokes binary works"