dephell-versioning


Namedephell-versioning JSON
Version 0.1.2 PyPI version JSON
download
home_page
SummaryLibrary for bumping project version like a pro
upload_time2020-05-30 05:22:18
maintainer
docs_urlNone
authorGram
requires_python>=3.6
licenseMIT
keywords dephell packaging version versions versioning bump bumping
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ## dephell_versioning

[![travis](https://travis-ci.org/dephell/dephell_versioning.svg?branch=master)](https://travis-ci.org/dephell/dephell_versioning)
[![appveyor](https://ci.appveyor.com/api/projects/status/github/dephell/dephell_versioning?svg=true)](https://ci.appveyor.com/project/orsinium/dephell-versioning)
[![MIT License](https://img.shields.io/pypi/l/dephell-versioning.svg)](https://github.com/dephell/dephell_versioning/blob/master/LICENSE)

Library for bumping project version.

Available schemes:

+ `calver`
+ `comver`
+ `pep`
+ `roman`
+ `romver`
+ `semver`
+ `serial`
+ `zerover`

Available rules (and aliases):

+ `init` -- initialize versioning
+ Main parts:
  + `major` (`breaking`)
  + `minor` (`feature`)
  + `patch` (`fix`, `micro`)
+ Additional parts:
  + `dev`
  + `local`
  + `post`
+ Pre-release management:
  + `pre` (`rc`, `alpha`, `beta`)
  + `premajor` (`prebreaking`)
  + `preminor` (`prefeature`)
  + `prepatch` (`prefix`, `premicro`)
  + `release`

Read more about schemes and rules in the documentation for [dephell project bump](https://dephell.readthedocs.io/en/latest/cmd-project-bump.html).

## Installation

install from [PyPI](https://pypi.org/project/dephell-versioning/):

```bash
python3 -m pip install --user dephell_versioning
```

## Usage

Get available schemes, rules, and aliases:

```python
from dephell_versioning import get_aliases, get_rules, get_schemes
get_schemes()
# frozenset({'roman', 'pep', ..., 'comver'})

get_rules()
# frozenset({'local', 'minor', ..., 'dev', 'preminor'})

get_aliases()
# frozenset({'alpha', 'rc', ..., 'micro', 'breaking'})

# get rules for some scheme:
get_rules(scheme='calver')
# frozenset({'major', 'patch', 'init'})

# get aliases for specific rules:
get_aliases(rules={'major', 'minor'})
# frozenset({'feature', 'breaking'})

```

Bump version:

```python
from dephell_versioning import bump_version

bump_version(version='1.2.3', rule='minor', scheme='semver')
# '1.3.0'

# pass aliase instead of rule:
bump_version(version='1.2.3', rule='feature', scheme='semver')
# '1.3.0'

# start rule from `+` to attach local version number:
bump_version(version='1.2.3', rule='+456', scheme='semver')
# '1.2.3+456'

# for `init` version is optional
bump_version(version='', rule='init', scheme='semver')
# '0.1.0'
```

Bump version in a python file:

```python
from dephell_versioning import bump_file
from pathlib import Path

# returns `True` if version was bumped
bump_file(path=Path('dephell_versioning', '__init__.py'), old='0.1.0', new='0.1.1')
# True

# old version is optional: any version will be bumped if old isn't found
bump_file(path=Path('dephell_versioning', '__init__.py'), old='', new='0.1.2')
# True
```

Use [dephell_discover](https://github.com/dephell/dephell_discover) to find out the current version in a python project:

```python
from dephell_discover import Root
from pathlib import Path
root = Root(path=Path(), name='dephell_discover')

# root.metainfo can be None if project isn't found in the given directory
if root.metainfo:
    print(root.metainfo.version)
# '0.1.2'
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dephell-versioning",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "dephell,packaging,version,versions,versioning,bump,bumping",
    "author": "Gram",
    "author_email": "mail@orsinium.dev",
    "download_url": "https://files.pythonhosted.org/packages/70/a2/a84d89721fc35a05ae08388161f79eecfb1c6fab333f5a42eb4924968c47/dephell_versioning-0.1.2.tar.gz",
    "platform": "None",
    "description": "## dephell_versioning\n\n[![travis](https://travis-ci.org/dephell/dephell_versioning.svg?branch=master)](https://travis-ci.org/dephell/dephell_versioning)\n[![appveyor](https://ci.appveyor.com/api/projects/status/github/dephell/dephell_versioning?svg=true)](https://ci.appveyor.com/project/orsinium/dephell-versioning)\n[![MIT License](https://img.shields.io/pypi/l/dephell-versioning.svg)](https://github.com/dephell/dephell_versioning/blob/master/LICENSE)\n\nLibrary for bumping project version.\n\nAvailable schemes:\n\n+ `calver`\n+ `comver`\n+ `pep`\n+ `roman`\n+ `romver`\n+ `semver`\n+ `serial`\n+ `zerover`\n\nAvailable rules (and aliases):\n\n+ `init` -- initialize versioning\n+ Main parts:\n  + `major` (`breaking`)\n  + `minor` (`feature`)\n  + `patch` (`fix`, `micro`)\n+ Additional parts:\n  + `dev`\n  + `local`\n  + `post`\n+ Pre-release management:\n  + `pre` (`rc`, `alpha`, `beta`)\n  + `premajor` (`prebreaking`)\n  + `preminor` (`prefeature`)\n  + `prepatch` (`prefix`, `premicro`)\n  + `release`\n\nRead more about schemes and rules in the documentation for [dephell project bump](https://dephell.readthedocs.io/en/latest/cmd-project-bump.html).\n\n## Installation\n\ninstall from [PyPI](https://pypi.org/project/dephell-versioning/):\n\n```bash\npython3 -m pip install --user dephell_versioning\n```\n\n## Usage\n\nGet available schemes, rules, and aliases:\n\n```python\nfrom dephell_versioning import get_aliases, get_rules, get_schemes\nget_schemes()\n# frozenset({'roman', 'pep', ..., 'comver'})\n\nget_rules()\n# frozenset({'local', 'minor', ..., 'dev', 'preminor'})\n\nget_aliases()\n# frozenset({'alpha', 'rc', ..., 'micro', 'breaking'})\n\n# get rules for some scheme:\nget_rules(scheme='calver')\n# frozenset({'major', 'patch', 'init'})\n\n# get aliases for specific rules:\nget_aliases(rules={'major', 'minor'})\n# frozenset({'feature', 'breaking'})\n\n```\n\nBump version:\n\n```python\nfrom dephell_versioning import bump_version\n\nbump_version(version='1.2.3', rule='minor', scheme='semver')\n# '1.3.0'\n\n# pass aliase instead of rule:\nbump_version(version='1.2.3', rule='feature', scheme='semver')\n# '1.3.0'\n\n# start rule from `+` to attach local version number:\nbump_version(version='1.2.3', rule='+456', scheme='semver')\n# '1.2.3+456'\n\n# for `init` version is optional\nbump_version(version='', rule='init', scheme='semver')\n# '0.1.0'\n```\n\nBump version in a python file:\n\n```python\nfrom dephell_versioning import bump_file\nfrom pathlib import Path\n\n# returns `True` if version was bumped\nbump_file(path=Path('dephell_versioning', '__init__.py'), old='0.1.0', new='0.1.1')\n# True\n\n# old version is optional: any version will be bumped if old isn't found\nbump_file(path=Path('dephell_versioning', '__init__.py'), old='', new='0.1.2')\n# True\n```\n\nUse [dephell_discover](https://github.com/dephell/dephell_discover) to find out the current version in a python project:\n\n```python\nfrom dephell_discover import Root\nfrom pathlib import Path\nroot = Root(path=Path(), name='dephell_discover')\n\n# root.metainfo can be None if project isn't found in the given directory\nif root.metainfo:\n    print(root.metainfo.version)\n# '0.1.2'\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Library for bumping project version like a pro",
    "version": "0.1.2",
    "project_urls": {
        "Repository": "https://github.com/dephell/dephell_versioning"
    },
    "split_keywords": [
        "dephell",
        "packaging",
        "version",
        "versions",
        "versioning",
        "bump",
        "bumping"
    ],
    "urls": [
        {
            "comment_text": "None",
            "digests": {
                "blake2b_256": "2999b45086363aee4a4136d277807c795394e66d63e1891d2164490fe745cb3a",
                "md5": "e30356c35061c98edf3b57b74dbfbf4a",
                "sha256": "28f611bd3ec1644e3d6972f901b9aa67a1fe2ed3fe57566f82afd9c43f5a335a"
            },
            "downloads": -1,
            "filename": "dephell_versioning-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e30356c35061c98edf3b57b74dbfbf4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11713,
            "upload_time": "2020-05-30T05:22:20",
            "upload_time_iso_8601": "2020-05-30T05:22:20.239030Z",
            "url": "https://files.pythonhosted.org/packages/29/99/b45086363aee4a4136d277807c795394e66d63e1891d2164490fe745cb3a/dephell_versioning-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "None",
            "digests": {
                "blake2b_256": "70a2a84d89721fc35a05ae08388161f79eecfb1c6fab333f5a42eb4924968c47",
                "md5": "73d736e689f4d8b483e9b4dd3a6c402b",
                "sha256": "9ba7636704af7bd64af5a64ab8efb482c8b0bf4868699722f5e2647763edf8e5"
            },
            "downloads": -1,
            "filename": "dephell_versioning-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "73d736e689f4d8b483e9b4dd3a6c402b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9736,
            "upload_time": "2020-05-30T05:22:18",
            "upload_time_iso_8601": "2020-05-30T05:22:18.393290Z",
            "url": "https://files.pythonhosted.org/packages/70/a2/a84d89721fc35a05ae08388161f79eecfb1c6fab333f5a42eb4924968c47/dephell_versioning-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-05-30 05:22:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dephell",
    "github_project": "dephell_versioning",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "lcname": "dephell-versioning"
}
        
Elapsed time: 0.17006s