poetry-python-downgrader


Namepoetry-python-downgrader JSON
Version 0.1.6 PyPI version JSON
download
home_pagehttps://github.com/rizerphe/poetry-python-downgrader
SummaryA tool to downgrade poetry packages for compatibility with specific Python versions.
upload_time2024-08-01 11:24:20
maintainerNone
docs_urlNone
authorrizerphe
requires_python<4.0,>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Poetry Python Downgrader

A tool to downgrade Poetry packages for compatibility with specific Python versions.

[![Build](https://github.com/rizerphe/poetry-python-downgrader/actions/workflows/build.yml/badge.svg)](https://github.com/rizerphe/poetry-python-downgrader/actions/workflows/build.yml) [![Coverage Status](https://coveralls.io/repos/github/rizerphe/poetry-python-downgrader/badge.svg?branch=main)](https://coveralls.io/github/rizerphe/poetry-python-downgrader?branch=main) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PyPI version](https://badge.fury.io/py/poetry-python-downgrader.svg)](https://badge.fury.io/py/poetry-python-downgrader) [![As a github action](https://img.shields.io/badge/As_a_github_action-black?logo=GitHub%20Actions&logoColor=white)](https://github.com/rizerphe/poetry-python-downgrader-action)

This project is also available [as a GitHub Action](https://github.com/rizerphe/poetry-python-downgrader-action)!

## Quickstart

```sh
downgrade-pyproject-for-python pyproject.toml 3.8 --in-place
```

This command will modify your `pyproject.toml` file to make it compatible with Python 3.8. I would not recommend using the generated `pyproject.toml` file for anything but testing whether your project can be made compatible with a specific python version - this is in no way reliable enough to publish.

## Installation

**Using pipx (recommended)**

```sh
pipx install poetry-python-downgrader
```

## How it works

Poetry Python Downgrader analyzes your `pyproject.toml` file and performs the following steps:

-   Reads the current dependencies and their version constraints.
-   For each dependency, it queries PyPI to find the highest version compatible with the target Python version.
-   Updates the `pyproject.toml` file with the new version constraints.
-   Removes dependencies that don't have a compatible version for the target Python version.
-   Updates the Python version requirement in the `pyproject.toml` file.

## Usage examples

**Basic usage**

```sh
downgrade-pyproject-for-python pyproject.toml 3.8
```

This command will print the updated `pyproject.toml` content to stdout.

**Save to a new file**

```sh
downgrade-pyproject-for-python pyproject.toml 3.8 -o new_pyproject.toml
```

This will save the updated content to `new_pyproject.toml`.

**Modify the original file**

```sh
downgrade-pyproject-for-python pyproject.toml 3.8 --in-place
```

**Pin versions**

```sh
downgrade-pyproject-for-python pyproject.toml 3.8 --pin-versions
```

This will pin the versions to exact compatible versions instead of using caret ranges; as a result you'll have a guarantee of never having too new of a version installed, which is useful in CI.

**Use a Custom PyPI Repository**

```sh
downgrade-pyproject-for-python pyproject.toml 3.8 -r https://custom-pypi.example.com/pypi
```

This doesn't add the custom repository, but replaces pypi with it, so only dependencies available there will stay.

## Backstory

This project was born out of a specific need in a complex Python project. The project was being developed for Python 3.10 and consisted of multiple independent components targeting different platforms. The goal was to continuously determine which components would work with Python 3.8 without manually downgrading each dependency every time.

The challenge was that some dependencies had Python 3.10 as the minimum requirement, and some were only compatible with 3.8 up to a specific version, making it impossible to simply run the tests on Python 3.8. The solution was to create a tool that could automatically downgrade all dependencies to be Python 3.8-compatible, remove incompatible dependencies.

This is the result, providing an automated way to adjust `pyproject.toml` files for compatibility with earlier Python versions.

## Note on Using Poetry's Internal APIs

This project directly uses some of Poetry's internal APIs, which is generally not recommended for production use. While this approach works well for a small project like this, one that's not ever meant to be used in a production environment, be aware that future updates to Poetry might break compatibility. Use this tool with caution and feel free to open an issue if something breaks!

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rizerphe/poetry-python-downgrader",
    "name": "poetry-python-downgrader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "rizerphe",
    "author_email": "44440399+rizerphe@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/2f/06/884b4c40e96238e6b19894c4ac43f2a24b7314f9a496ed1fb04b7502298d/poetry_python_downgrader-0.1.6.tar.gz",
    "platform": null,
    "description": "# Poetry Python Downgrader\n\nA tool to downgrade Poetry packages for compatibility with specific Python versions.\n\n[![Build](https://github.com/rizerphe/poetry-python-downgrader/actions/workflows/build.yml/badge.svg)](https://github.com/rizerphe/poetry-python-downgrader/actions/workflows/build.yml) [![Coverage Status](https://coveralls.io/repos/github/rizerphe/poetry-python-downgrader/badge.svg?branch=main)](https://coveralls.io/github/rizerphe/poetry-python-downgrader?branch=main) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![PyPI version](https://badge.fury.io/py/poetry-python-downgrader.svg)](https://badge.fury.io/py/poetry-python-downgrader) [![As a github action](https://img.shields.io/badge/As_a_github_action-black?logo=GitHub%20Actions&logoColor=white)](https://github.com/rizerphe/poetry-python-downgrader-action)\n\nThis project is also available [as a GitHub Action](https://github.com/rizerphe/poetry-python-downgrader-action)!\n\n## Quickstart\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8 --in-place\n```\n\nThis command will modify your `pyproject.toml` file to make it compatible with Python 3.8. I would not recommend using the generated `pyproject.toml` file for anything but testing whether your project can be made compatible with a specific python version - this is in no way reliable enough to publish.\n\n## Installation\n\n**Using pipx (recommended)**\n\n```sh\npipx install poetry-python-downgrader\n```\n\n## How it works\n\nPoetry Python Downgrader analyzes your `pyproject.toml` file and performs the following steps:\n\n-   Reads the current dependencies and their version constraints.\n-   For each dependency, it queries PyPI to find the highest version compatible with the target Python version.\n-   Updates the `pyproject.toml` file with the new version constraints.\n-   Removes dependencies that don't have a compatible version for the target Python version.\n-   Updates the Python version requirement in the `pyproject.toml` file.\n\n## Usage examples\n\n**Basic usage**\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8\n```\n\nThis command will print the updated `pyproject.toml` content to stdout.\n\n**Save to a new file**\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8 -o new_pyproject.toml\n```\n\nThis will save the updated content to `new_pyproject.toml`.\n\n**Modify the original file**\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8 --in-place\n```\n\n**Pin versions**\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8 --pin-versions\n```\n\nThis will pin the versions to exact compatible versions instead of using caret ranges; as a result you'll have a guarantee of never having too new of a version installed, which is useful in CI.\n\n**Use a Custom PyPI Repository**\n\n```sh\ndowngrade-pyproject-for-python pyproject.toml 3.8 -r https://custom-pypi.example.com/pypi\n```\n\nThis doesn't add the custom repository, but replaces pypi with it, so only dependencies available there will stay.\n\n## Backstory\n\nThis project was born out of a specific need in a complex Python project. The project was being developed for Python 3.10 and consisted of multiple independent components targeting different platforms. The goal was to continuously determine which components would work with Python 3.8 without manually downgrading each dependency every time.\n\nThe challenge was that some dependencies had Python 3.10 as the minimum requirement, and some were only compatible with 3.8 up to a specific version, making it impossible to simply run the tests on Python 3.8. The solution was to create a tool that could automatically downgrade all dependencies to be Python 3.8-compatible, remove incompatible dependencies.\n\nThis is the result, providing an automated way to adjust `pyproject.toml` files for compatibility with earlier Python versions.\n\n## Note on Using Poetry's Internal APIs\n\nThis project directly uses some of Poetry's internal APIs, which is generally not recommended for production use. While this approach works well for a small project like this, one that's not ever meant to be used in a production environment, be aware that future updates to Poetry might break compatibility. Use this tool with caution and feel free to open an issue if something breaks!\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A tool to downgrade poetry packages for compatibility with specific Python versions.",
    "version": "0.1.6",
    "project_urls": {
        "Homepage": "https://github.com/rizerphe/poetry-python-downgrader"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8d5515ccdb45346707f885360b19f32b1635e0b54b65d5866bdc33209da2a9c",
                "md5": "5f95e581d693b26c9db7d35c5d958318",
                "sha256": "9c9ae96e84683b49bfc2962c527ea088128ed73cec1895269d7ebc08b3bca80d"
            },
            "downloads": -1,
            "filename": "poetry_python_downgrader-0.1.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f95e581d693b26c9db7d35c5d958318",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 10107,
            "upload_time": "2024-08-01T11:24:19",
            "upload_time_iso_8601": "2024-08-01T11:24:19.817654Z",
            "url": "https://files.pythonhosted.org/packages/c8/d5/515ccdb45346707f885360b19f32b1635e0b54b65d5866bdc33209da2a9c/poetry_python_downgrader-0.1.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f06884b4c40e96238e6b19894c4ac43f2a24b7314f9a496ed1fb04b7502298d",
                "md5": "f946bacbb6d803555c0488bbf1b09b32",
                "sha256": "4ef1219089ad2988323d1e271efa5dc51121b2c052acbe17668643297bc7b2b5"
            },
            "downloads": -1,
            "filename": "poetry_python_downgrader-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "f946bacbb6d803555c0488bbf1b09b32",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 8612,
            "upload_time": "2024-08-01T11:24:20",
            "upload_time_iso_8601": "2024-08-01T11:24:20.958707Z",
            "url": "https://files.pythonhosted.org/packages/2f/06/884b4c40e96238e6b19894c4ac43f2a24b7314f9a496ed1fb04b7502298d/poetry_python_downgrader-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 11:24:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rizerphe",
    "github_project": "poetry-python-downgrader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "poetry-python-downgrader"
}
        
Elapsed time: 0.30387s