Skip to main content

gitsource

GitHub repository reader with document chunking for RAG/LLM applications.

Features

  • Download repositories directly from GitHub using codeload.github.com (no git required)
  • Filter files by extension and path patterns
  • Parse YAML frontmatter from markdown files
  • Chunk documents using sliding windows (preserves metadata)
  • Lightweight Jupyter notebook parser

Installation

pip install gitsource
# or
uv add gitsource

Usage

Read GitHub Repository

from gitsource import GithubRepositoryDataReader

reader = GithubRepositoryDataReader(
    repo_owner="evidentlyai",
    repo_name="docs",
    allowed_extensions={"md", "mdx"},
)

files = reader.read()

Parse Frontmatter

from gitsource import GithubRepositoryDataReader

reader = GithubRepositoryDataReader(
    repo_owner="alexeygrigorev",
    repo_name="gitsource",
    allowed_extensions={"md"},
)
files = reader.read()

# Parse YAML frontmatter from markdown files
for file in files:
    data = file.parse()
    print(f"{data['filename']}: {data.get('title', 'No title')}")

Process Jupyter Notebooks

from gitsource import GithubRepositoryDataReader, notebook_processor

reader = GithubRepositoryDataReader(
    repo_owner="alexeygrigorev",
    repo_name="gitsource",
    branch="master",
    allowed_extensions={"md", "ipynb"},
    filename_filter=lambda fp: fp.startswith("fixtures/"),
    processors={"ipynb": notebook_processor},  # Convert .ipynb to text
)

files = reader.read()
for file in files:
    print(f"{file.filename}: {file.content[:50]}...")

Chunk Documents

from gitsource import chunk_documents

documents = [
    {"content": "Long text here...", "filename": "doc.txt"}
]

chunks = chunk_documents(
    documents,
    size=2000,
    step=1000
)

License

WTFPL

Metadata

Release files for gitsource 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitsource 0.0.5
File Size Uploaded Provenance
gitsource-0.0.5.tar.gz 73.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gitsource 0.0.5
File Interpreter ABI Platform
gitsource-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 82.8 kB

Release files / gitsource-0.0.5.tar.gz

Download URL gitsource-0.0.5.tar.gz
Size 73.8 kB
Tags Source
SHA-256 checksum
How to use checksums
98e1bd7c4da6abe477071f876945c1203b35dc9ef10dc1f842cad4d5953ad3cb
BLAKE2b-256 checksum
How to use checksums
b93b52da10f861beeec427600010de4506d89f6da9126e0b9499650fad5c0c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / gitsource-0.0.5-py3-none-any.whl

Download URL gitsource-0.0.5-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a6030f61e264628606f8438b8cb633046ae158757aa242504a4c0fc4630042c
BLAKE2b-256 checksum
How to use checksums
f17809a6508d8cd50d730c15368af4f1950236f3adce29c38502f79cc8710600
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for gitsource 0.0.5

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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