Repository: milesgranger/cramjam (language: python)

Issue:
Add `__version__` module attribute
This helps with downstream code.


Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index 8f3c03cf..d1ac6aa0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -191,6 +191,7 @@ macro_rules! make_submodule {
 
 #[pymodule]
 fn cramjam(py: Python, m: &PyModule) -> PyResult<()> {
+    m.add("__version__", env!("CARGO_PKG_VERSION"))?;
     m.add("CompressionError", py.get_type::<CompressionError>())?;
     m.add("DecompressionError", py.get_type::<DecompressionError>())?;
 


Test patch:
diff --git a/tests/test_variants.py b/tests/test_variants.py
index 026e0b9d..58af8a66 100644
--- a/tests/test_variants.py
+++ b/tests/test_variants.py
@@ -7,6 +7,9 @@
 def same_same(a, b):
     return hashlib.md5(a).hexdigest() == hashlib.md5(b).hexdigest()
 
+def test_has_version():
+    from cramjam import __version__
+    assert isinstance(__version__, str)
 
 @pytest.mark.parametrize("is_bytearray", (True, False))
 @pytest.mark.parametrize(