Skip to main content

Crate use_python_version

Crate use_python_version 

Source
Expand description

§use-python-version

Python version and implementation primitives for RustUse.

§Experimental

use-python-version is experimental while use-python remains below 0.3.0.

§Example

use use_python_version::{PythonImplementation, PythonVersion};

let version: PythonVersion = "Python 3.12.1".parse()?;

assert_eq!(version.major(), 3);
assert_eq!(version.minor(), Some(12));
assert!(version.is_python3());
assert_eq!(PythonImplementation::CPython.as_str(), "cpython");

§Scope

  • Lightweight Python version components and parsing.
  • Python implementation labels.
  • Compatibility, ABI, and platform tag text newtypes.

§Non-goals

  • Full PEP 440 parsing.
  • Support-window or EOL-date policy.
  • Querying installed Python interpreters.

§License

Licensed under either Apache-2.0 or MIT.

Structs§

PythonAbiTag
PythonCompatibilityTag
PythonMajorVersion
Python major version component.
PythonMinorVersion
Python minor version component.
PythonPatchVersion
Python patch version component.
PythonPlatformTag
PythonVersion
Lightweight Python version metadata.

Enums§

PythonImplementation
Python implementation label.
PythonVersionFamily
Python version family label.
PythonVersionParseError
Error returned while parsing Python version metadata.