Giter Site home page Giter Site logo

hatch-requirements-txt's Introduction

hatch-requirements-txt

Hatchling plugin to read project dependencies from requirements.txt

Tests Linux Test Status Windows Test Status macOS Test Status Coverage
PyPI PyPI - Package Version PyPI - Supported Python Versions PyPI - Supported Implementations PyPI - Wheel
Anaconda Conda - Package Version Conda - Platform
Activity GitHub last commit Maintenance PyPI - Downloads
QA CodeFactor Grade Flake8 Status mypy status
Other Hatch project License GitHub top language Requirements Status

Usage

In your pyproject.toml make the following changes:

  • Append hatch-requirements-txt to build-system.requires.
  • Append "dependencies" to project.dynamic.
  • Add the following table:
[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

The resulting pyproject.toml should look something like:

[build-system]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
name = "my-project"
version = "1.0.0"
dynamic = ["dependencies"]

[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]

You can also define groups of optional dependencies (also known as "features") by appending optional-dependencies to project.dynamic and adding a table like:

[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
crypto = ["requirements-crypto.txt"]
fastjson = ["requirements-fastjson.txt"]
cli = ["requirements-cli.txt"]

Requirements file format

hatch-requirements-txt only supports a subset of the requirements.txt format supported by pip. The following are supported:

  • requirement specifiers, per PEP 508
  • Comments, prefixed with a #.
  • --<option> options, both on their own line and after a requirement specifier. Note however that the options themselves are ignored.

The following are unsupported within requirements.txt files:

  • Editable install commands with the -e option,
  • References to other requirements or constraints files with the -r or -c options.
  • References to paths on the local filesystem, or URLs.

TL;DR For best compatibility, ensure all lines in your requirements.txt files are valid PEP 508 requirements, or comments starting with a #.

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.