Skip to main content

Python wrapper around Go module `github.com/rng70/versions` for parsing and sorting semver and non-semver-ish versions and constraints.

Project description

semverish

semverish is a simple go module designed to manage version information for different ecosystem like pypi.org, maven.org, npmjs.com, crates.io ect. in a structured manner.

Motivation

There are a lot of tools in different ecosystem .e.g github.com/go-simpler/goversion and github.com/Masterminds/semver in golang, semver in python and obviously there will be ecosystem specific package available to manage, parse and do a lot of operations on version strings of any package.

But the real life scenario is different, when dealing with multiple ecosystem and encountered different versioning of different packages, it becomes difficult to manage and parse them in a structured manner dut to non-semverish versioning followed by different maintainers.

So, here comes versions to rescue, it provides a structured way to manage version information for different ecosystem in a structured manner, do operations on them and parse them that cannot be parsed by these packages.

Installation

  pip install semverish

Usage

    import semverish
    
    print(semverish.natural_sorted_versions(
        ['1.0.0', '2.0.0', '1.2.0', '1.0.0-alpha', '1.0.0-beta.1', '1.0.0.beta2', 'rel-1.3.3', '1.3.4'],
        descending=False)
    )
    # output: ['1.0.0-alpha', '1.0.0-beta.1', '1.0.0.beta2', '1.0.0', '1.2.0', 'rel-1.3.3', '1.3.4', '2.0.0']
    
    print(semverish.analyze_constraints(
        'npm',
        '>1.1 <=2.9',
        ['1.1.1', '3.0', '2.9.9', '2.9.0', '1.9.0', '2.8.1', '1.0.0', '2.0.0', '1.2.0', '1.0.0-alpha', '1.0.0-beta.1', '1.0.0.beta2'])
    )
    # output: ['1.1.1', '3.0', '2.9.9', '2.9.0', '1.9.0', '2.8.1', '2.0.0', '1.2.0']
    
    print(semverish.analyze_constraints(
        language='python',
        constraints='>1.1,<=4.9',
        versions=['1.1.1', '3.0', '2.9.9', '2.9.0', '1.9.0', '2.8.1', '1.0.0', 'rel-2.0.0', '1.2.0', '1.0.0-alpha', '1.0.0-beta.1', 'rel_1.0.0.beta2'])
    )

Supported Ecosystem

  • pypi.org
  • maven.org
  • npmjs.com
  • crates.io
  • golang.org
  • rubygems.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semverish-1.0.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semverish-1.0.0-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file semverish-1.0.0.tar.gz.

File metadata

  • Download URL: semverish-1.0.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for semverish-1.0.0.tar.gz
Algorithm Hash digest
SHA256 74bd29ef3d081ce95470cfdc2bff3bd50b9b14e66c1c6e2b3f7247daec6e8faf
MD5 45f9abfde88a32697013b10fe0a7131d
BLAKE2b-256 447bfe0eeb0756bac1d26857ebc5f9b098f45c34da27907874bda50e846174f1

See more details on using hashes here.

File details

Details for the file semverish-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: semverish-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for semverish-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc1caf9041f97866f101aae76e5323b71792e2bda6da20cd31e0f2122b4a3030
MD5 e9ef118ee936e2f0d7010981bb5ea467
BLAKE2b-256 77f66eca4b4fbe0feb4bc0b6a210e69c1609d44991cb3fd8b54b80da9d685ba2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page