Skip to main content

MultiCounter

A simple, elegant counter with support for counting multiple things at once.

Joseph Hale's software engineering blog

Quickstart

pip install multicounter
from multicounter import MultiCounter
mc = MultiCounter()

# Choose a name for your counter and start counting!
mc.foo += 1

# You can choose an initial value for a counter ...
mc.bar = 42
# ... and increment or decrement it however you like.
mc.bar -= 4

print(mc.get_counters())
# {'foo': 1, 'bar': 38}

Contributing

See CONTRIBUTING.md

License

Copyright (c) 2026 Joseph Hale, All Rights Reserved

Provided under the terms of the Mozilla Public License, version 2.0

What does the MPL-2.0 license allow/require?

TL;DR

You can use files from this project in both open source and proprietary applications, provided you include the above attribution. However, if you modify any code in this project, or copy blocks of it into your own code, you must publicly share the resulting files (note, not your whole program) under the MPL-2.0. The best way to do this is via a Pull Request back into this project.

If you have any other questions, you may also find Mozilla's official FAQ for the MPL-2.0 license insightful.

If you dislike this license, you can contact me about negotiating a paid contract with different terms.

Disclaimer: This TL;DR is just a summary. All legal questions regarding usage of this project must be handled according to the official terms specified in the LICENSE file.

Why the MPL-2.0 license?

I believe that an open-source software license should ensure that code can be used everywhere.

Strict copyleft licenses, like the GPL family of licenses, fail to fulfill that vision because they only permit code to be used in other GPL-licensed projects. Permissive licenses, like the MIT and Apache licenses, allow code to be used everywhere but fail to prevent proprietary or GPL-licensed projects from limiting access to any improvements they make.

In contrast, the MPL-2.0 license allows code to be used in any software project, while ensuring that any improvements remain available for everyone.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multicounter-0.3.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

multicounter-0.3.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file multicounter-0.3.1.tar.gz.

File metadata

  • Download URL: multicounter-0.3.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.18.0 {"ci":null,"cpu":"x86_64","distro":{"id":"jammy","libc":{"lib":"glibc","version":"2.35"},"name":"Ubuntu","version":"22.04"},"implementation":{"name":"CPython","version":"3.13.2"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.2 15 Mar 2022","python":"3.13.2","system":{"name":"Linux","release":"6.18.33.2-microsoft-standard-WSL2"}} HTTPX2/2.12.0

File hashes

Hashes for multicounter-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2093ca744ef4b6595932022ea249eca872ade920b40934fdd6cd6c2b85109900
MD5 af96836ffa4975764ca7fb1033683c4d
BLAKE2b-256 b930629cee85908b84994621735936a32be89cf141e42b46615579dd07432d63

See more details on using hashes here.

File details

Details for the file multicounter-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: multicounter-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.18.0 {"ci":null,"cpu":"x86_64","distro":{"id":"jammy","libc":{"lib":"glibc","version":"2.35"},"name":"Ubuntu","version":"22.04"},"implementation":{"name":"CPython","version":"3.13.2"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.0.2 15 Mar 2022","python":"3.13.2","system":{"name":"Linux","release":"6.18.33.2-microsoft-standard-WSL2"}} HTTPX2/2.12.0

File hashes

Hashes for multicounter-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96bd384b26b0f907f3419bc13a39ad250147ebd3e39a26c0e5dabff821aa33b2
MD5 ec4772c24bb93f007e139eddb47e55a0
BLAKE2b-256 5201df896726829e0944a3c5f8b9d8ab350ede3a4b184b2f34bcaf314909b0d7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page