Poetry plugin to bundle projects into various formats

Overview

Poetry bundle plugin

This package is a plugin that allows the bundling of Poetry projects into various formats.

Installation

The easiest way to install the bundle plugin is via the plugin add command of Poetry.

poetry plugin add poetry-bundle-plugin

If you used pipx to install Poetry you can add the plugin via the pipx inject command.

pipx inject poetry poetry-bundle-plugin

Otherwise, if you used pip to install Poetry you can add the plugin packages via the pip install command.

pip install poetry-bundle-plugin

Usage

The plugin introduces a bundle command namespace that regroups commands to bundle the current project and its dependencies into various formats. These commands are particularly useful to deploy Poetry-managed applications.

bundle venv

bundle venv

The bundle venv command bundles the project and its dependencies into a virtual environment.

The following command

poetry bundle venv /path/to/environment

will bundle the project in the /path/to/environment directory by creating the virtual environment, installing the dependencies and the current project inside it. If the directory does not exist, it will be created automatically.

By default, the command uses the current Python executable to build the virtual environment. If you want to use a different one, you can specify it with the --python/-p option:

poetry bundle venv /path/to/environment --python /full/path/to/python
poetry bundle venv /path/to/environment -p python3.8
poetry bundle venv /path/to/environment -p 3.8

Note

If the virtual environment already exists, two things can happen:

  • The python version of the virtual environment is the same as the main one: the dependencies will be synced (updated or removed).
  • The python version of the virtual environment is different: the virtual environment will be recreated from scratch.

You can also ensure that the virtual environment is recreated by using the --clear option:

