Skip to main content

A simple library example to download meta files from the meta_json_files repo

Project description

Meta Json Downloader

Introduction

The meta_json_downloader is a Python library designed to simplify the downloading of files from the meta_json_files GitLab repository. It can also be used to fetch other type of file stored in a GitLab repository. In general, a user initializes the downloader with user credentials from environment variables, sets a download output directory, and downloads a list of specified files by the relative file path from the target repository. Each file's download status is logged by the progress callback.

Prerequisite

First, to use the library, you need to have a Gitlab access token. Go to the Personal Access Tokens page to activate the token. Then, create a .env file to fill in your USERNAME and ACCESS_TOKEN information for retrieving files using the Gitlab APIs.

Usage

See downloader_example.py for more details.

Testing

The MetaFileDownloader comes with a comprehensive test suite. To run the unit tests, navigate to the project directory and run:

pytest

To see the coverage report, navigate to the project directory and run:

 coverage run -m pytest
 coverage report

Main files

  • MetaFileDownloader.py: This is the core module that provides functionality to download files from a GitLab repository. It handles the setup of authentication, repository access, and file retrieval processes. The class MetaFileDownloader allows users to specify the repository path, branch, and file location within the repository.

  • test_MetaFileDownloader.py: Contains unit tests for the MetaFileDownloader module. It currently covers 100% functionalities according to the coverage report.

  • downloader_example.py: An example script that demonstrates how to use the MetaFileDownloader.

  • .gitlab-ci.yml: The GitLab CI configuration file which defines the pipeline for continuous integration. It includes stages for building the project, running tests, and deploying the code, ensuring that every update to the master branch is automatically tested and the package be uploaded to PyPI.

  • requirements.txt: Lists all the Python packages that need to be installed to run the project successfully. This file is used by pip to install all the dependencies.

  • environment.yml: Lists all the Python packages for conda use.

  • setup.py: This script is used for package distribution. It defines the package metadata (like name, version, and dependencies) and allows the module to be installed via pip or setup.py install command.

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

meta_json_downloader-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file meta_json_downloader-0.1.0.tar.gz.

File metadata

  • Download URL: meta_json_downloader-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.19

File hashes

Hashes for meta_json_downloader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a2cd576958513ce0cb8e3898303a50a679b747a9771a3ec8d069d0c9259f920
MD5 a4abbf10a1e7c4ded431ba45004661b1
BLAKE2b-256 e5030d0fca6b97113d94849b1414799a0479fb40880f3f7a841f51869ac609a4

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