列出stargazers并检查用户是否为存储库添加了星号
github-stargazers的Python项目详细描述
列出stargazers并检查用户是否为存储库添加了星号。
安装
建议安装在虚拟环境中 Python >= 3.6。
安装pipenv
$ pip3 install pipenv
在cd进入工作目录后,配置虚拟环境 并安装github-stargazers
$ pipenv --python=python3.6 $ pipenv install github-stargazers
用法
作为命令行应用程序
$ pipenv run github-stargazers <username>/<repository> [OPTIONS]
其中OPTIONS可以是
--user <username> GitHub username to see if it is a stargazer.
如果不使用--user,它只显示存储库的stargazers。
当它与--user一起使用时,它显示该用户是否将 是否存储库。
示例:
$ pipenv run github-stargazers marius92mc/github-stargazers --user marius92mc
作为进口
fromgithub_stargazers.githubimportGitHubgithub=GitHub("yasoob/fb-messenger-bot")print(github.get_all_stargazers())print(github.is_stargazer("Jazzthedog"))
从源运行
要求
- python 3.6
- pipenv
开始
安装pipenv
$ pip3 install pipenv
将python 3.6设置为pipenv用于创建虚拟 环境
$ cd github_stargazers $ pipenv --python=python3.6
安装依赖项
$ pipenv install --dev
运行
首先我们需要安装这个包,根据setup.py 说明。
$ pipenv run python setup.py install
然后我们可以在pipenv中运行安装的包。
$ pipenv run github-stargazers <username>/<repository> [OPTIONS]
其中OPTIONS可以是
--user <username> GitHub username to see if it is a stargazer.
对已更改的文件运行autopep8、mypy、pylint
$ ./autopep8.sh $ ./mypy.sh $ ./pylint.sh
启动ipython控制台
$ pipenv run ipython
测试
运行单元测试。
$ pipenv run pytest
或者有更详细的输出,比如$ pipenv run pytest -vv。
调试失败的测试
$ pipenv run pytest -vv -s -x --pdb --showlocals
有关详细信息,请参见pytest documentation。