Skip to main content

A manager for versions. Modules with version requirements can be written as `ModuleName(==|>=|<=)1.2.3`. The VerManager is aimed at version control.

Project description

VerManager

Introduction

A manager for versions. Modules with version requirements can be written as ModuleName(==|>=|<=)1.2.3. The VerManager is aimed at version control.

Functions

Construct modules with version info

A class Module can be constructed with a string like 'ModuleName==1.2.3', where 1.2.3 is the version, which can optionally followed by an alphabetical postfix and that will be ignored when comparing, as described later.

Check if versions meet requirements

An requirements would have four possible semantics. If no version requirement is stated, the requirement should contains the module name only. Otherwise the module name should be followed by an relation operator, which can be ==, >= and <=. The operator indicates the current version should satisfy some relation with the stated version.

If the operator is ==, two versions should be exactly the same. In other cases, alphabetical parts will be ingore, i.e. module aaa==1.2.3.abc meets the requirement aaa>=1.2.3.cde.

If the current version fails to meet the requirement, the manager will try to find a suitable version and log 'should update to ...'. If no version can be found that satisfies all requirements, there must be conflict requirements. Note that all requirements will be recorded for later conflict analysis.

Examples

vm = VersionsManager()
vm.set_current_modules([
    'aaa==1.1.2',
    'bbb==0.8.23',
    'ccc=1.1.1',
    'ddd==a.b.c',
    'eee==1.2.4.abc'
])
print(vm.check_requirements([
    'aaa>=1.0.9',
    'aaa<=2.0',
    'bbb==0.8.27',
    'ccc==1.1.1',
    'ddd>=a.b.a',
    'eee>=1.2.4.cde',
    'fff==1.2',
    'eee=1',
    'eee==1.2.3'
]))

The print-out is

bbb should be updated to 0.8.27
No version ccc was found
No version ddd was found
No version fff was found
No version eee=1 was found
Unsolved conflict in version eee
{'fff', 'ccc', 'eee=1', 'ddd', 'bbb', 'eee'}

Update

v0.1.2

  • Categorise the unmet set into solvable and conflict two sets.
  • Replace module name check method to support - and _

v0.1.3

  • Remove python 3.8 syntax

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

vermanager-0.1.3.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file vermanager-0.1.3.tar.gz.

File metadata

  • Download URL: vermanager-0.1.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for vermanager-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d71e63b98cd09ac72a0e1a4ff6cc2a0be46b7be4fcd12aa955e523af5a85eb30
MD5 4720bcc16eaa53387f8a2de8d97483bf
BLAKE2b-256 c7e23bb4d2a7e6f10e1ca125cefdcf6bbc43c42db1a7bf3d1f72e393696f237e

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