poetry bundle venv /path/to/environment --clear
Comments
  • 1.2.0a2: `installer.remove_untracked` -> adds installer.requires_synchronization(True)

    1.2.0a2: `installer.remove_untracked` -> adds installer.requires_synchronization(True)

    the function has been moved to Solver

    fixes error

    
      AttributeError
    
      'Installer' object has no attribute 'remove_untracked'
    
      at ~/.asdf/installs/python/3.8.5/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/poetry_bundle_plugin/bundlers/venv_bundler.py:133 in bundle
          129│             poetry.locker,
          130│             poetry.pool,
          131│             poetry.config,
          132│         )
        → 133│         installer.remove_untracked()
          134│         installer.use_executor(poetry.config.get("experimental.new-installer", False))
          135│
          136│         return_code = installer.run()
          137│         if return_code:
    
    opened by jtzero 7
  • Add support for dependency groups

    Add support for dependency groups

    By making BundleCommand inherit from poetry's GroupCommand, and passing the detected groups through to the venv bundler.

    Fixes https://github.com/python-poetry/poetry-plugin-bundle/issues/8

    opened by tofay 4
  • "Could not find a matching version of package poetry-plugin-bundle" on install

    Hi,

    Thanks for putting together this useful tool. I don't seem to be able to install it though, and get the following error.

    `$ poetry --version Poetry (version 1.2.0b1) $ poetry plugin add poetry-plugin-bundle

    Could not find a matching version of package poetry-plugin-bundle `

    Any ideas on how to resolve it?

    Thanks,

    opened by drone-ah 3
  • Bundle doesn't add all the internal packages

    Bundle doesn't add all the internal packages

    Hi I've encountered an issue where when using the plugin it does work with internal packages (packages I import as: lib1 = {path = "../../../poetry/lib1", develop = true} for example).

    The issue is that when lib1 himself is importing another internal package, for example: lib2 = {path = "../lib2", develop = true}

    the output bundle doesn't contain lib2. So it seems the plugin only works on the first level of internal packages, is it possible to add the ability to bundle all the project packages?

    opened by OceanManOne 2
  • Temporary directory import errors

    Temporary directory import errors

    Hey all.

    After some strugle trying to find the correct versions that supports the commands needed to install poetry-plugin-bundle, I'm still finding some issues.

    Using 1.1.14

    curl -sSL https://install.python-poetry.org | python3 -
    poetry --version
    # Poetry version 1.1.14
    poetry self add poetry-plugin-bundle
    

    Using 1.2.0b3

    curl -sSL https://install.python-poetry.org | python3 - --preview
    # Poetry (version 1.2.0b3)
    poetry self add poetry-plugin-bundle
    #
    # Could not find a matching version of package poetry-plugin-bundle
    

    Using 1.2.0b3, accounting for #17

    poetry self add poetry-bundle-plugin
    # Using version ^0.1.0 for poetry-bundle-plugin
    # 
    # Updating dependencies
    # Resolving dependencies... (1.1s)
    # 
    # Writing lock file
    # 
    # Package operations: 1 install, 0 updates, 0 removals
    # 
    #   • Installing poetry-bundle-plugin (0.1.0)
    poetry bundle venv test_env
    # cannot import name 'temporary_directory' from 'poetry.utils.helpers' (/home/<myuser>/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/helpers.py)
    

    What is the correct poetry version to use with poetry-bundle?

    opened by SamambaMan 2
  • How to use the bundle output in a docker container for production

    How to use the bundle output in a docker container for production

    Hi

    I'm in a search for a way to build a package for my monorepo project including the internal packages. This plugin seems like it is exactly what I need but I'm encountering an issue when trying to use the build output.

    Trying to run the activate script of poetry inside the dockerfile, running: . venv/bin/activate

    It seems to activate the virtual environment but it doesn't find the python packages in projects. Running python -m site inside the virtual environment results in: (build) [email protected]:/app# python -m site sys.path = [ '/app', '/usr/local/lib/python38.zip', '/usr/local/lib/python3.8', '/usr/local/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/site-packages', ] USER_BASE: '/root/.local' (doesn't exist) USER_SITE: '/root/.local/lib/python3.8/site-packages' (doesn't exist) ENABLE_USER_SITE: True

    Which isn't the correct site-packages path.

    What is the correct way using this plugin out with docker container?

    question 
    opened by OceanManOne 1
  • 'Installer' object has no attribute 'remove-untracked'

    'Installer' object has no attribute 'remove-untracked'

    I tried bundeling my project with this plugin and got the following error:

    Trashtalk:project$ poetry bundle venv ~/Programming/project/test
    
      • Bundling evm_backend (0.1.0) into /home/nathan/Programming/project/test: Installing dependencies
    
      AttributeError
    
      'Installer' object has no attribute 'remove_untracked'
    
      at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry_bundle_plugin/bundlers/venv_bundler.py:133 in bundle
          129│             poetry.locker,
          130│             poetry.pool,
          131│             poetry.config,
          132│         )
        → 133│         installer.remove_untracked()
          134│         installer.use_executor(poetry.config.get("experimental.new-installer", False))
          135│ 
          136│         return_code = installer.run()
          137│         if return_code:
    

    I don't know why this doesn't work, since I have a completely fresh install of both poetry and this plugin. I did some minor detective work and found out that remove_untracked doesn't exist in this file at least. Should I downgrade to an earlier 1.2 pre-release?

    opened by Trashtalk217 1
  • Normalize name

    Normalize name

    It's a bit weird that this is poetry-bundle-plugin, but export is poetry-plugin-export. I suspect it's best to pick one of the two naming formats and sticking to it.

    opened by lovesegfault 1
  • [pre-commit.ci] pre-commit autoupdate

    [pre-commit.ci] pre-commit autoupdate

    opened by pre-commit-ci[bot] 1
  • [pre-commit.ci] pre-commit autoupdate

    [pre-commit.ci] pre-commit autoupdate

    opened by pre-commit-ci[bot] 1
  • [pre-commit.ci] pre-commit autoupdate

    [pre-commit.ci] pre-commit autoupdate

    opened by pre-commit-ci[bot] 1
  • [Question] Does bundle plugin support to bundle dependencies to existed conda environment

    [Question] Does bundle plugin support to bundle dependencies to existed conda environment

    I know that poetry install can detect conda environment automatically and install dependencies to the current activate environment. But the problem if poetry install is there is no way to make it ignore the editable dependencies. I don't know if bundle plugin support this. It would be good to have some doc about it, thank you.

    opened by link89 0
  • [feature request] optionally compress bundled venv to zip or tar.gz file

    [feature request] optionally compress bundled venv to zip or tar.gz file

    Hi,

    I would like to ask if this is a good idea to add an option to save bundled venv to .zip or tar.gz file. The usecase is for providing pyspark code and dependencies, it supports venv-pack tar.gz file which basically works the same as this bundle plugin, except it creates tar.gz file. See: https://spark.apache.org/docs/latest/api/python/user_guide/python_packaging.html#using-virtualenv

    opened by kazdy 1
  • bundle dependencies marked as editable

    bundle dependencies marked as editable

    For dependencies marked as editable, this plugin will create .pth files including the local location of the path-based dependency. In that sense, the dependency is not bundled.

    Is there a reason for a bundled install to observe the "develop = true" flag? If so, can we have an option to install these packages as non-editable instead? According to my reading of https://github.com/python-poetry/poetry/issues/1382#issuecomment-1266291854, this bundler is supposed to handle that installation case.

    poetry 1.2.1
    poetry-core 1.2.0 poetry-plugin-bundle 1.1.0

    opened by smcoll 0
  • using dot as the path crashes while deleting the current folder

    using dot as the path crashes while deleting the current folder

    Using windows WSL2 with debian and python3.7, I just migrated to poetry 1.2.2 and wanted to try the new bundle plugin that would allow me to build faster in my CI.

    I innocently typed

    poetry bundle venv .
    

    as I wanted the bundle to be in the current folder. The command started and showed

    Bundling xxx_gateway (1.1.1) into .: Removing existing virtual environment
    

    and then

    [Errno 22] Invalid argument: '.'
    

    In the meantime my folder had been emptied (no consequence git was here)

    I think other people could try to bundle in there local folder so I suggest adding an exception for the dot path. Maybe using ./bundle as a default could be interesting in some automation process as well.

    opened by Cajuteq 0
