1
1
# PyVer
2
2
3
3
<!-- markdownlint-disable MD013 -->
4
-  [](https://github.com/Allstreamer/pyver/actions/workflows/tests.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/lint.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/build.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/package.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/docs.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/format.yml)
4
+    [](https://github.com/Allstreamer/pyver/actions/workflows/tests.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/lint.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/build.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/package.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/docs.yml) [](https://github.com/Allstreamer/pyver/actions/workflows/format.yml)
5
5
<!-- markdownlint-enable MD013 -->
6
6
7
7
> ** Python PEP-440 Version Parser**
@@ -17,6 +17,7 @@ version numbers and for comparisons between
17
17
pyver = " 1"
18
18
```
19
19
20
+ The following is an example for initilizing and comparing two version strings
20
21
``` Rust
21
22
use pyver :: PackageVersion ;
22
23
@@ -26,6 +27,35 @@ let b = PackageVersion::new("v1.0a2.dev457").unwrap();
26
27
assert_eq! (a < b , true );
27
28
```
28
29
30
+ Comparing single version components
31
+ ``` Rust
32
+ use pyver :: PackageVersion ;
33
+
34
+ let a = PackageVersion :: new (" 1!1.323.dev2" ). unwrap ();
35
+ let b = PackageVersion :: new (" v3.2.dev2" ). unwrap ();
36
+
37
+ // Check that both have the same dev version
38
+ assert_eq! (a . dev, b . dev);
39
+ ```
40
+
41
+ Seperation of version identifiers
42
+ ``` Rust
43
+ use pyver :: PackageVersion ;
44
+
45
+ let version = PackageVersion :: new (" v1.23.dev2" ). unwrap ();
46
+
47
+ println! (" {:?}" , version . release. major);
48
+ // > 1
49
+
50
+ println! (" {:?}" , version . release. minor);
51
+ // > 2
52
+
53
+ println! (" {:?}" , version . dev);
54
+ // > Some(DevHead { dev_num: Some(2) })
55
+ ```
56
+
57
+ See more examples at the [ docs] ( https://docs.rs/pyver/latest/pyver/ )
58
+
29
59
## Contribution
30
60
31
61
For now Contributions will be quite loose.
0 commit comments