用于提取软件存储库元数据的包
llnl-scraper的Python项目详细描述
刮刀
scraper是一个工具,用于从各种 代码托管平台,例如:github.com、github enterprise、gitlab.com, 托管Gitlab和Bitbucket服务器。
入门:code.gov
Code.gov是美国联邦政府新推出的一个网站 政府允许人们从政府习惯中获取元数据 开发的软件。这个站点需要元数据才能运行,而这个python 图书馆可以帮忙!
要开始,您需要一个GitHub Personal Auth
Token
向github api发出请求。这应该在您的环境中设置,或者
shell rc
文件名为GITHUB_API_TOKEN
:
$ export GITHUB_API_TOKEN=XYZ
$ echo "export GITHUB_API_TOKEN=XYZ" >> ~/.bashrc
此外,要执行工时估计,您需要安装
cloc
进入你的环境。这通常使用Package
Manager完成,例如
npm
或homebrew
。
然后要为您的代理生成一个code.json
文件,您需要一个
config.json
文件,用于协调要连接和擦除的平台
数据来自。示例配置文件可以在demo.json中找到。一次
你有你的配置文件,你准备好安装和运行刮刀!
# Install Scraper
$ pip install -e .
# Run Scraper with your config file ``config.json``
$ scraper --config config.json
生成的code.json
文件的完整示例可以是found
here。
配置文件选项
配置文件是一个json文件,用于指定存储库平台 从中提取项目以及一些可用于覆盖的设置 通过刮削返回的数据不完整或不准确。
基本结构是:
{#REQUIRED"contact_email":"...",#Usedwhenthecontactemailcannotbefoundotherwise#OPTIONAL"agency":"...",#Youragencyabbreviationhere"organization":"...",#Theorganizationwithintheagency"permissions":{...},#ObjectcontainingdefaultvaluesforusageTypeandexemptionText#Platformconfigurations,describedinmoredetailbelow"GitHub":[...],"GitLab":[...],"Bitbucket":[...],}
"GitHub":[{"url":"https://github.com",#GitHub.comorGitHubEnterpriseURLtoinventory"token":null,#PrivatetokenforaccessingthisGitHubinstance"public_only":true,#Onlyinventorypublicrepositories"orgs":[...],#Listoforganizationstoinventory"repos":[...],#Listofsinglerepositoriestoinventory"exclude":[...]#Listoforganizations/repositoriestoexcludefrominventory}],
"GitLab":[{"url":"https://gitlab.com",#GitLab.comorhostedGitLabinstanceURLtoinventory"token":null,#PrivatetokenforaccessingthisGitHubinstance"fetch_languages":false,#IncludeindividualcallstoAPIforlanguagemetadata.Veryslow,sodefaultstofalse.(eg,for191projectsoninternalserver,5secondsforFalse,12minutes,38secondsforTrue)"orgs":[...],#Listoforganizationstoinventory"repos":[...],#Listofsinglerepositoriestoinventory"exclude":[...]#Listofgroups/repositoriestoexcludefrominventory}]
"Bitbucket":[{"url":"https://bitbucket.internal",#BaseURLforaBitbucketServerinstance"username":"",#Usernametoauthenticatewith"password":"",#Passwordtoauthenticatewith"exclude":[...]#Listofprojects/repositoriestoexcludefrominventory}]
"TFS":[{"url":"https://tfs.internal",#BaseURLforaTeamFoundationServer(TFS)orVisualStudioTeamServices(VSTS)orAzureDevOpsinstance"token":null,#PrivatetokenforaccessingthisTFSinstance"exclude":[...]#Listofprojects/repositoriestoexcludefrominventory}]
许可证
scraper是根据麻省理工学院的许可证发布的。有关详细信息,请参见 LICENSE文件。
LLNL-代码-705597