simple-nfc-tag
A tag-agnostic NFC data storage library built on PC/SC, abstracting away reader, tag and protocol details.
This package is still experimental. Read and write are verified against real hardware (ACR122U, NTAG213, MIFARE Classic 1K), but the API and the data layout written to tags can still change between releases.
Install
uv add simple-nfc-tag
pip install simple-nfc-tag
Python 3.10+. Depends on pyscard. No driver swap: uses the PC/SC stack already present on
Windows and macOS, and pcscd on Linux.
Usage
import simple_nfc_tag as snt
with snt.connect() as reader:
tag = reader.wait_for_tag(timeout=5)
print(tag.uid.hex(), tag.product, tag.user_size)
tag.write(["ABC123", 42]) # values in
print(tag.read()) # -> ["ABC123", 42]
Same code against a Classic 1K and an NTAG216. Sector trailers, page-granularity read-modify-write, Classic authentication and payload framing are handled internally.
Values are typed automatically: str, int, float, bool, bytes, anything else as JSON.
read() with no format= detects what is on the tag.
Features
- Readers: generic PC/SC, ACR122U (buzzer, LED, PN532 passthrough), in-memory fake
- Tags: MIFARE Classic 1K/4K, Ultralight, NTAG213/215/216, identified automatically
- Formats: compact TLV of typed values, and raw bytes
- Auth: MIFARE Classic keys and trailers, NTAG21x
PWD_AUTHand password setting - Monitor: background thread with per-UID debounce, blocking in the PC/SC driver
- Write verification: on by default; a refused write reports
SW=9000on an NTAG - Typed:
py.typed, no bareexcept, every non-90 00answer raisesApduError
vs nfcpy
| simple-nfc-tag | nfcpy | |
|---|---|---|
| Transport | PC/SC | libusb or serial, direct to the chip |
| Readers | any PC/SC reader | a fixed device list: PN531/PN532/PN533, RC-S956, Port100 |
| ACR122U | primary target, verified | supported, but "it is not recommended to buy this device for use with nfcpy" |
| Tags | MIFARE Classic 1K/4K, Ultralight, NTAG213/215/216 | NFC Forum Type 1-4 |
| API level | values (write([...]) / read()) |
NDEF records, protocol operations |
| Tag differences | hidden | exposed per tag type |
| Scope | storage on tags | + peer-to-peer, card emulation, connection handover |
Use nfcpy for NFC protocol work. Use this to store data.
Testing without hardware
from simple_nfc_tag.readers.fake import FakeReader, FakeNTAG213
reader = FakeReader(FakeNTAG213())
tag = reader.wait_for_tag()
tag.write(["ABC123", 42])
assert tag.read() == ["ABC123", 42]
The images reproduce the awkward parts: 4-page reads that wrap at end of memory, 63 00 past
the last page, Classic sectors silent until authenticated, and a tag that stops answering after
refusing a command.
Docs
- USAGE.md: monitors, Classic keys and trailers, NTAG passwords, raw bytes, custom codecs, errors
- examples/:
roundtrip.py(manual hardware check),monitor.py,classic_keys.py
License
MIT
Metadata
Release files for simple-nfc-tag 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| simple_nfc_tag-0.1.0.tar.gz | 46.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_nfc_tag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.2 kB
Release files / simple_nfc_tag-0.1.0.tar.gz
| Download URL | simple_nfc_tag-0.1.0.tar.gz |
|---|---|
| Size | 46.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
554279b2e3b142ba2091fcf03bbd5337619c28bb104b652cf9b98026911fc11e
|
|
BLAKE2b-256 checksum How to use checksums |
07c9a2ac43cdb8581245dcb13ffe5c3e8c005b1af7f20132871586339a80839d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / simple_nfc_tag-0.1.0-py3-none-any.whl
| Download URL | simple_nfc_tag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 57.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
637df3f31e7a16e594d544455ff9049602f6dd1d1545c1afe385ee5d6730824f
|
|
BLAKE2b-256 checksum How to use checksums |
9c5d3ecb6d70ed745245def7093039ea9c31e61314501aa2cb21ecf701b0d7af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for simple-nfc-tag 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.