license: Apache-2.0
copyright: copyright (c) nexB. Inc. and others
homepage_url: https://github.com/nexB/typecode
keywords: filetype, mimetype, libmagic, scancode-toolkit, typecode
TypeCode provides comprehensive filetype and mimetype detection using multiple detectors including libmagic (included as a dependency for Linux, Windows and macOS) and Pygments. It started as library in scancode-toolkit. Visit https://aboutcode.org and https://github.com/nexB/ for support and download.
We run CI tests on:
Azure pipelines https://dev.azure.com/nexB/typecode/_build
To install this package with its full capability (where the binaries for libmagic are installed), use the full option:
pip install typecode[full]
If you want to use the version of libmagic (possibly) provided by your operating system, use the minimal option:
pip install typecode
In this case, you will need to provide a working libmagic and its database available in one of these ways:
a typecode-libmagic plugin: See the standard ones at https://github.com/nexB/scancode-plugins/tree/main/builtins These can either bundle a libmagic library and its magic database or expose a system-installed libmagic. They do so by providing a plugin entry point as a scancode_location_provider for typecode_libmagic which points to a callable that must return a mapping with these two keys:
‘typecode.libmagic.dll’: the absolute path to a libmagic DLL
‘typecode.libmagic.db’: the absolute path to a libmagic ‘magic.mgc’ database
See for example:
environment variables:
TYPECODE_LIBMAGIC_PATH: the absolute path to a libmagic DLL
TYPECODE_LIBMAGIC_DB_PATH: the absolute path to a libmagic ‘magic.mgc’ database
a system-installed libmagic and its database availale in the system PATH:
The supported libmagic version is 5.39.
To set up the development environment:
source configure --dev
To run unit tests:
pytest -vvs -n 2
To clean up development environment:
./configure --clean
To update Pygment to a newer vendored version use vendy:
Update the version of pygments in pyproject.toml
Run vendy
Update the src/typecpde/pygments_lexers_mapping.py and src/typecode/pygments_lexers.py scripts accordingly, including their ABOUT files
Release files for typecode 30.2.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 | |
|---|---|---|---|
| typecode-30.2.0.tar.gz | 949.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typecode-30.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / typecode-30.2.0.tar.gz
| Download URL | typecode-30.2.0.tar.gz |
|---|---|
| Size | 949.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42b9477d7d05ba5668768dae46c2d2700d503b6e3791d2cd8003b5d10d0ea330
|
|
BLAKE2b-256 checksum How to use checksums |
af40ab6f2871f78ddaff5bdd3f0baf3abbdbbce262425c4e4836a672bbffadc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 23, 2026.
Transparency logRelease files / typecode-30.2.0-py3-none-any.whl
| Download URL | typecode-30.2.0-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e59d65ea899b30926f66c32f43d811aa200e8ce1aa84f95b109cdabb4af2acd
|
|
BLAKE2b-256 checksum How to use checksums |
c8e7597a7a5701ec77c20ad878d353781bc711fd343eee36d180252d0fbf87ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 23, 2026.
Transparency log