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))

Download files

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

Source Distribution

fastimport-0.9.16.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

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

fastimport-0.9.16-py2.py3-none-any.whl (46.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file fastimport-0.9.16.tar.gz.

File metadata

  • Download URL: fastimport-0.9.16.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastimport-0.9.16.tar.gz
Algorithm Hash digest
SHA256 6a0a6fb56aa3607de71ad4e7abd551afe9bdac94bab8d2dd74d8e0f98f52e35e
MD5 c5cc05ba12f6ed9ce7e1057816162d2e
BLAKE2b-256 ce770f2009a52246b9e3fe5726aef01f7c8b760e03e5ef83b6fd16134da6f7f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastimport-0.9.16.tar.gz:

Publisher: wheels.yaml on jelmer/python-fastimport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastimport-0.9.16-py2.py3-none-any.whl.

File metadata

  • Download URL: fastimport-0.9.16-py2.py3-none-any.whl
  • Upload date:
  • Size: 46.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fastimport-0.9.16-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23c9a40a6fde1143e376dad5caf1f429a250db21129e91efe23db659d45c8123
MD5 dc214d156a6f24608938afb666e935e8
BLAKE2b-256 6ae3354dd0c7c16f1d9eab89bff22e40ac6e3030f08aeedc66497b49ca48a925

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastimport-0.9.16-py2.py3-none-any.whl:

Publisher: wheels.yaml on jelmer/python-fastimport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.9.16 This release

2 files

0.9.15

2 files

0.9.14

1 file

0.9.13

1 file

0.9.12

1 file

0.9.11

1 file

0.9.10

1 file

0.9.9

1 file

0.9.8

1 file

0.9.7

1 file

0.9.6

1 file

0.9.5

1 file

0.9.4

1 file

0.9.3

1 file

0.9.2

1 file

0.9.1

0.9.0

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page