Skip to content

Releases: timlnx/bitmath

2.1.1 Fixes some more PyPI workflow

25 May 13:23
v2.1.1

Choose a tag to compare

No code changes. Just here to get the secure artifact pipeline happy again.

2.1.0 Release - Paperwork and best practices

25 May 04:16
v2.1.0

Choose a tag to compare

A focused follow-up to last month's 2.0.0 modernization. The public API is essentially unchanged; the bulk of this release is supply-chain security work, new policy documentation, and a pass through OpenSSF's automated and human review processes.

If your code was happy on 2.0, it will be happy here too. The two breaking changes affect only code that inspected internal types directly or called the now-deprecated listdir() helper.

What's Changed

  • best-practices: pylint 10.00/10, real docstrings, swap flake8 for pylint in CI by @timlnx in #136
  • Dynamic analysis by @timlnx in #137
  • Add OSSF Scorecard security scan workflow by @timlnx in #138
  • Scorecard fixes: token permissions, Dependabot, action SHA pinning by @timlnx in #139
  • Add Hypothesis property tests (Scorecard Fuzzing check) by @timlnx in #144
  • Bump github/codeql-action from 4.35.3 to 4.35.5 in the actions-minor-patch group by @dependabot[bot] in #140
  • Bump actions/download-artifact from 4.3.0 to 8.0.1 by @dependabot[bot] in #142
  • Bump PyCQA/bandit-action from ca64e96d362b1764a98d841aaf3a4b1e2d690c7b to 8a1b30610f61f3f792fe7556e888c9d7dffa52de by @dependabot[bot] in #143
  • Bump actions/upload-artifact from 4.6.2 to 7.0.1 by @dependabot[bot] in #141
  • Use https for project doc URLs by @timlnx in #146
  • Earn OpenSSF Best Practices badge and OSPS Baseline L1/L2/L3 (partial) by @timlnx in #147
  • Finish bitmath 2.1.0 NEWS.rst and tidy Sphinx config by @timlnx in #148

New Contributors

Full Changelog: v2.0.1...v2.1.0

2.0.0 Fixed PyPI Publishing

28 Apr 00:32
v2.0.1
b5531bb

Choose a tag to compare

Hopefully this adds automatic pypi publishing on release publication

2.0.0 Is finally out!

26 Apr 00:18
v2.0.0
bd2873f

Choose a tag to compare

bitmath 2.0.0

First major release in eight years. Python 3 only, one breaking pivot, and the decade-long backwards-compatibility guarantee still intact for any 1.x code already running on Py3.

Highlights

  • Python 3.9+ only. Python 2 support is gone, as promised in issue #99.
  • New query_capacity() API — returns a Capacity(total, used, free) NamedTuple for any path or mount point. Cross-platform, no root required. This is the API you want for almost every "how big is this disk/volume?" question.
  • Windows disk capacity via query_device_capacity(), built on DeviceIoControl. Linux and Windows are both supported; macOS raises NotImplementedError because SIP blocks raw block-device access even for root.
  • Capacity math. bitmath objects now support floor division (//), modulo (%), and divmod — for chunk-and-remainder planning: how many 500 GB volumes fit into 14 TiB, and how much is left over?
  • f-string and format() support. bitmath objects implement __format__ per PEP 3101; f"{size:.2f} {size.unit}"'1.69 GiB'.
  • Four new NIST units: ZiB, YiB, Zib, Yib. The NIST_PREFIXES, NIST_STEPS, and ALL_UNIT_TYPES constants reflect reality again.
  • Thread-safe context manager. bitmath.format() now uses threading.local with proper save/restore semantics. Fixes #83.
  • best_prefix() bit-family fix. Bit-family inputs no longer silently convert into byte-family outputs. Fixes #95.

Breaking changes

Python 2 is gone — that's the headline. Six smaller changes came along with it:

  • parse_string(..., strict=False) defaults to NIST, not SI. Inputs like "1g" may resolve differently than in 1.x.
  • parse_string_unsafe() is deprecated. Use parse_string(..., strict=False). The old name still works but emits a DeprecationWarning.
  • bitmath.integrations has been removed. The argparse, click, and progressbar integrations are gone from the package; copy-paste equivalents are in the new Integration Examples chapter of the docs.
  • Byte and Bit display as B and b, consistent with every other unit in the library. Class names are unchanged. Code that compared formatted strings against the literal words "Byte" or "Bit" will need updating.
  • query_device_capacity() raises NotImplementedError on macOS. Use query_capacity() instead.
  • setup.py is gone. Install via pip install bitmath; build via python -m build.

If you're already on Python 3.9+ and using the documented 1.x API, the upgrade is probably a pip install --upgrade bitmath and a test run.

Under the hood

pyproject.toml + hatchling replace setup.py. pytest replaces nosetests. CI runs against Python 3.9–3.13 on Linux, macOS, and Windows. CodeQL runs on every push. Releases are GPG-signed.

Credits

Thanks to everyone who filed reports or contributed code during the gap between 1.3.3 and 2.0.

  • Maximilian Blochberger (@blochberger) did substantial integration work in the 1.4 era — the click integration (closing #74) and the argparse/progressbar dependency separation (closing #86, his own report). The bitmath.integrations module itself has been retired in 2.0, but the copy-paste replacements in the Integration Examples chapter are based on his code.
  • Matthieu Coudron contributed numpy.int64 support for bitmath comparisons.
  • Jonathan Eunice (@jonathaneunice) contributed the original concept for __format__ support in PR #76, years before it finally landed.
  • @a-detiste opened PR #105, which is why the test suite now prefers stdlib unittest.mock.
  • @postmaxin opened PR #107, which surfaced the pack
    aging bug that 1.4 shipped to fix.

Issue reports that drove real fixes: @walrusVision for #83 (thread-safe context manager), @beav for #93 (Byte/Bit display), @rohit04saluja for #95 (best_prefix bit-family).

2.0.0 Release Candidate 4

23 Apr 17:56
v2.0.0-rc4
bd2873f

Choose a tag to compare

Pre-release

What's Changed

Full Changelog: v2.0.0-rc3...v2.0.0-rc4

Almost 2.0.0

23 Apr 12:19
v2.0.0-rc3
2d0508d

Choose a tag to compare

Almost 2.0.0 Pre-release
Pre-release

All 2.0.0 milestones are complete in the issue tracker. Now I'm doing some manual checking before pushing the final 2.0.0 release.

What's Changed

Full Changelog: v2.0.0-rc2...v2.0.0-rc3

2.0.0 Release Candidate 2

21 Apr 22:23
e3006de

Choose a tag to compare

Pre-release

Testing RPM building from RCs

2.0.0 Release Candidate 1

19 Apr 01:35
83a8170

Choose a tag to compare

Pre-release

This is a pre-release build of 2.0.0 so I have something to use while I finish refactoring the RPM release tooling

1.4.0-maintenance

17 Apr 03:10
9405a02

Choose a tag to compare

What's Changed

  • Note that context managers are not thread-safe by @timlnx in #84
  • Fix argparse integration requiring progressbar by @blochberger in #87
  • Add click integration (closes #74) by @blochberger in #88
  • Maintenance 1.4.0 by @timlnx in #108
  • Add .readthedocs.yaml for RTD build configuration by @timlnx in #109
  • Add sphinx_rtd_theme to doc-requirements.txt, remove unused sphinxcon… by @timlnx in #110

New Contributors

Full Changelog: 1.3.3.1...1.4.0.1