php-version-compare


Namephp-version-compare JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryPHP-compatible version comparison for Python
upload_time2024-09-15 20:52:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseNone
keywords compare comparison compatibility php version
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # php-version-compare

[![Test](https://github.com/marcfrederick/php-version-compare/actions/workflows/test.yml/badge.svg)](https://github.com/marcfrederick/php-version-compare/actions/workflows/test.yml)
[![PyPI version](https://badge.fury.io/py/php-version-compare.svg)](https://badge.fury.io/py/php-version-compare)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/php-version-compare)](https://pypi.org/project/php-version-compare/)
[![PyPI - License](https://img.shields.io/pypi/l/php-version-compare)](https://pypi.org/project/php-version-compare/)

> ℹ️ **Note**: This project is feature-complete and will only receive updates for bug fixes or compatibility with new
> Python versions. No new features are planned. If you require additional features, please consider forking the project.

A simple Python library for comparing version strings in a manner compatible with PHP's
[version_compare](https://www.php.net/manual/en/function.version-compare.php) function.
Although this implementation is not derived from PHP's code, it passes the same tests to ensure compatibility.

## Installation

To install `php-version-compare`, use pip:

```bash
pip install php-version-compare
```

## Usage

### Documentation

The complete documentation can be found on
[Read the Docs](https://php-version-compare.readthedocs.io/).

### Basic Usage

```python
from php_version_compare import version_compare

# Without operator
print(version_compare('1.0', '1.1'))  # Output: -1
print(version_compare('1.1', '1.0'))  # Output: 1
print(version_compare('1.0', '1.0'))  # Output: 0

# With operator
print(version_compare('1.1', '1.0.0', operator='>='))  # Output: True
print(version_compare('1.0.0', '1.1', operator='<='))  # Output: True
print(version_compare('1.0', '1.0', operator='!='))  # Output: False
```

## Contributing

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Make your changes.
4. Commit your changes (`git commit -m 'Add new feature'`).
5. Push to the branch (`git push origin feature-branch`).
6. Open a pull request.

### Running Tests

To run tests, make sure you have `tox` installed and run the following command, which will run the tests for all
supported Python versions that are installed on your system:

```bash
tox
```

If you only want to run the tests for a specific Python version, you can specify the version:

```bash
tox -e py39
```

## License

This project is licensed under either of the following, at your option:

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
  [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0))
- MIT License ([LICENSE-MIT](LICENSE-MIT) or
  [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))

Which license to use is up to you. This project is dual-licensed for compatibility with both.
When contributing, you agree to license your contributions under the same terms.

## Versioning

This project uses [Semantic Versioning](https://semver.org/). For the versions available, see
the [tags on this repository](https://github.com/marcfrederick/php-version-compare/tags) or the
[releases page](https://github.com/marcfrederick/php-version-compare/releases).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "php-version-compare",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "compare, comparison, compatibility, php, version",
    "author": null,
    "author_email": "Marc Tr\u00f6litzsch <marc.troelitzsch@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/30/f5/b8b2e5fdab32a3ca4e39fd6cd9e6e03bd9e661903caa2c4cfd6c8f2c04f3/php_version_compare-1.1.1.tar.gz",
    "platform": null,
    "description": "# php-version-compare\n\n[![Test](https://github.com/marcfrederick/php-version-compare/actions/workflows/test.yml/badge.svg)](https://github.com/marcfrederick/php-version-compare/actions/workflows/test.yml)\n[![PyPI version](https://badge.fury.io/py/php-version-compare.svg)](https://badge.fury.io/py/php-version-compare)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/php-version-compare)](https://pypi.org/project/php-version-compare/)\n[![PyPI - License](https://img.shields.io/pypi/l/php-version-compare)](https://pypi.org/project/php-version-compare/)\n\n> \u2139\ufe0f **Note**: This project is feature-complete and will only receive updates for bug fixes or compatibility with new\n> Python versions. No new features are planned. If you require additional features, please consider forking the project.\n\nA simple Python library for comparing version strings in a manner compatible with PHP's\n[version_compare](https://www.php.net/manual/en/function.version-compare.php) function.\nAlthough this implementation is not derived from PHP's code, it passes the same tests to ensure compatibility.\n\n## Installation\n\nTo install `php-version-compare`, use pip:\n\n```bash\npip install php-version-compare\n```\n\n## Usage\n\n### Documentation\n\nThe complete documentation can be found on\n[Read the Docs](https://php-version-compare.readthedocs.io/).\n\n### Basic Usage\n\n```python\nfrom php_version_compare import version_compare\n\n# Without operator\nprint(version_compare('1.0', '1.1'))  # Output: -1\nprint(version_compare('1.1', '1.0'))  # Output: 1\nprint(version_compare('1.0', '1.0'))  # Output: 0\n\n# With operator\nprint(version_compare('1.1', '1.0.0', operator='>='))  # Output: True\nprint(version_compare('1.0.0', '1.1', operator='<='))  # Output: True\nprint(version_compare('1.0', '1.0', operator='!='))  # Output: False\n```\n\n## Contributing\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes.\n4. Commit your changes (`git commit -m 'Add new feature'`).\n5. Push to the branch (`git push origin feature-branch`).\n6. Open a pull request.\n\n### Running Tests\n\nTo run tests, make sure you have `tox` installed and run the following command, which will run the tests for all\nsupported Python versions that are installed on your system:\n\n```bash\ntox\n```\n\nIf you only want to run the tests for a specific Python version, you can specify the version:\n\n```bash\ntox -e py39\n```\n\n## License\n\nThis project is licensed under either of the following, at your option:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or\n  [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0))\n- MIT License ([LICENSE-MIT](LICENSE-MIT) or\n  [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT))\n\nWhich license to use is up to you. This project is dual-licensed for compatibility with both.\nWhen contributing, you agree to license your contributions under the same terms.\n\n## Versioning\n\nThis project uses [Semantic Versioning](https://semver.org/). For the versions available, see\nthe [tags on this repository](https://github.com/marcfrederick/php-version-compare/tags) or the\n[releases page](https://github.com/marcfrederick/php-version-compare/releases).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "PHP-compatible version comparison for Python",
    "version": "1.1.1",
    "project_urls": {
        "Changelog": "https://github.com/marcfrederick/php-version-compare/releases",
        "Documentation": "https://php-version-compare.readthedocs.io",
        "Issues": "https://github.com/marcfrederick/php-version-compare/issues",
        "Repository": "https://github.com/marcfrederick/php-version-compare"
    },
    "split_keywords": [
        "compare",
        " comparison",
        " compatibility",
        " php",
        " version"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1607605f9550f9e9ee4799880889ee8adc4b22cf0816402fe77a9eafefa21391",
                "md5": "008382ad495087f143e9f91f749f8d9e",
                "sha256": "d9be32c9c8ac3c6f1f5671b67dfbea3ad477f30c8be75b8b052cc907c4f0d11d"
            },
            "downloads": -1,
            "filename": "php_version_compare-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "008382ad495087f143e9f91f749f8d9e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9461,
            "upload_time": "2024-09-15T20:52:52",
            "upload_time_iso_8601": "2024-09-15T20:52:52.957134Z",
            "url": "https://files.pythonhosted.org/packages/16/07/605f9550f9e9ee4799880889ee8adc4b22cf0816402fe77a9eafefa21391/php_version_compare-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "30f5b8b2e5fdab32a3ca4e39fd6cd9e6e03bd9e661903caa2c4cfd6c8f2c04f3",
                "md5": "6269439d5eebdc92c95a19a9b8ed807b",
                "sha256": "750bc506ee65d77d270ecb3c2cffa033c99e2373e0ff9cb4427987013d4b67a4"
            },
            "downloads": -1,
            "filename": "php_version_compare-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6269439d5eebdc92c95a19a9b8ed807b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11001,
            "upload_time": "2024-09-15T20:52:54",
            "upload_time_iso_8601": "2024-09-15T20:52:54.400646Z",
            "url": "https://files.pythonhosted.org/packages/30/f5/b8b2e5fdab32a3ca4e39fd6cd9e6e03bd9e661903caa2c4cfd6c8f2c04f3/php_version_compare-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-15 20:52:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marcfrederick",
    "github_project": "php-version-compare",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "php-version-compare"
}
        
Elapsed time: 2.98568s