python-fastimport
This package provides a parser for and generator of the Git fastimport format. (https://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)
Installation
pip install fastimport
Example
Here's a simple example of how to parse a fastimport stream:
from fastimport import parser
# Parse a fastimport stream from a file
with open('export.dat', 'rb') as f:
p = parser.ImportParser(f)
for cmd in p.iter_commands():
if cmd.name == b'commit':
print(f"Commit to branch: {cmd.ref}")
print(f"Author: {cmd.author}")
print(f"Message: {cmd.message}")
elif cmd.name == b'blob':
print(f"Blob mark: {cmd.mark}, size: {len(cmd.data)}")
And here's how to generate a fastimport stream:
from fastimport import commands
# Create a new blob
blob = commands.BlobCommand(
mark=b'1',
data=b'Hello, World!\n',
lineno=0
)
# Create a commit
commit = commands.CommitCommand(
ref=b'refs/heads/main',
mark=b'2',
author=(b'John Doe', b'john@example.com', 1234567890, 0),
committer=(b'John Doe', b'john@example.com', 1234567890, 0),
message=b'Initial commit\n',
from_=None,
merges=None,
file_iter=[
commands.FileModifyCommand(
path=b'hello.txt',
mode=0o100644,
dataref=b':1',
data=None
)
]
)
# Write to a fastimport stream
with open('import.dat', 'wb') as f:
f.write(bytes(blob))
f.write(b'\n')
f.write(bytes(commit))
Metadata
Release files for fastimport 0.9.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastimport-0.9.16.tar.gz | 50.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastimport-0.9.16-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 96.5 kB
Release files / fastimport-0.9.16.tar.gz
| Download URL | fastimport-0.9.16.tar.gz |
|---|---|
| Size | 50.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a0a6fb56aa3607de71ad4e7abd551afe9bdac94bab8d2dd74d8e0f98f52e35e
|
|
BLAKE2b-256 checksum How to use checksums |
ce770f2009a52246b9e3fe5726aef01f7c8b760e03e5ef83b6fd16134da6f7f5
|
| 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 Sep 30, 2025.
Transparency logRelease files / fastimport-0.9.16-py2.py3-none-any.whl
| Download URL | fastimport-0.9.16-py2.py3-none-any.whl |
|---|---|
| Size | 46.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
23c9a40a6fde1143e376dad5caf1f429a250db21129e91efe23db659d45c8123
|
|
BLAKE2b-256 checksum How to use checksums |
6ae3354dd0c7c16f1d9eab89bff22e40ac6e3030f08aeedc66497b49ca48a925
|
| 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 Sep 30, 2025.
Transparency log