Skip to content

Rust-Python-Packaging/pyver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyVer

Crates.io Crates.io docs.rs 🧪 Tests 🖋  Check linting 🔨 Build 📦 Package 📄 Build docs 👔 Check formatting

Python PEP-440 Version Parser

This package allows for parsing Python PEP-440 version numbers and for comparisons between PEP-440 version numbers.

Usage

[dependencies]
pyver = "1"

The following is an example for initilizing and comparing two version strings

use pyver::PackageVersion;

let a = PackageVersion::new("v1.0a2.dev456").unwrap();
let b = PackageVersion::new("v1.0a2.dev457").unwrap();

assert_eq!(a < b, true);

Comparing single version components

use pyver::PackageVersion;

let a = PackageVersion::new("1!1.323.dev2").unwrap();
let b = PackageVersion::new("v3.2.dev2").unwrap();

// Check that both have the same dev version
assert_eq!(a.dev, b.dev);

Seperation of version identifiers

use pyver::PackageVersion;

let version = PackageVersion::new("v1.23.dev2").unwrap();

println!("{:?}", version.release.major);
// > 1

println!("{:?}", version.release.minor);
// > 2

println!("{:?}", version.dev);
// > Some(DevHead { dev_num: Some(2) })

See more examples at the docs

Contribution

For now Contributions will be quite loose.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy