Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.6%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Various code metrics for Python code
Basic Info
- Host: GitHub
- Owner: rubik
- License: mit
- Language: Python
- Default Branch: master
- Homepage: http://radon.readthedocs.org/
- Size: 2.6 MB
Statistics
- Stars: 1,837
- Watchers: 33
- Forks: 122
- Open Issues: 38
- Releases: 0
Topics
Metadata Files
README.rst
Radon
=====
.. image:: https://img.shields.io/coveralls/rubik/radon/master.svg?style=for-the-badge
:alt: Coveralls badge
:target: https://coveralls.io/r/rubik/radon?branch=master
.. image:: https://img.shields.io/pypi/v/radon.svg?style=for-the-badge
:alt: PyPI latest version badge
:target: https://pypi.python.org/pypi/radon
.. image:: https://img.shields.io/pypi/l/radon.svg?style=for-the-badge
:alt: Radon license
:target: https://pypi.python.org/pypi/radon
.. raw:: html
----
Radon is a Python tool that computes various metrics from the source code.
Radon can compute:
* **McCabe's complexity**, i.e. cyclomatic complexity
* **raw** metrics (these include SLOC, comment lines, blank lines, &c.)
* **Halstead** metrics (all of them)
* **Maintainability Index** (the one used in Visual Studio)
Requirements
------------
Radon will run from **Python 2.7** to **Python 3.12** (except Python versions
from 3.0 to 3.3) with a single code base and without the need of tools like
2to3 or six. It can also run on **PyPy** without any problems (currently PyPy
3.5 v7.3.1 is used in tests).
Radon depends on as few packages as possible. Currently only `mando` is
strictly required (for the CLI interface). `colorama` is also listed as a
dependency but if Radon cannot import it, the output simply will not be
colored.
**Note**:
**Python 2.6** was supported until version 1.5.0. Starting from version 2.0, it
is not supported anymore.
Installation
------------
With Pip:
.. code-block:: sh
$ pip install radon
If you want to configure Radon from `pyproject.toml` and you run Python <3.11,
you'll need the extra `toml` dependency:
.. code-block:: sh
$ pip install radon[toml]
Or download the source and run the setup file:
.. code-block:: sh
$ python setup.py install
Usage
-----
Radon can be used either from the command line or programmatically.
Documentation is at https://radon.readthedocs.org/.
Cyclomatic Complexity Example
-----------------------------
Quick example:
.. code-block:: sh
$ radon cc sympy/solvers/solvers.py -a -nc
sympy/solvers/solvers.py
F 346:0 solve - F
F 1093:0 _solve - F
F 1434:0 _solve_system - F
F 2647:0 unrad - F
F 110:0 checksol - F
F 2238:0 _tsolve - F
F 2482:0 _invert - F
F 1862:0 solve_linear_system - E
F 1781:0 minsolve_linear_system - D
F 1636:0 solve_linear - D
F 2382:0 nsolve - C
11 blocks (classes, functions, methods) analyzed.
Average complexity: F (61.0)
Explanation:
* ``cc`` is the radon command to compute Cyclomatic Complexity
* ``-a`` tells radon to calculate the average complexity at the end. Note that
the average is computed among the *shown* blocks. If you want the total
average, among all the blocks, regardless of what is being shown, you should
use ``--total-average``.
* ``-nc`` tells radon to print only results with a complexity rank of C or
worse. Other examples: ``-na`` (from A to F), or ``-nd`` (from D to F).
* The letter *in front of* the line numbers represents the type of the block
(**F** means function, **M** method and **C** class).
Actually it's even better: it's got colors!
.. image:: https://cloud.githubusercontent.com/assets/238549/3707477/5793aeaa-1435-11e4-98fb-00e0bd8137f5.png
:alt: A screen of Radon's cc command
**Note about file encoding**
On some systems, such as Windows, the default encoding is not UTF-8. If you are
using Unicode characters in your Python file and want to analyze it with Radon,
you'll have to set the `RADONFILESENCODING` environment variable to `UTF-8`.
On a Continuous Integration server
----------------------------------
If you are looking to use `radon` on a CI server you may be better off with
`xenon `_. Although still experimental, it will
fail (that means exiting with a non-zero exit code) when various thresholds are
surpassed. `radon` is more of a reporting tool, while `xenon` is a monitoring
one.
If you are looking for more complete solutions, read the following sections.
Codacy
++++++++++++
`Codacy `_ uses Radon `by default `_ to calculate metrics from the source code.
Code Climate
++++++++++++
Radon is available as a `Code Climate Engine `_.
To understand how to add Radon's checks to your Code Climate Platform, head
over to their documentation:
https://docs.codeclimate.com/v1.0/docs/radon
coala Analyzer
++++++++++++++
Radon is also supported in `coala `_. To add Radon's
checks to coala, simply add the ``RadonBear`` to one of the sections in
your ``.coafile``.
CodeFactor
++++++++++++
`CodeFactor `_ uses Radon `out-of-the-box `_ to calculate Cyclomatic Complexity.
Usage with Jupyter Notebooks
----------------------------
Radon can be used with ``.ipynb`` files to inspect code metrics for Python cells. Any ``%`` macros will be ignored in the metrics.
.. note::
Jupyter Notebook support requires the optional ``nbformat`` package. To install, run ``pip install nbformat``.
To enable scanning of Jupyter notebooks, add the ``--include-ipynb`` flag.
To enable reporting of individual cells, add the ``--ipynb-cells`` flag.
Quick example:
.. code-block:: sh
$ radon raw --include-ipynb --ipynb-cells .
example.ipynb
LOC: 63
LLOC: 37
SLOC: 37
Comments: 3
Single comments: 2
Multi: 10
Blank: 14
- Comment Stats
(C % L): 5%
(C % S): 8%
(C + M % L): 21%
example.ipynb:[0]
LOC: 0
LLOC: 0
SLOC: 0
Comments: 0
Single comments: 0
Multi: 0
Blank: 0
- Comment Stats
(C % L): 0%
(C % S): 0%
(C + M % L): 0%
example.ipynb:[1]
LOC: 2
LLOC: 2
SLOC: 2
Comments: 0
Single comments: 0
Multi: 0
Blank: 0
- Comment Stats
(C % L): 0%
(C % S): 0%
(C + M % L): 0%
Links
-----
* Documentation: https://radon.readthedocs.org
* PyPI: http://pypi.python.org/pypi/radon
* Issue Tracker: https://github.com/rubik/radon/issues
Owner
- Name: Michele Lacchia
- Login: rubik
- Kind: user
- Location: Your mind.
- Website: https://signal-to-noise.xyz/
- Repositories: 84
- Profile: https://github.com/rubik
GitHub Events
Total
- Issues event: 6
- Watch event: 144
- Issue comment event: 15
- Push event: 5
- Pull request event: 5
- Fork event: 8
Last Year
- Issues event: 6
- Watch event: 144
- Issue comment event: 15
- Push event: 5
- Pull request event: 5
- Fork event: 8
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Michele Lacchia | m****a@g****m | 436 |
| Eric Chea | e****c@c****m | 6 |
| John Pignata | j****n@p****m | 5 |
| Robert Dougherty-Bliss | r****s@g****m | 5 |
| schettino72 | s****2@g****m | 4 |
| David Douard | d****d@s****g | 3 |
| Joaquin Sargiotto | j****o@g****m | 2 |
| Marc Abramowitz | m****c@m****m | 2 |
| Anthony | b****7@y****u | 2 |
| Andrew Shannon Brown | a****n | 2 |
| AJ Slater | aj@s****t | 2 |
| Anthony Shaw | a****w@a****g | 2 |
| Carlos Borroto | c****o@g****m | 2 |
| Bit Shift | b****t@b****t | 1 |
| Andrii Oriekhov | a****v@g****m | 1 |
| Andrew Kittredge | a****e@g****m | 1 |
| Alvaro Jose | k****c | 1 |
| Alexander Mankuta | a****b@p****e | 1 |
| 4l1fe | 4****e | 1 |
| xxvv | s****g@1****m | 1 |
| kernc | k****e@g****m | 1 |
| justWerns | a****i@g****m | 1 |
| franzhaas | f****s@g****m | 1 |
| devdanzin | 7****n | 1 |
| dependabot[bot] | 4****] | 1 |
| ABaldwinHunter | a****r@c****m | 1 |
| Alex Brandt | a****l@a****m | 1 |
| Andrew S. Brown | a****n@n****m | 1 |
| Chris Hulton | c****s@c****m | 1 |
| Collin Stocks | c****n@h****m | 1 |
| and 30 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 78
- Total pull requests: 54
- Average time to close issues: 5 months
- Average time to close pull requests: 2 months
- Total issue authors: 74
- Total pull request authors: 38
- Average comments per issue: 2.58
- Average comments per pull request: 2.54
- Merged pull requests: 35
- Bot issues: 0
- Bot pull requests: 1
Past Year
- Issues: 6
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 6
- Pull request authors: 4
- Average comments per issue: 0.5
- Average comments per pull request: 0.2
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rwbogl (3)
- kloczek (2)
- kush96 (2)
- karulis (1)
- marcoquerque (1)
- flazzarini (1)
- donfiguerres (1)
- Freed-Wu (1)
- devdanzin (1)
- rmorshea (1)
- Chamomile-Cat (1)
- edwinelisia (1)
- DonJayamanne (1)
- MartinThoma (1)
- wuligaigai (1)
Pull Request Authors
- devdanzin (4)
- cclauss (3)
- kieran-ryan (3)
- tonybaloney (3)
- douardda (3)
- ajslater (2)
- ecarrara (2)
- benabel (2)
- msabramo (2)
- syubogdanov (2)
- akx (2)
- mhamdan91 (2)
- duongdominhchau (2)
- tribals (2)
- joxl (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 4
-
Total downloads:
- pypi 1,638,970 last-month
- Total docker downloads: 1,954,035
-
Total dependent packages: 101
(may contain duplicates) -
Total dependent repositories: 1,352
(may contain duplicates) - Total versions: 122
- Total maintainers: 1
pypi.org: radon
Code Metrics in Python
- Homepage: https://radon.readthedocs.org/
- Documentation: https://radon.readthedocs.io/
- License: MIT
-
Latest release: 6.0.1
published almost 3 years ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/rubik/radon
- Documentation: https://pkg.go.dev/github.com/rubik/radon#section-documentation
- License: mit
-
Latest release: v6.0.1+incompatible
published almost 3 years ago
Rankings
conda-forge.org: radon
Radon is a Python tool that computes various metrics from the source code. Radon can compute: - McCabe’s complexity, i.e. cyclomatic complexity - raw metrics (these include SLOC, comment lines, blank lines, &c.) - Halstead metrics (all of them) - Maintainability Index (the one used in Visual Studio)
- Homepage: https://github.com/rubik/radon
- License: MIT
-
Latest release: 5.1.0
published over 4 years ago
Rankings
anaconda.org: radon
Radon is a Python tool that computes various metrics from the source code. Radon can compute: - McCabe’s complexity, i.e. cyclomatic complexity - raw metrics (these include SLOC, comment lines, blank lines, &c.) - Halstead metrics (all of them) - Maintainability Index (the one used in Visual Studio)
- Homepage: https://github.com/rubik/radon
- License: MIT
-
Latest release: 6.0.1
published 6 months ago
Rankings
Dependencies
- alpine edge build
- coverage * develop
- mock * develop
- pytest * develop
- pytest-mock * develop
- tox * develop
- colorama >=0.3,<0.4
- mando >=0.3,<0.4
- appdirs ==1.4.4 develop
- coverage ==4.4 develop
- distlib ==0.3.1 develop
- filelock ==3.0.12 develop
- mock ==2.0.0 develop
- pbr ==5.5.1 develop
- pluggy ==0.13.1 develop
- py ==1.10.0 develop
- pytest ==3.0.7 develop
- pytest-mock ==1.6.0 develop
- six ==1.15.0 develop
- tox ==2.7.0 develop
- virtualenv ==20.4.4 develop
- colorama ==0.3.9
- flake8 ==3.9.1
- flake8-polyfill ==1.0.1
- mando ==0.3.3
- mccabe ==0.6.1
- pycodestyle ==2.7.0
- pyflakes ==2.3.1
- colorama >=0.4.1
- colorama ==0.4.1
- mando >=0.6,<0.7
- colorama >=0.4.1
- colorama ==0.4.1
- mando >=0.6,<0.7
- argparse * test
- coverage * test
- coveralls * test
- nbformat * test
- pytest >=2.7 test
- pytest >=5.0 test
- pytest-mock * test
- argparse 1.4.0 develop
- attrs 22.2.0 develop
- cachetools 5.3.0 develop
- certifi 2022.12.7 develop
- chardet 5.1.0 develop
- charset-normalizer 2.0.12 develop
- coverage 6.5.0 develop
- coveralls 3.3.1 develop
- distlib 0.3.6 develop
- docopt 0.6.2 develop
- exceptiongroup 1.1.1 develop
- fastjsonschema 2.16.3 develop
- filelock 3.10.4 develop
- idna 3.4 develop
- importlib-metadata 6.1.0 develop
- importlib-resources 5.12.0 develop
- iniconfig 2.0.0 develop
- jsonschema 4.17.3 develop
- jupyter-core 4.12.0 develop
- nbformat 5.8.0 develop
- packaging 23.0 develop
- pkgutil-resolve-name 1.3.10 develop
- platformdirs 3.1.1 develop
- pluggy 1.0.0 develop
- pyproject-api 1.5.1 develop
- pyrsistent 0.19.3 develop
- pytest 7.2.2 develop
- pytest-mock 3.10.0 develop
- pywin32 305 develop
- requests 2.27.1 develop
- tomli 2.0.1 develop
- tox 4.4.7 develop
- traitlets 5.9.0 develop
- typing-extensions 4.5.0 develop
- urllib3 1.26.15 develop
- virtualenv 20.21.0 develop
- zipp 3.15.0 develop
- colorama 0.4.6
- mando 0.7.1
- six 1.16.0
- colorama --- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: ">=0.4.1" markers: python_version > "3.4" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: "==0.4.1" markers: python_version <= "3.4"
- mando >=0.6,<0.8
- python >=3.7,<4.0