Skip to main content

Copy locally a Gitlab group or instance

Project description

Logo PyPI - Python Version Black GitHub Workflow Status Hatch project PyPI PyPI - License GitHub Repo stars


✨ Giphon is the contraction of 🦊 Gitlab and 🫗 siphon. This CLI tools allows users to recursively clone all projects in a given Gitlab group or instance.

Motivation

This project aims to provide a tool capable of replicating a Gitlab group's structure into a directory structure.

Locally cloned projects enable users to use familiar CLI tools such as grep and sed directly into the projects' tree structure.

Demo

Usage GIF

Installation

To install giphon, simply run:

pip install --user giphon

And if you wish to use giphon by simply calling giphon, you can set-up an alias in your .bashrc (or other, if you have another shell):

echo 'alias giphon="/usr/bin/env python3 -m giphon"' >> ~/.bashrc

Parameters

The giphon tool allows for the following parameters:

  • namespace (CLI: --namespace): The Gitlab namespace to be cloned. / defaults to the whole instance.
  • output (CLI: --output): The target path to clone the repositories to.
  • gitlab_token: (CLI: --gitlab-token, env: GITLAB_TOKEN): The Personal Access Token authenticating the user.
  • gitlab_url: (CLI: --gitlab-url, env: GITLAB_URL): The URL of the Gitlab instance to clone the repositories from. Defaults to "https://gitlab.com"
  • fetch_repositories: (CLI: --fetch-repositories/--no-fetch-repositories): Whether to fetch remotes on repositories that already exist.
  • save_ci_variables: (CLI: --save-ci-variables/--no-save-ci-variables): Whether to download CI/CD variables to a .env directory.
  • clone_archived (CLI: --clone-archived/--no-clone-archived): Whether to also clone archived repository.
  • clone_through_ssh: (CLI: --clone-through-ssh/--no-clone-through-ssh): Whether to use the SSH protocol or the HTTPS protocol to clone the git repositories
  • gitlab_username (CLI: --gitlab-username, env: GITLAB_USERNAME): The username to use, when cloning through HTTPS.
  • verbose: (CLI: --verbose/-v): The level of verbosity

Running programmatically

You can import the main function from giphon as such:

from pathlib import Path

from giphon.siphon import siphon

siphon(
    namespace=Path("my-namespace"),
    output=Path("~/Projects"),
    gitlab_token="",
    gitlab_url="https://gitlab.com",
    fetch_repositories=True,
    save_ci_variables=False,
    clone_archived=False,
    verbose=False,
)

The function takes as inputs the same parameters from the CLI tool.


Logo is © from Midjourney

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

giphon-0.2.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

giphon-0.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file giphon-0.2.0.tar.gz.

File metadata

  • Download URL: giphon-0.2.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for giphon-0.2.0.tar.gz
Algorithm Hash digest
SHA256 31ece60f89734d5aef0e557d707d65030d08e56dedc705196a01e91cb095424b
MD5 3175d5a213e4aa86f4267a59d6b1b738
BLAKE2b-256 2b7fc1bf5ce5beafdb254330f7b8802feb2606dfd84542125bc6068322fd874d

See more details on using hashes here.

File details

Details for the file giphon-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: giphon-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for giphon-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f968ed4ada2c883ad9ac007c83dab6b66c96aae85ed90bc2881d0db8e5568a73
MD5 25a0971e52c1fd3e6e352c1259e73ebe
BLAKE2b-256 99a08f766a3c8181a07db31ba82a7f4d93c2681538f06d56cbaad430be4b1adc

See more details on using hashes here.

Supported by

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