Python Report Card

Python 应用程序的报表卡片。(A report card for Python application)

Github stars Tracking Chart

Python Report Card(Python报告卡)

分析并报告 Github 上的 python 项目

Go 报告卡启发。

您的 Python 应用程序的报告卡。这将分析托管在 GitHub 上的 Python 项目的源代码质量(pep8,pyflakes 和 bandit 等),检查许可证和自述文件,并提供一些统计信息。 然后在网上显示结果。

您也可以在此处查看我们对未来版本的计划。

特性

  • 支持使用 PEP8 和 Pyflakes linting 工具检查代码质量
  • 支持计数代码行并计算一些统计信息
  • 支持检查许可证文件
  • 提供评分系统
  • 提供 pyreportcard Web 服务器
  • 支持检查 Python 2 和 3 的兼容性
  • 支持检查安全问题
  • 支持使用自己的配置文件进行自定义分析
  • 用作网络服务
  • 提供排名系统
  • 提供存储库等级的徽章链接

安装并运行

  • 克隆此存储库。
  • 运行 pip install -r requirements.txt 以安装所有依赖项(如果没有 pip,请先安装 pip)
  • 安装用于我们的后端数据库的 MongoDB。
  • 您必须在 config_secret.py 中配置秘密值。 首先,通过 cp config_secret.py.example config_secret.py 复制示例机密文件以创建机密文件,然后用您的机密值填充。
class SecretConfig:
    SECRET_KEY = '...'

    MONGO_DBNAME = 'reportcard'
    MONGO_HOST = '...'
    MONGO_PORT = ...
    # MONGO_USER = '...'
    # MONGO_PASSWORD = '...'
  • 通过python3 run.py运行服务器。
  • 去127.0.0.1:5000 并使用它。

还可以使用Docker和docker-compose在隔离的环境中运行应用程序和MongoDB。请按照上述说明进行操作,直到设置密码值。然后,创建一个由环境变量组成的.env文件,用于在容器中配置应用程序。下面提供了.env的示例:

echo "DEBUG=1" >> .env
echo "FLASK_DEBUG=1" >> .env
echo "FLASK_ENVIRONMENT=development" >> .env

要运行该应用程序和MongoDB,请构建应用程序并使用docker-compose运行它们。默认情况下,该应用将绑定到端口5000,并且可以通过localhost访问,例如127.0.0.1:5000。如果端口与其他正在运行的应用程序冲突,请随时在docker-compose.yml中修改端口绑定,然后重新运行该应用程序。

docker-compose up --build -d

提醒:如果要在生产环境中运行该应用程序,请不要忘记关闭 .env 文件中的 DEBUG 标志并将环境设置为生产环境。

测试

注意:我们现在只有 vcs 模块有一个测试代码。我们将尽快为所有功能添加更多测试

python3 -m unittest discover tests

依存关系

许可

该项目本身的内容已获得知识共享署名3.0许可的许可,而用于格式化和显示该内容的基础源代码也已获得MIT许可的许可。

(The first version translated by vz on 2020.07.26)

Main metrics

Overview
Name With Ownermingrammer/pyreportcard
Primary LanguagePython
Program languagePython (Language Count: 4)
PlatformLinux, Mac, Windows
License:MIT License
所有者活动
Created At2016-12-02 13:18:35
Pushed At2021-03-25 23:09:28
Last Commit At2020-01-08 08:18:46
Release Count0
用户参与
Stargazers Count96
Watchers Count6
Fork Count12
Commits Count142
Has Issues Enabled
Issues Count22
Issue Open Count13
Pull Requests Count8
Pull Requests Open Count3
Pull Requests Close Count4
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Inspired by Go Report Card

A report card for your Python applications. This analyzes the source code quality (pep8, pyflakes and bandit etc.) of the Python projects which are hosted on GitHub, checks for license and readme files, and provides some statistics. Then shows the results on the web.

You can see our planning for future versions in here too.

ScreenShots

main

report

Features

  • Supports checking the code quality using PEP8 and Pyflakes linting tools
  • Supports counting the code lines and calculates some stats
  • Supports checking the license file
  • Provides a grade system
  • Provides a pyreportcard web server
  • Supports checking the compatibility of Python 2 and 3
  • Supports checking the security issues
  • Supports customizable analyzing using own configuration file
  • Serves it as web service
  • Provides ranking system
  • Provides badge link of repository grade

Install and Run

  • Clone this repository.
  • Run pip install -r requirements.txt to install all dependencies (If you don't have pip, install pip first)
  • Install the MongoDB that is used for our backend database.
  • You must configure the secret values in config_secret.py. Firstly, copy the example secret file to create secret file by cp config_secret.py.example config_secret.py, and then fill out the secret values with yours.
class SecretConfig:
    SECRET_KEY = '...'

    MONGO_DBNAME = 'reportcard'
    MONGO_HOST = '...'
    MONGO_PORT = ...
    # MONGO_USER = '...'
    # MONGO_PASSWORD = '...'
  • Run server by python3 run.py.
  • Go 127.0.0.1:5000 and just use it.

It is also possible to run the app and MongoDB in isolated environment using
Docker and docker-compose. Follow the
instructions above up until setting the secret values. Then, create a .env file
comprises of environment variables for configuring the app in the container.
An example of .env is provided below:

echo "DEBUG=1" >> .env
echo "FLASK_DEBUG=1" >> .env
echo "FLASK_ENVIRONMENT=development" >> .env

To run the app and MongoDB, build the app and run them using docker-compose.
By default, the app will bind to port 5000 and can be accessed via localhost,
e.g. 127.0.0.1:5000. If the port conflicted with other running apps, feel free
to modify the port binding in docker-compose.yml and re-run the app.

docker-compose up --build -d

Reminder: If you are going to run the app in production, do not forget to turn
off DEBUG flags in .env file and set the environment to production.

Tests

Note: We have a test code for only vcs module now. We'll add more tests for all features soon

python3 -m unittest discover tests

Dependencies

License

The content of this project itself is licensed under the Creative Commons Attribution 3.0 license, and the underlying source code used to format and display that content is licensed under the MIT license.