Giter Club home page Giter Club logo

poetry-import-plugin's Introduction

Poetry Import Plugin

PyPI version PyPI - Python Version GitHub issues pre-commit enable main semantic-release

poetry-import-plugin is a Python plugin for Poetry that simplifies the process of importing dependencies from requirements.txt files into a Poetry project. It allows you to integrate dependencies into specified dependency groups within the project's pyproject.toml file, optionally applying constraints from a constraints file. This plugin also supports updating the Poetry lock file and installing dependencies.

ps. It is renamed from Req2Toml

Features

  • Import dependencies from multiple requirements.txt files into specified groups.
  • Apply version constraints from a constraints file.

Installation

Please follow the official docs for the latest available methods.

Currently (as of 2024), poetry provides three ways to install the plugin:

With pipx inject

# To install
pipx inject poetry poetry-import-plugin

# To uninstall
pipx uninject poetry poetry-import-plugin

With pip

# To install
$POETRY_HOME/bin/pip install --no-cache-dir poetry-import-plugin

# To uninstall
$POETRY_HOME/bin/pip uninstall poetry-import-plugin

The self add command (not recommended for Windows users)

# To install
poetry self add poetry-import-plugin

# To uninstall
poetry self remove poetry-import-plugin

Usage

The import command can be used to import dependencies from requirements.txt files into your Poetry project. Below are the available options and arguments:

Arguments

  • files (optional, multiple): The requirements.txt files to import.

Options

  • --group, -g (optional, multiple): Specifies the dependency group(s) into which the dependencies will be imported. Multiple groups can be specified, each followed by a list of dependency files to import.
  • --constraint, -c (optional): Specifies a constraint file to apply version restrictions on dependencies during import.
  • --lock (optional): Updates the Poetry lock file without installing the packages.
  • --no-update (optional): Prevents updating the lock file when running the lock operation.
  • --install (optional): Runs a Poetry installation to install all dependencies defined in pyproject.toml.

Examples

  1. Import dependencies from requirements.txt into the default group:

    poetry import requirements.txt
  2. Import dependencies from multiple requirements.txt files into specific groups:

    poetry import -g dev dev-requirements.txt -g test test-requirements.txt
  3. Apply constraints from a constraints file during import:

    poetry import -c constraints.txt requirements.txt
  4. Update the Poetry lock file after importing dependencies:

    poetry import --lock requirements.txt
  5. Install all dependencies after importing:

    poetry import --install requirements.txt

Contact

For any questions or feedback, please open an issue on the GitHub repository or contact the author.

poetry-import-plugin's People

Contributors

benbenbang avatar miketheman avatar ptah-lgtm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

miketheman

poetry-import-plugin's Issues

semantic release version compatibility issue

Initial Checks

  • I confirm that I'm using Poetry-import-plugin

Description

known issue, need to be addressed

Example Code

check workflow

Python, verion of poetry-import-plugin. your applications settings & OS Version

check workflow

Affected Components

  • Poetry version
  • Operating system is provided
  • Provide IDE screenshot if it's possible

v2 - req2toml

This project will soon introduce a breaking change.

  • The core functionality will be improved
  • It won't be a standalone package anymore. It will be implemented as a poetry's plugin, e.g.
poetry req2toml -f ....

like so

  • The plugin name will be changed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.