Skip to main content

Universal artifact fetcher for Artifactory, GitLab, and Git.

Project description

Artifetch

Artifetch is a universal artifact fetcher. In v1, it focuses on Git repositories with:

  • Fast shallow clones by default
  • Optional branch/tag checkout
  • Sparse checkout of a subdirectory, materialized directly under your destination folder
  • Support for HTTPS, SSH, and GitLab-style shorthand (group/repo → full URL)
  • Safe cleanup on Windows

Features

  • Git provider:
    • Shallow clone (--depth 1, --no-tags)
    • Branch/tag selection via --branch/-b
    • Sparse checkout for a single subdirectory
    • Credential redaction in error messages

Installation

From PyPI:

pip install artifetch

From source:

pip install -e .

CLI Usage

# Clone default branch into ./repos/monorepo
artifetch https://gitlab.com/org/monorepo.git -d ./repos -p git

# Clone a specific branch
artifetch https://gitlab.com/org/monorepo.git -d ./repos -p git -b release/1.0 

# Materialize only a subdirectory directly under dest
artifetch group/monorepo -d ./workspace -p git -s modules/adas/camera  

# SSH URL with subdir
artifetch git@gitlab.com:org/monorepo.git -d ./workspace -p git -s modules/vision/perception 

# Subdirectory from a specific branch
artifetch group/monorepo -d ./workspace -p git -b release/1.0 -s modules/adas/camera

Options:

  • source: Git URL or shorthand
  • --dest, -d: Destination folder (default: .)
  • --branch, -b: Branch or tag
  • --subdir, -s: Subdirectory to materialize
  • --verbose, -v: Enable debug logs

Python API

High-level helper

from pathlib import Path
from artifetch.core import fetch

dest = Path("./workspace")

# Full repo
path = fetch("https://gitlab.com/org/monorepo.git", dest=dest)
print(path)  # ./workspace/monorepo

# Branch
path = fetch("https://gitlab.com/org/monorepo.git", dest=dest, branch="release/1.0")

# Subdirectory only
path = fetch("group/monorepo", dest=dest, subdir="modules/adas/camera")
print(path)  # ./workspace/modules/adas/camera

Direct Git provider

from pathlib import Path
from artifetch.providers.git import GitFetcher

f = GitFetcher()
dest = Path("./workspace")

# SSH URL
p = f.fetch("git@gitlab.com:org/monorepo.git", dest, branch="main")

# HTTPS + subdir
p = f.fetch("https://gitlab.com/org/monorepo.git", dest, subdir="modules/vision/perception")

Environment Variables

Variable Purpose Default
GIT_BINARY Path to git executable auto-detect
ARTIFETCH_GIT_HOST Host for shorthand normalization gitlab.com
ARTIFETCH_GIT_PROTO ssh or https for shorthand ssh
ARTIFETCH_GIT_USER SSH user for shorthand git

Example:

shell:

export ARTIFETCH_GIT_PROTO=https
export ARTIFETCH_GIT_HOST=git.mycorp.local

or .env file

ARTIFETCH_GIT_PROTO=https
ARTIFETCH_GIT_HOST=git.mycorp.local

Behavior Details

  • Subdir normalization: Converts backslashes to /, collapses //, trims leading/trailing slashes.
  • Destination rules:
    • Full repo → dest/<repo_name>
    • Subdir → dest/<normalized_subdir>
  • Cleanup: Repo folder is deleted after moving subdir (Windows-safe retry logic).

Troubleshooting

  • Access denied on Windows: Artifetch retries deletion with backoff and clears read-only bits.
  • git not found: Install Git or set GIT_BINARY.
  • Destination exists: Remove or rename before retry.

Roadmap

  • GitLab artifacts
  • Artifactory support

License

MIT

Project details


Download files

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

Source Distribution

artifetch-0.0.6.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

artifetch-0.0.6-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file artifetch-0.0.6.tar.gz.

File metadata

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

File hashes

Hashes for artifetch-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5ca587be29e43a63ababfa10dcaad4d4481a864b1dcef48d3fd9776f948ae40a
MD5 984bb24caccef55f11cc9a19b24accfe
BLAKE2b-256 e4e011635bf1012a4dae7e23cda5f7f99fb857808ff7af360d66b8730cf5d17d

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifetch-0.0.6.tar.gz:

Publisher: publish.yml on gemmamary/artifetch

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

File details

Details for the file artifetch-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: artifetch-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for artifetch-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e53089e2cf88e09de74e65d8db3067555ffe493594a505af795ef1df74418f79
MD5 22d31e7a08e61e9f9b208e9d48f600fc
BLAKE2b-256 5a9333e7e5792fa8a04fbb491734b59fc5680bfba3a5d55b7f2eb722a6a89464

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifetch-0.0.6-py3-none-any.whl:

Publisher: publish.yml on gemmamary/artifetch

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

Supported by

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