Skip to main content

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)

Source distribution for fastimport 0.9.16
File Size Uploaded
fastimport-0.9.16.tar.gz 50.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastimport 0.9.16
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.9.16 This release

2 release files

0.9.15

2 release files

0.9.14

1 release file

0.9.13

1 release file

0.9.12

1 release file

0.9.11

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

0.9.0

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