Owner
Poetry
Python packaging and dependency management made easy
Poetry
An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

An addin for Autodesk Fusion 360 that lets you view your design in a Looking Glass Portrait 3D display

Brian Peiris 12 Nov 02, 2022
Account Manager / Nuker with GUI.

Account Manager / Nuker Remove all friends Block all friends Leave all servers Mass create servers Close all dms Mass dm Exit Setup git clone https://

Lodi#0001 1 Oct 23, 2021
Spinning waffle from waffle shaped python code

waffle Spinning waffle from waffle shaped python code Based on a parametric curve: r(t) = 2 - 2*sin(t) + (sin(t)*abs(cos(t)))/(sin(t) + 1.4) projected

Viljar Femoen 5 Feb 14, 2022
This scrypt for auto brightness control

God damn. This scrypt for auto brightness control. The scrypt has voice assistant. You should move this script to auto-upload folder. What do you need

0 Jul 25, 2022
Nesse repositório serão armazenados os conteúdos de aula

Lets_Code_DS_Degree_Alunos Nesse repositório serão armazenados os conteúdos de aula Formato das aulas: Notebook de aula já vem comentado para reduzir

Patricia Bongiovanni Catandi 6 Jan 21, 2022
"Cambio de monedas" Change-making problem with Python, dynamic programming best solutions,

Change-making-problem / Cambio de monedas Entendiendo el problema Dada una cantidad de dinero y una lista de denominaciones de monedas, encontrar el n

Juan Antonio Ayola Cortes 1 Dec 08, 2021
ioztat is a storage load analysis tool for OpenZFS

ioztat is a storage load analysis tool for OpenZFS. It provides iostat-like statistics at an individual dataset/zvol level.

Jim Salter 116 Nov 25, 2022
lets learn Python language with basic examples. highly recommended for beginners who just start coding.

Lets Learn Python 🐍 Learn python from basic programs. learn python from scratch. 1.Online python compiler: https://www.onlinegdb.com/online_python_co

Subhranshu Choudhury 1 Jan 18, 2022
dragmap-meth: Fast and accurate aligner for bisulfite sequencing reads using dragmap

dragmap_meth (dragmap_meth.py) Alignment of BS-Seq reads using dragmap. Intro This works for single-end reads and for paired-end reads from the direct

Shaojun Xie 3 Jul 14, 2022
🤖🧭Creates google-like navigation menu using python-telegram-bot wrapper

python telegram bot menu pagination Makes a google style pagination line for a list of items. In other words it builds a menu for navigation if you ha

Sergey Smirnov 9 Nov 27, 2022
A simple service that allows you to run commands on the server using text

Server Text A simple flask service that allows you to run commands on the server/computer over sms. Think of it as a shell where you run commands over

MT Devs 49 Nov 09, 2021
A performant state estimator for power system

A state estimator for power system. Turbocharged with sparse matrix support, JIT, SIMD and improved ordering.

9 Dec 12, 2022
Curso de Python 3 do Básico ao Avançado

Curso de Python 3 do Básico ao Avançado Desafio: Buscador de arquivos Criar um programa que faça a pesquisa de arquivos. É fornecido o caminho e um te

Diego Guedes 1 Jan 21, 2022
Sacred is a tool to help you configure, organize, log and reproduce experiments developed at IDSIA.

Sacred Every experiment is sacred Every experiment is great If an experiment is wasted God gets quite irate Sacred is a tool to help you configure, or

IDSIA 4k Jan 02, 2023
A simple projects to help your seo optimizing has been written with python

python-seo-projects it is a very simple projects to help your seo optimizing has been written with python broken link checker with python(it will give

Amirmohammad Razmy 3 Dec 25, 2021
The little-endian version of MessagePack

MessagePackEL This is the little-endian version of MessagePack, except the endianness is different, the rest is exactly the same as MessagePack. C lib

dukelec 9 May 13, 2022
Q-Tracker is originally a High School Project created by Admins of Cirus Lab.

Q-Tracker is originally a High School Project created by Admins of Cirus Lab. It's completly coded in python along with mysql.(Tkinter For GUI)

Adithya Krishnan 2 Nov 14, 2022
Self sustained producer-consumer(prosumer) policy study using Python and Gurobi

Prosumer Policy This project aims to model the optimum dispatch behaviour of households with PV and battery systems under different policy instrument

Tom Xu 3 Aug 31, 2022
Project repository of Apache Airflow, deployed on Docker in Amazon EC2 via GitLab.

Airflow on Docker in EC2 + GitLab's CI/CD Personal project for simple data pipeline using Airflow. Airflow will be installed inside Docker container,

Ammar Chalifah 13 Nov 29, 2022
The repository for AnyMacro: a Fusion360 Add-In

AnyMacro AnyMacro is an Autodesk® Fusion 360™ add-in for chaining multiple commands in a row to form Macros. Macros are created from a set of commands

1 Jan 07, 2022