uv-version


Nameuv-version JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryCLI tool for managing package version
upload_time2024-11-12 21:58:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords rocshers uvxt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # uv-version

CLI tool for managing package version

[![PyPI](https://img.shields.io/pypi/v/uv-version)](https://pypi.org/project/uv-version/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/uv-version)](https://pypi.org/project/uv-version/)
[![uvxt](https://img.shields.io/badge/family-uvxt-purple)](https://pypi.org/project/uvxt/)

[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=rocshers_uv-version&metric=coverage)](https://sonarcloud.io/summary/new_code?id=rocshers_uv-version)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rocshers_uv-version&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rocshers_uv-version)

[![Downloads](https://static.pepy.tech/badge/uv-version)](https://pepy.tech/project/uv-version)
[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/uv-version)](https://gitlab.com/rocshers/python/uv-version)
[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/uv-version)](https://gitlab.com/rocshers/python/uv-version)

## Functionality

- Parsing: `git`, `pyproject.toml`, `env`, `stdin`
- Output to: `pyproject.toml`, `stdout`
- `Increment`

## Quick start

```bash
uvx uv-version increment
```

## Configs

## Commands

### Arguments for using version

- `--to-pyproject`: Set a new version in pyproject.toml. \[Default\]
- `--to-print`: Print the new version to the console.

### Arguments for getting version

- `--from-pyproject`: Version is determined by the value in pyproject.toml project.version \[Default\]
- `--from-git`: Version is determined based on the `git status`
- `--from-stdin`: Version is expected as the last argument of the call or from stdin
- `--from-env`: Version is expected in the environment variable `$PACKAGE_VERSION`.

You can use multiple attributes together.

When retrieving the version from different sources, keep in mind that the **highest version will be used** in the end.

### uvx increment

Increases the version by 1

```bash
$ uvx uv-version --to-print
0.1.1
$ uvx uv-version --to-print increment prerelease
0.1.2a1
$ uvx uv-version --to-print increment micro
0.1.3
$ uvx uv-version --to-print increment minor
0.2.0
$ uvx uv-version --to-print increment major
1.0.0
```

## Use cases

### Publishing python package to pypi via uv with version equal to git tag

.gitlab-ci.yml:

```yaml
pypi:
  stage: publishing
  image: ghcr.io/astral-sh/uv:python3.12-bookworm-slim
  tags:
    - docker
  script:
    - apt install git
    - uvx uv-version --from-git
    - uv build --no-sources
    - uv publish
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
```

- When creating a git tag: new package with version == {TAG}
- When pushing to CI_DEFAULT_BRANCH: new package with version == {TAG}a{N}

### Publishing python package to private pypi via uv with version equal to git tag and commit hash

.gitlab-ci.yml:

```yaml
pypi:
  stage: publishing
  image: ghcr.io/astral-sh/uv:python3.12-bookworm-slim
  tags:
    - docker
  script:
    - apt install git
    # set alpha version template
    - PACKAGE_VERSION_ALPHA_VERSION_FORMAT='{version}a{distance}+{commit_hash}'
    # Update package version
    - uvx uv-version --from-git
    # Publishing to gitlab
    - UV_PUBLISH_URL=https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/pypi
    - UV_PUBLISH_TOKEN=${PYPI_TOKEN}
    - uv build --no-sources
    - uv publish
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
```

- When creating a git tag: new package with version == {TAG}
- When pushing to CI_DEFAULT_BRANCH: new package with version == {TAG}a{N}+{COMMIT_HASH}

## Roadmap

- logging
- tests
- version construct
- Set to `__init__`, `__version__`,`VERSION` files

## Contribute

Issue Tracker: <https://gitlab.com/rocshers/python/uv-version/-/issues>  
Source Code: <https://gitlab.com/rocshers/python/uv-version>

Before adding changes:

```bash
make install-dev
```

After changes:

```bash
make format test
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "uv-version",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "rocshers, uvxt",
    "author": null,
    "author_email": "Alekse Marusich <alekse.marusich@rocshers.com>",
    "download_url": "https://files.pythonhosted.org/packages/0d/88/04422cd04bda0c4a08b50534f25f11fdbe1664de128d6d1ae87bc1482c40/uv_version-0.1.8.tar.gz",
    "platform": null,
    "description": "# uv-version\n\nCLI tool for managing package version\n\n[![PyPI](https://img.shields.io/pypi/v/uv-version)](https://pypi.org/project/uv-version/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/uv-version)](https://pypi.org/project/uv-version/)\n[![uvxt](https://img.shields.io/badge/family-uvxt-purple)](https://pypi.org/project/uvxt/)\n\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=rocshers_uv-version&metric=coverage)](https://sonarcloud.io/summary/new_code?id=rocshers_uv-version)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rocshers_uv-version&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rocshers_uv-version)\n\n[![Downloads](https://static.pepy.tech/badge/uv-version)](https://pepy.tech/project/uv-version)\n[![GitLab stars](https://img.shields.io/gitlab/stars/rocshers/python/uv-version)](https://gitlab.com/rocshers/python/uv-version)\n[![GitLab last commit](https://img.shields.io/gitlab/last-commit/rocshers/python/uv-version)](https://gitlab.com/rocshers/python/uv-version)\n\n## Functionality\n\n- Parsing: `git`, `pyproject.toml`, `env`, `stdin`\n- Output to: `pyproject.toml`, `stdout`\n- `Increment`\n\n## Quick start\n\n```bash\nuvx uv-version increment\n```\n\n## Configs\n\n## Commands\n\n### Arguments for using version\n\n- `--to-pyproject`: Set a new version in pyproject.toml. \\[Default\\]\n- `--to-print`: Print the new version to the console.\n\n### Arguments for getting version\n\n- `--from-pyproject`: Version is determined by the value in pyproject.toml project.version \\[Default\\]\n- `--from-git`: Version is determined based on the `git status`\n- `--from-stdin`: Version is expected as the last argument of the call or from stdin\n- `--from-env`: Version is expected in the environment variable `$PACKAGE_VERSION`.\n\nYou can use multiple attributes together.\n\nWhen retrieving the version from different sources, keep in mind that the **highest version will be used** in the end.\n\n### uvx increment\n\nIncreases the version by 1\n\n```bash\n$ uvx uv-version --to-print\n0.1.1\n$ uvx uv-version --to-print increment prerelease\n0.1.2a1\n$ uvx uv-version --to-print increment micro\n0.1.3\n$ uvx uv-version --to-print increment minor\n0.2.0\n$ uvx uv-version --to-print increment major\n1.0.0\n```\n\n## Use cases\n\n### Publishing python package to pypi via uv with version equal to git tag\n\n.gitlab-ci.yml:\n\n```yaml\npypi:\n  stage: publishing\n  image: ghcr.io/astral-sh/uv:python3.12-bookworm-slim\n  tags:\n    - docker\n  script:\n    - apt install git\n    - uvx uv-version --from-git\n    - uv build --no-sources\n    - uv publish\n  rules:\n    - if: $CI_COMMIT_TAG\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n```\n\n- When creating a git tag: new package with version == {TAG}\n- When pushing to CI_DEFAULT_BRANCH: new package with version == {TAG}a{N}\n\n### Publishing python package to private pypi via uv with version equal to git tag and commit hash\n\n.gitlab-ci.yml:\n\n```yaml\npypi:\n  stage: publishing\n  image: ghcr.io/astral-sh/uv:python3.12-bookworm-slim\n  tags:\n    - docker\n  script:\n    - apt install git\n    # set alpha version template\n    - PACKAGE_VERSION_ALPHA_VERSION_FORMAT='{version}a{distance}+{commit_hash}'\n    # Update package version\n    - uvx uv-version --from-git\n    # Publishing to gitlab\n    - UV_PUBLISH_URL=https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/pypi\n    - UV_PUBLISH_TOKEN=${PYPI_TOKEN}\n    - uv build --no-sources\n    - uv publish\n  rules:\n    - if: $CI_COMMIT_TAG\n    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH\n```\n\n- When creating a git tag: new package with version == {TAG}\n- When pushing to CI_DEFAULT_BRANCH: new package with version == {TAG}a{N}+{COMMIT_HASH}\n\n## Roadmap\n\n- logging\n- tests\n- version construct\n- Set to `__init__`, `__version__`,`VERSION` files\n\n## Contribute\n\nIssue Tracker: <https://gitlab.com/rocshers/python/uv-version/-/issues>  \nSource Code: <https://gitlab.com/rocshers/python/uv-version>\n\nBefore adding changes:\n\n```bash\nmake install-dev\n```\n\nAfter changes:\n\n```bash\nmake format test\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI tool for managing package version",
    "version": "0.1.8",
    "project_urls": null,
    "split_keywords": [
        "rocshers",
        " uvxt"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aa4031fc58324cc9ec9f0a40e77235d25fde3d13fab9d3f44fdc935cfb1ae62b",
                "md5": "eb0f40ca0a77b311d3b3673955b42251",
                "sha256": "646ea56109251848f4804fe8204b54bd17f70bafa5447c5751a6f561ec09ab6d"
            },
            "downloads": -1,
            "filename": "uv_version-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eb0f40ca0a77b311d3b3673955b42251",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9441,
            "upload_time": "2024-11-12T21:58:35",
            "upload_time_iso_8601": "2024-11-12T21:58:35.830212Z",
            "url": "https://files.pythonhosted.org/packages/aa/40/31fc58324cc9ec9f0a40e77235d25fde3d13fab9d3f44fdc935cfb1ae62b/uv_version-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0d8804422cd04bda0c4a08b50534f25f11fdbe1664de128d6d1ae87bc1482c40",
                "md5": "f9c42cc680ae0bb5a751a0ac68f26da8",
                "sha256": "b456240e741212bc9441e9a00bec3bc31106d050fcb28f06891eee83450c19d8"
            },
            "downloads": -1,
            "filename": "uv_version-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "f9c42cc680ae0bb5a751a0ac68f26da8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9246,
            "upload_time": "2024-11-12T21:58:36",
            "upload_time_iso_8601": "2024-11-12T21:58:36.898318Z",
            "url": "https://files.pythonhosted.org/packages/0d/88/04422cd04bda0c4a08b50534f25f11fdbe1664de128d6d1ae87bc1482c40/uv_version-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 21:58:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "uv-version"
}
        
Elapsed time: 1.06789s