Package: gimie
Gimie (GIt Meta Information Extractor) is a python library and command line tool to extract structured metadata from git repositories.ContextScientific code repositories contain valuable metadata which can be used to enrich existing catalogues, platforms or databases. This tool aims to easily extract structured metadata from a generic git repositories. It can extract extract metadata from the Git provider (GitHub or GitLab) or from the git index itself.Using Gimie: easy peasy, it's a 3 step process.STEP 1: InstallationTo install the stable version on PyPI:pipinstallgimieTo install the dev version from github:pipinstallgit+https://github.com/SDSC-ORD/gimie.git@main#egg=gimieGimie is also available as a docker container hosted on theGithub container registry:dockerpullghcr.io/sdsc-ord/gimie:latest# The access token can be provided as an environment variabledockerrun-eACCESS_TOKEN=$ACCESS_TOKENghcr.io/sdsc-ord/gimie:latestgimiedata<repo>STEP 2 : Set your credentialsIn order to access the github api, you need to provide a github token with theread:orgscope.A. Create access tokensNew to access tokens? Or don't know how to get your Github / Gitlab token ?Have no fear, seehere for Github tokensandhere for Gitlab tokens.
(Note: tokens are as precious as passwords! Treat them as such.)B. Set your access tokens via the TerminalGimie will use your access tokens to gather information for you. If you want info about a Github repo, Gimie needs your Github token; if you want info about a Gitlab Project then Gimie needs your Gitlab token.Add your tokens one by one in your terminal:
your Github token:exportGITHUB_TOKEN=and/or your Gitlab token:exportGITLAB_TOKEN=STEP 3: GIMIE info ! Run GimieAs a command line toolgimiedatahttps://github.com/numpy/numpy(want a Gitlab project instead? Just replace the URL in the command line)As a python libraryfromgimie.projectimportProjectproj=Project("https://github.com/numpy/numpy)# To retrieve the rdflib.Graph objectg=proj.to_graph()# To retrieve the serialized graphproj.serialize(format='ttl')Or to extract only from a specific source:fromgimie.sources.githubimportGithubExtractorgh=GithubExtractor('https://github.com/SDSC-ORD/gimie')gh.extract()# To retrieve the rdflib.Graph objectg=gh.to_graph()# To retrieve the serialized graphgh.serialize(format='ttl')[For a GitLab project, replacegimie.sources.githubbygimie.sources.gitlab,GithubExtractorbyGitlabExtractor, as well as the URL to the GitLab project.]OutputsThe default output isTurtle, a textual syntax forRDFdata model. We follow the schema recommended bycodemeta.
Supported formats are turtle, json-ld and n-triples (by specifying the--formatargument in your call i.e.gimie data https://github.com/numpy/numpy --format 'ttl').With no specifications, Gimie will print results in the terminal. Want to save Gimie output to a file? Add your file path to the end :gimie data https://github.com/numpy/numpy > path_to_output/gimie_output.ttlContributingAll contributions are welcome. New functions and classes should have associated tests and docstrings following thenumpy style guide.The code formatting standard we use isblack, with--line-length=79to followPEP8recommendations. We usepytestas our testing framework. This project usespyproject.tomlto define package information, requirements and tooling configuration.For development:activate a conda or virtual environment with Python 3.8 or highergitclonehttps://github.com/SDSC-ORD/gimie&&cdgimie
makeinstallrun tests:maketestrun checks:makecheckfor an easier use Github/Gitlab APIs, place your access tokens in the.envfile: (and don't worry, the.gitignorewill ignore them when you push to GitHub)cp .env.dist .envbuild documentation:makedocReleases and Publishing on PypiReleases are done via github releasea release will trigger a github workflow to publish the package on PypiMake sure to update to a new version inpyproject.tomlbefore making the releaseIt is possible to test the publishing on Pypi.test by running a manual workflow: go to github actions and run the Workflow: 'Publish on Pypi Test'