Skip to main content

Welcome to gitlab2prov! 👋

License: MIT Badge: Made with Python Badge: PyPi Version Badge: PyPi Downloads Monthly Twitter: DLR Software Badge: Open in VSCode Badge: DOI Badge: W3C PROV Badge: Citation File Format Inside

gitlab2prov is a Python library and command line tool that extracts provenance information from GitLab projects.


The gitlab2prov data model has been designed according to W3C PROV specification. The model documentation can be found here.

️🏗️ ️Installation

Please note that this tool requires Git to be installed on your machine.

Clone the project and install using pip:

pip install .

Or install the latest release from PyPi:

pip install gitlab2prov

To install gitlab2prov with all extra dependencies require the [dev] extras:

pip install .[dev]            # clone repo, install with extras
pip install gitlab2prov[dev]  # PyPi, install with extras

⚡ Getting started

gitlab2prov needs a personal access token to clone git repositories and to authenticate with the GitLab API. Follow this guide to create an access token with the required scopes.

🚀‍ Usage

gitlab2prov can be configured using the command line interface or by providing a configuration file in .yaml format.

Command Line Usage

The command line interface consists of commands that can be chained together like a unix pipeline.

Usage: gitlab2prov [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...

  Extract provenance information from GitLab projects.

Options:
  --version        Show the version and exit.
  --verbose        Enable logging to 'gitlab2prov.log'.
  --config FILE    Read config from file.
  --validate FILE  Validate config file and exit.
  --help           Show this message and exit.

Commands:
  combine                  Combine multiple graphs into one.
  extract                  Extract provenance information for one or more...
  load                     Load provenance files.
  merge-duplicated-agents  Merge duplicated agents based on a name to...
  pseudonymize             Pseudonymize a provenance graph.
  save                     Save provenance information to a file.
  stats                    Print statistics such as node counts and...

Configuration Files

gitlab2prov supports configuration files in .yaml format that are functionally equivalent to command line invocations.

To read configuration details from a file instead of specifying on the command line, use the --config option:

# initiate a run using a config file
gitlab2prov --config config/example.yaml

You can validate your config file using the provided JSON-Schema gitlab2prov/config/schema.json that comes packaged with every installation:

# check config file for syntactical errors
gitlab2prov --validate config/example.yaml

Config file example:

- extract:
        url: ["https://gitlab.com/example/foo"]
        token: tokenA
- extract:
        url: ["https://gitlab.com/example/bar"]
        token: tokenB
- load:
        input: [example.rdf]
- pseudonymize:
- combine:
- save:
        output: combined
        format: [json, rdf, xml, dot]
- stats:
        fine: true
        explain: true
        formatter: table

The config file example is functionally equivalent to this command line invocation:

gitlab2prov extract -u https://gitlab.com/example/foo -t tokenFoo \
            extract -u https://gitlab.com/example/bar -t tokenBar \
            load -i example.rdf                                   \
            pseudonymize                                          \
            combine                                               \
            save -o combined -f json -f rdf -f xml -f dot         \
            stats --fine --explain --formatter table

🎨 Provenance Output Formats

gitlab2prov supports output formats that the prov library provides:

🤝 Contributing

Contributions and pull requests are welcome!
For major changes, please open an issue first to discuss what you would like to change.

✨ How to cite

If you use GitLab2PROV in a scientific publication, we would appreciate citations to the following paper:

Bibtex entry:

@InProceedings{SchreiberBoerKurnatowski2021,
  author    = {Andreas Schreiber and Claas de~Boer and Lynn von~Kurnatowski},
  booktitle = {13th International Workshop on Theory and Practice of Provenance (TaPP 2021)},
  title     = {{GitLab2PROV}{\textemdash}Provenance of Software Projects hosted on GitLab},
  year      = {2021},
  month     = jul,
  publisher = {{USENIX} Association},
  url       = {https://www.usenix.org/conference/tapp2021/presentation/schreiber},
}

You can also cite specific releases published on Zenodo: DOI

✏️ References

Influencial Software for gitlab2prov

  • Martin Stoffers: "Gitlab2Graph", v1.0.0, October 13. 2019, GitHub Link, DOI 10.5281/zenodo.3469385

  • Quentin Pradet: "How do you rate limit calls with aiohttp?", GitHub Gist, MIT LICENSE

Influencial Papers for gitlab2prov:

Papers that refer to gitlab2prov:

📜 Dependencies

gitlab2prov depends on several open source packages that are made freely available under their respective licenses.

Package License
GitPython License
click License
python-gitlab License: LGPL v3
prov License: MIT
jsonschema License: MIT
ruamel.yaml License: MIT
pydot License: MIT

📝 License

This project is MIT licensed.
Copyright © 2019 German Aerospace Center (DLR) and individual contributors.

Metadata

Release files for gitlab2prov 2.2.0

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

Source distribution (sdist)

Source distribution for gitlab2prov 2.2.0
File Size Uploaded
gitlab2prov-2.2.0.tar.gz 32.3 kB Details

Built distribution (wheel)

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

Total release size: 66.2 kB

Release files / gitlab2prov-2.2.0.tar.gz

Download URL gitlab2prov-2.2.0.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9695a31dc0ce34382f28aabd6c4b425e68b2f23bee2e131abba2a3fbd6a1ba2c
BLAKE2b-256 checksum
How to use checksums
e6a9e33ed1a2d880c0e0bfe2d3296e3a1ea39a54d3c47085a32ec9b8253bcab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / gitlab2prov-2.2.0-py3-none-any.whl

Download URL gitlab2prov-2.2.0-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f62f656dd2143eb653c84c292ea68a128b76b8a7823527316af0a7396653ba3
BLAKE2b-256 checksum
How to use checksums
1666b8647c03aff8574f9c8dfb7e3356e0e0b4d1712bac3c651a906a0787c5c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

0.5

2 release files

0.4.1

2 release files

0.3

2 release files

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