dep-logic


Namedep-logic JSON
Version 0.4.10 PyPI version JSON
download
home_pageNone
SummaryPython dependency specifications supporting logical operations
upload_time2024-12-13 11:04:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache-2.0
keywords dependency specification logic packaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dep-Logic

![PyPI - Version](https://img.shields.io/pypi/v/dep-logic)
![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fpdm-project%2Fdep-logic%2Fmain%2Fpyproject.toml)
![GitHub License](https://img.shields.io/github/license/pdm-project/dep-logic)


Python dependency specifications supporting logical operations

## Installation

```bash
pip install dep-logic
```

This library requires Python 3.8 or later.

Currently, it contains two sub-modules:

- `dep_logic.specifier` - a module for parsing and calculating PEP 440 version specifiers.
- `dep_logic.markers` - a module for parsing and calculating PEP 508 environment markers.

## What does it do?

This library allows logic operations on version specifiers and environment markers.

For example:

```pycon
>>> from dep_logic.specifiers import parse_version_specifier
>>>
>>> a = parse_version_specifier(">=1.0.0")
>>> b = parse_version_specifier("<2.0.0")
>>> print(a & b)
>=1.0.0,<2.0.0
>>> a = parse_version_specifier(">=1.0.0,<2.0.0")
>>> b = parse_version_specifier(">1.5")
>>> print(a | b)
>=1.0.0
```

For markers:

```pycon
>>> from dep_logic.markers import parse_marker
>>> m1 = parse_marker("python_version < '3.8'")
>>> m2 = parse_marker("python_version >= '3.6'")
>>> print(m1 & m2)
python_version < "3.8" and python_version >= "3.6"
```

## About the project

This project is based on @sdispater's [poetry-core](https://github.com/python-poetry/poetry-core) code, but it includes additional packages and a lark parser, which increases the package size and makes it less reusable.

Furthermore, `poetry-core` does not always comply with PEP-508. As a result, this project aims to offer a lightweight utility for dependency specification logic using [PyPA's packaging](https://github.com/pypa/packaging).

Submodules:

- `dep_logic.specifiers` - PEP 440 version specifiers
- `dep_logic.markers` - PEP 508 environment markers
- `dep_logic.tags` - PEP 425 platform tags

## Caveats

Logic operations with `===<string>` specifiers is partially supported.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dep-logic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "dependency, specification, logic, packaging",
    "author": null,
    "author_email": "Frost Ming <me@frostming.com>",
    "download_url": "https://files.pythonhosted.org/packages/dc/75/a87a3f38ba5db338140fda00e586d243ef8cef132af051fe0572b023996f/dep_logic-0.4.10.tar.gz",
    "platform": null,
    "description": "# Dep-Logic\n\n![PyPI - Version](https://img.shields.io/pypi/v/dep-logic)\n![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fpdm-project%2Fdep-logic%2Fmain%2Fpyproject.toml)\n![GitHub License](https://img.shields.io/github/license/pdm-project/dep-logic)\n\n\nPython dependency specifications supporting logical operations\n\n## Installation\n\n```bash\npip install dep-logic\n```\n\nThis library requires Python 3.8 or later.\n\nCurrently, it contains two sub-modules:\n\n- `dep_logic.specifier` - a module for parsing and calculating PEP 440 version specifiers.\n- `dep_logic.markers` - a module for parsing and calculating PEP 508 environment markers.\n\n## What does it do?\n\nThis library allows logic operations on version specifiers and environment markers.\n\nFor example:\n\n```pycon\n>>> from dep_logic.specifiers import parse_version_specifier\n>>>\n>>> a = parse_version_specifier(\">=1.0.0\")\n>>> b = parse_version_specifier(\"<2.0.0\")\n>>> print(a & b)\n>=1.0.0,<2.0.0\n>>> a = parse_version_specifier(\">=1.0.0,<2.0.0\")\n>>> b = parse_version_specifier(\">1.5\")\n>>> print(a | b)\n>=1.0.0\n```\n\nFor markers:\n\n```pycon\n>>> from dep_logic.markers import parse_marker\n>>> m1 = parse_marker(\"python_version < '3.8'\")\n>>> m2 = parse_marker(\"python_version >= '3.6'\")\n>>> print(m1 & m2)\npython_version < \"3.8\" and python_version >= \"3.6\"\n```\n\n## About the project\n\nThis project is based on @sdispater's [poetry-core](https://github.com/python-poetry/poetry-core) code, but it includes additional packages and a lark parser, which increases the package size and makes it less reusable.\n\nFurthermore, `poetry-core` does not always comply with PEP-508. As a result, this project aims to offer a lightweight utility for dependency specification logic using [PyPA's packaging](https://github.com/pypa/packaging).\n\nSubmodules:\n\n- `dep_logic.specifiers` - PEP 440 version specifiers\n- `dep_logic.markers` - PEP 508 environment markers\n- `dep_logic.tags` - PEP 425 platform tags\n\n## Caveats\n\nLogic operations with `===<string>` specifiers is partially supported.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python dependency specifications supporting logical operations",
    "version": "0.4.10",
    "project_urls": null,
    "split_keywords": [
        "dependency",
        " specification",
        " logic",
        " packaging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fb4da96417e1b1731119c46c5be2e25a0542520c20a2d95d248e318553cfb8d",
                "md5": "e0270579e6bedff525bc9a2dce409d71",
                "sha256": "5be313254e8fb7cbbc45f6d3c525373fdff174b601c8383234b449c0d12a6c75"
            },
            "downloads": -1,
            "filename": "dep_logic-0.4.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0270579e6bedff525bc9a2dce409d71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 34478,
            "upload_time": "2024-12-13T11:04:40",
            "upload_time_iso_8601": "2024-12-13T11:04:40.362706Z",
            "url": "https://files.pythonhosted.org/packages/2f/b4/da96417e1b1731119c46c5be2e25a0542520c20a2d95d248e318553cfb8d/dep_logic-0.4.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc75a87a3f38ba5db338140fda00e586d243ef8cef132af051fe0572b023996f",
                "md5": "10fd5c0c445a6b19a797333eebc85abc",
                "sha256": "d2fe0626ae5700c5d3788f7105015a291bd1f4e4ae83287e7094e2feb503f859"
            },
            "downloads": -1,
            "filename": "dep_logic-0.4.10.tar.gz",
            "has_sig": false,
            "md5_digest": "10fd5c0c445a6b19a797333eebc85abc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 35432,
            "upload_time": "2024-12-13T11:04:44",
            "upload_time_iso_8601": "2024-12-13T11:04:44.189165Z",
            "url": "https://files.pythonhosted.org/packages/dc/75/a87a3f38ba5db338140fda00e586d243ef8cef132af051fe0572b023996f/dep_logic-0.4.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-13 11:04:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dep-logic"
}
        
Elapsed time: 2.06075s