{
"info": {
"author": "Thomas Aglassinger",
"author_email": "roskakori@users.sourceforge.net",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development"
],
"description": ".. image:: https://travis-ci.org/roskakori/pygount.svg?branch=master\n :target: https://travis-ci.org/roskakori/pygount\n :alt: Build Status\n\n.. image:: https://coveralls.io/repos/roskakori/pygount/badge.png?branch=master\n :target: https://coveralls.io/r/roskakori/pygount?branch=master\n :alt: Test coverage\n\n.. image:: https://landscape.io/github/roskakori/pygount/master/landscape.svg?style=flat\n :target: https://landscape.io/github/roskakori/pygount/master\n :alt: Code Health\n\n\npygount\n=======\n\nPygount is a command line tool to scan folders for source code files and\ncount the number of source code lines in it. It is similar to tools like\n`sloccount `_ and\n`cloc `_ but uses the\n`pygments `_\npackage to analyze the source code and consequently can analyze any\n`programming language supported by pygments `_.\n\nThe name is a combination of pygments and count.\n\nPygount is open source and distributed under the\n`BSD license `_. The source\ncode is available from https://github.com/roskakori/pygount.\n\n\nDownload and installation\n-------------------------\n\nPygount is available from https://pypi.python.org/pypi/pygount and can be\ninstalled running::\n\n $ pip install pygount\n\n\nUsage\n-----\n\nSimply run and specify the folder to analyze recursively, for example::\n\n $ pygount ~/development/sometool\n\nIf you omit the folder, the current folder of your shell is used as starting\npoint. Apart from folders you can also specify single files and shell patterns\n(using ``?``, ``*`` and ranges like ``[a-z]``).\n\nCertain files and folders are automatically excluded from the analysis:\n\n* files starting with dot (.) or ending in tilda (~)\n* folders starting with dot (.) or named ``_svn``.\n\nTo specify alternative patterns, use ``--folders-to-skip`` and\n``--names-to-skip``. Both take a comma separated list of patterns, see below\non the pattern syntax. To for example also prevent folders starting with two\nunderscores (``_``) from being analyzed, specify\n``--folders-to-skip=[...],__*``.\n\nTo limit the analysis on certain file types, you can specify a comma separated\nlist of suffixes to take into account, for example ``--suffix=py,sql,xml``.\n\nBy default the result of the analysis are written to the standard output in a\nformat similar to sloccount. To redirect the output to a file, use e.g.\n``--out=counts.txt``. To change the format to an XML file similar to cloc, use\n``--format=cloc-xml``.\n\n\nPatterns\n--------\n\nSome command line arguments take patterns as values.\n\nBy default, patterns are shell patterns using ``*``, ``?`` and ranges like\n``[a-z]`` as placeholders. Depending on your platform, the are case sensitive\n(Unix) or not (Mac OS, Windows).\n\nIf a pattern starts with ``[regex]`` you can specifiy a comma separated list\nof regular expressions instead using all the constructs supported by the\n`Python regular expression syntax `_.\nRegular expressions are case sensitive unless they include a ``(?i)`` flag.\n\nIf the first actual pattern is ``[...]`` default patterns are included.\nWithout it, defaults are ignored and only the pattern explicitely stated are\ntaken into account.\n\nSo for example to specify that generated code can also contain the German word\n\"Generiert\" in a case insensivie way use\n``--generated=[regex][...](?i).*generiert``.\n\n\nSource code encoding\n--------------------\n\nWhen reading source code, pygount automatically detects the encoding. It uses\na simple algorithm where it recognizes BOM, XML declaractions such as::\n\n \n\nand \"magic\" comments such as::\n\n # -*- coding: cp1252 -*-\n\nIf the file does not have an appropriate heading, pygount attempts to read it\nusing UTF-8. If this fails, it reads the file using a fallback encoding (by\ndefault CP1252) and ignores any encoding errors.\n\nYou can change this behavior using the ``--encoding`` option:\n\n* To keep the automatic analysis and use a different fallback encoding specify\n for example ``--encoding=automatic;iso-8859-15``\n* To use an automatic detection based on heuristic, use\n ``--encoding=chardet``. For this to work, the\n `chardet `_ package must be installed,\n* To use a specific encoding (for all files analyzed), use for example\n ``--encoding=iso-8859-15``.\n\n\nPseudo languages\n----------------\n\nIf a source code is not counted, the number of lines is 0 and the language\nshown is a pseudo language indicating the reason:\n\n* __binary__ - the source code is a binary file; the detection of binary files\n first ensures that file does not start with a BOM for UTF-8, UTF-16 or\n UTF-32 (which indicates text files). After that it checks for zero bytes\n within the initial 8192 bytes of the file.\n* __duplicate__ - the source code is a bytewise identical copy of another\n file; enable the command line option ``--duplicates`` to also count code in\n duplicates (and gain a minor performance improvement)\n* __empty__ - the source code is an empty file with a size of 0 bytes.\n* __error__ - the source code could not be parsed e.g. due an I/O error.\n* __generated__ - the source code is generated according to the command line\n option ``--generated``.\n* __unknown__ - pygments does not provide a lexer to parse the source code.\n\n\nOther information\n-----------------\n\nTo get a description of all the available command line options, run::\n\n $ pygount --help\n\nTo get the version number, run::\n\n $ pygount --version\n\n\nContinuous integration\n----------------------\n\nPygount can produce output that can be processed by the\n`SLOCCount plug-in `_\nfor the `Jenkins `_ continuous integration server.\n\nIt's recommended to run pygount as one of the first steps in your build\nprocess before any undesired file like compiler targets or generated source\ncode are built.\n\nAn example \"Execute shell\" build step for Jenkins is::\n\n pygount --format=cloc-xml --out cloc.xml --suffix=py --verbose\n\nThen add a post-build action \"Publish SLOCCount analysis results\" and set\n\"SLOCCount report\" to \"cloc.xml\".\n\n\nHow pygount counts code\n-----------------------\n\nPygount basically counts physical lines of source code.\n\nFirst, it lexes the code using the lexers ``pygments`` assigned to it. If\n``pygments`` cannot find an appropriate lexer, pygount has a few additional\ninternal lexers that can at least distinguish between code and comments:\n\n* m4, VBScript and WebFOCUS use minimalistic lexers that can distinguish\n between comments and code.\n* OMG IDL repurposes the existing Java lexer.\n\nFurthermore plain text has a separate lexer that counts all lines as comments.\n\nLines that only contain comment tokens and white space count as comments.\nLines that only contain white space are not taken into account. Everything\nelse counts as code.\n\nIf a line contains only \"white characters\" it is not taken into account\npresumably because the code is only formatted that way to make it easier to\nread. Currently white characters are::\n\n (),:;[]{}\n\nBecause of that, pygount reports about 10 to 20 percent fewer SLOC for C-like\nlanguages than other similar tools.\n\nFor some languages \"no operations\" are detected and treated as white space.\nFor example Python's ``pass`` or Transact-SQL's ``begin`` and ``end`` .\n\nAs example consider this Python code::\n\n class SomeError(Exception):\n \"\"\"\n Some error caused by some issue.\n \"\"\"\n pass\n\nThis counts as 1 line of code and 3 lines of comments. The line with ``pass``\nis considered a \"no operation\" and thus not taken into account.\n\n\nComparison with other tools\n---------------------------\n\nPygount can analyze more languages than other common tools such as sloccount\nor cloc because it builds on ``pygments``, which provides lexers for hundreds\nof languages. This also makes it easy to support another language: simply\n`write your own lexer `_.\n\nFor certain corner cases pygount give more accurate results because it\nactually lexes the code unlike other tools that mostly look for comment\nmarkers and can get confused when they show up inside strings. In practice\nthough this should not make much of a difference.\n\nPygount is slower than most other tools. Partially this is due to actually\nlexing instead of just scanning the code. Partially other tools can use\nstatically compiled languages such as Java or C, which are generally faster\nthan dynamic languages. For many applications though pygount should be\n\"fast enough\", especially when called during a nightly build.\n\n\nAPI\n---\n\nPygount provides a simple API to integrate it in other tools. This however is\ncurrently still a work in progress and subject to change.\n\nHere's an example on how to analyze one of pygount's own source codes::\n\n >>> import pygount\n >>> analysis = pygount.source_analysis('pygount/analysis.py', 'pygount')\n >>> analysis\n SourceAnalysis(path='pygount/analysis.py', language='Python', group='pygount', code=302, documentation=66, empty=62, string=23, state='analyzed', state_info=None)\n\n\nVersion history\n---------------\n\nVersion 1.0.0, 2017-07-04\n\n* Fixed confusing warning about XML file ```` caused by SAX parser.\n As a workaround, ```` is now replaced by the actual path of the\n XML file that cannot be parsed.\n* Added Python 3.6 to the list of supported versions (issue\n `#14 `_).\n\nVersion 0.9, 2017-05-04\n\n* Fixed ``AssertionError`` when option ``--encoding=chardet`` was specified.\n* Changed warning message \"no fallback encoding specified, using \"\n to a debug message because it did not add any interesting information as\n the encoding actually used is visible in the info message for each file.\n* Added detection of binary files and excluded them from the analysis. In\n particular Django model objects (``*.mo``) are not considered Modelica\n source code anymore (issue\n `#11 `_).\n* Added detection of DocBook XML by DTD (issue\n `#10 `_).\n* Added support for suffices to indicate PL/SQL files according to\n `Oracle FAQ entry on file extensions `_\n (issue `#12 `_).\n* Added possibility to specify a fallback encoding for encoding 'chardet'. Use\n e.g. ``--encoding=chardet;cp1252``.\n\nVersion 0.8, 2016-10-07\n\n* Fixed option ``--verbose``. Now each analyzed source code results in at least\n one informational message in the log.\n* Added detection of duplicates using size and then MD5 code as criteria (issue\n `#2 `_). Use the option\n ``--duplicates`` to still count duplicate source code.\n* Improved detetion of programming language, which is now more consistent and\n yields the same language between Python invocations.\n\nVersion 0.7, 2016-09-28\n\n* Fixed that option ``--generated`` was ignored.\n* Added support for a couple of languages not supported by ``pygments`` yet:\n\n * m4, VBScript and WebFOCUS use minimalistic lexers that can distinguish\n between comments and code.\n * OMG IDL repurposes the existing Java lexer.\n\n* Added detection of certain XML dialects as separate language (issue\n `#8 `_).\n\nVersion 0.6, 2016-09-26\n\n* Fixed that source files could end up as ``__error__`` if the first non ASCII\n characters showed up only after 16 kilobyte and the encoding was not UTF-8.\n Now pygount attempts to read the whole file as UTF-8 before assuming it\n actually is UTF-8.\n* Changed lines in plain text files to count as comments (issue\n `#9 `_). Before pygments\n treated them as `ResourceBundle`.\n* Changed that empty files have ``__empty__`` as language (issue\n `#7 `_).\n* Extended workaround for\n `pygments issue #1284 `_\n to replace any lexer ``*+Evoque`` by ``*``.\n\nVersion 0.5, 2016-09-22\n\n* Added that generated source code is excluded from analysis (issue\n `#1 `_). Use option\n ``--generated`` to specify patterns that indicate generated code.\n* Added workaround for pygments sometimes detecting the same XML file as XML\n and other times as XML+Evoque (probably depending on the hash seed). Now\n XML+Evoque is always changed to XML.\n* Added ``__pycache__`` as default ``--folder-to-skip``.\n* Added notes on pseudo languages for source code that cannot be analyzed.\n\nVersion 0.4, 2016-09-11\n\n* Fixed ``LookupError`` on broken encoding in magic comment (issue\n `#4 `_).\n* Added options ``--folders-to-skip`` and ``--names-to-skip`` to specify which\n files should be excluded from analysis.\n* Added comma (``,``) and colon (``:``) to list of \"white characters\" that do\n not count as code if there is nothing else in the line.\n* Improved pattern matching: for all options that according to ``--help``\n take ``PATTERNS`` you can now specify that the patterns are regular\n expressions instead of shell patterns (using ``[regex]``) and that they\n should extend the default patterns (using ``[...]``).\n* Improved documentation: added notes on how code is counted and how pygount\n compares to other similar tools.\n\nVersion 0.3, 2016-08-20\n\n* Fixed ``@rem`` comments in DOS batch files (issue\n `#3 `_).\n* Cleaned up code.\n\nVersion 0.2, 2016-07-10\n\n* Fixed that files starting with underscore (e.g. ``__init__.py``) were\n excluded from analysis.\n* Changed ``chardet`` package to be optional.\n* Added possibility to specify single files and glob patterns to analyze.\n* Added that lines containing only certain characters are treated as white\n space instead of code. Currently this concerns brackets (``()[]{}``) and\n semicolon (``;``).\n* Added that Python's ``pass`` statement is treated as white space instead of\n code.\n* Cleaned up and (slightly) optimized code.\n\nVersion 0.1, 2016-07-05\n\n* Initial public release.\n",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/roskakori/pygount",
"keywords": "code analysis count SLOC",
"license": "BSD",
"maintainer": "",
"maintainer_email": "",
"name": "pygount",
"package_url": "https://pypi.org/project/pygount/",
"platform": "",
"project_url": "https://pypi.org/project/pygount/",
"project_urls": {
"Homepage": "https://github.com/roskakori/pygount"
},
"release_url": "https://pypi.org/project/pygount/1.0.0/",
"requires_dist": null,
"requires_python": "",
"summary": "count source lines of code (SLOC) using pygments",
"version": "1.0.0"
},
"last_serial": 2997921,
"releases": {
"0.1": [
{
"comment_text": "",
"digests": {
"md5": "a5e2809a35f417b1720ecbd30152b643",
"sha256": "5427a1540db548ada92520eb1240d4a7a80ba479e9cd631c9ec01c69dbf4aa84"
},
"downloads": -1,
"filename": "pygount-0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a5e2809a35f417b1720ecbd30152b643",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 10769,
"upload_time": "2016-07-05T16:28:39",
"url": "https://files.pythonhosted.org/packages/e1/44/4c8f7256b058e5d2659eb27fe8465fbf850069098cb77ded64a1b2f9c59b/pygount-0.1-py3-none-any.whl"
}
],
"0.2": [
{
"comment_text": "",
"digests": {
"md5": "d440c75b5dd4d455f44600e7d6ba9bde",
"sha256": "fc1e23b9552647b5d6a0b94217fb429f4aa2cbd099cbc6e498df7a8c5b7e8559"
},
"downloads": -1,
"filename": "pygount-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d440c75b5dd4d455f44600e7d6ba9bde",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 14183,
"upload_time": "2016-07-10T20:50:50",
"url": "https://files.pythonhosted.org/packages/fd/d2/6a33f9b5e080530689b2376fb33758b11f1197880f53e79b687551afca2c/pygount-0.2-py3-none-any.whl"
}
],
"0.3": [
{
"comment_text": "",
"digests": {
"md5": "c3754d9c1e2029ff853644eb317efc10",
"sha256": "61f67c8470c272a71cf468ef703528ca241fb9785bc9180c9fbaa116ca73642e"
},
"downloads": -1,
"filename": "pygount-0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c3754d9c1e2029ff853644eb317efc10",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 14635,
"upload_time": "2016-08-20T00:27:37",
"url": "https://files.pythonhosted.org/packages/f7/22/0ceef3400ddacf861dedbcd354dd795146a926c9e0b04036528e0aec65e4/pygount-0.3-py3-none-any.whl"
}
],
"0.4": [
{
"comment_text": "",
"digests": {
"md5": "65b7c5bd5b2029e3e913b117fc68fe90",
"sha256": "8792d48dde689545cc22b28296f53a12e811bc7a9da348728212c7aacd21e36f"
},
"downloads": -1,
"filename": "pygount-0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "65b7c5bd5b2029e3e913b117fc68fe90",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 20226,
"upload_time": "2016-09-11T19:39:15",
"url": "https://files.pythonhosted.org/packages/be/0f/fbb0c7c517b906aa65f3ef597215a72cbd2a542fac52cb6c48ed9029027f/pygount-0.4-py3-none-any.whl"
}
],
"0.5": [
{
"comment_text": "",
"digests": {
"md5": "af76d411c42e5e63343c2666c584b33b",
"sha256": "8b64709de4deb869f41ba704cf0095e3bd1ca17b6d4633638b447a57f186738c"
},
"downloads": -1,
"filename": "pygount-0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "af76d411c42e5e63343c2666c584b33b",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 22295,
"upload_time": "2016-09-22T02:50:46",
"url": "https://files.pythonhosted.org/packages/7c/98/81fb846c6a0b1fabf07e2f111c86e148c363059eb6c3854673f01abf51fc/pygount-0.5-py3-none-any.whl"
}
],
"0.6": [
{
"comment_text": "",
"digests": {
"md5": "2d3def717c5336d2439bd189c855fafe",
"sha256": "72f2ec2985fd60e8813d4299cb2a307f798e2fe6cbd047a647170495500220c3"
},
"downloads": -1,
"filename": "pygount-0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d3def717c5336d2439bd189c855fafe",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 23513,
"upload_time": "2016-09-25T23:21:50",
"url": "https://files.pythonhosted.org/packages/00/52/b41f8ea73b7a34877aed3d42bb1aead201a942be4bb86cc39c58e5303c1a/pygount-0.6-py3-none-any.whl"
}
],
"0.7": [
{
"comment_text": "",
"digests": {
"md5": "8303c8dde7b0efa5149ad952e6c6df7e",
"sha256": "9cdbcf150e7b30580686ab7e7432ee1725b383532797329ce24f409368e73f17"
},
"downloads": -1,
"filename": "pygount-0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8303c8dde7b0efa5149ad952e6c6df7e",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 26233,
"upload_time": "2016-09-27T22:10:12",
"url": "https://files.pythonhosted.org/packages/7e/6c/0fae2cfb8dc7f6999c0199e23e70b1c438ab094d144fdb6efa0393360f72/pygount-0.7-py3-none-any.whl"
}
],
"0.8": [
{
"comment_text": "",
"digests": {
"md5": "9e1a65bdbff7ffb3dd0793c90d7cc528",
"sha256": "b12aa1b221630b2d5842e67275be1a19a15037bb449db711bb7b166c0bf76733"
},
"downloads": -1,
"filename": "pygount-0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9e1a65bdbff7ffb3dd0793c90d7cc528",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 27313,
"upload_time": "2016-10-07T05:50:21",
"url": "https://files.pythonhosted.org/packages/bf/bb/4fceef8702ecaf36d247a086b400df2e404185d5d4c25cffcd114e576cbb/pygount-0.8-py3-none-any.whl"
}
],
"0.9": [
{
"comment_text": "",
"digests": {
"md5": "0c71d380b95738888f4f953ac5d583a9",
"sha256": "f230a1d771a70218309e7cb135e4217030c2b0e3050a69f4baa624f67ba111a3"
},
"downloads": -1,
"filename": "pygount-0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0c71d380b95738888f4f953ac5d583a9",
"packagetype": "bdist_wheel",
"python_version": "3.5",
"requires_python": null,
"size": 29318,
"upload_time": "2017-05-04T20:29:15",
"url": "https://files.pythonhosted.org/packages/14/aa/1abcd45949b5e7a31cd9b21254bde2fe346ed4712504e924508f61a3934d/pygount-0.9-py3-none-any.whl"
}
],
"1.0.0": [
{
"comment_text": "",
"digests": {
"md5": "58736def6a8075207b3c4f8292919630",
"sha256": "8f1f89ed152b70f4b3553cf855cc4179d55d13858a6aaf46dcc213bbcde2d560"
},
"downloads": -1,
"filename": "pygount-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "58736def6a8075207b3c4f8292919630",
"packagetype": "bdist_wheel",
"python_version": "3.6",
"requires_python": null,
"size": 29707,
"upload_time": "2017-07-03T22:25:32",
"url": "https://files.pythonhosted.org/packages/e5/cd/dd79cbb044b4c64575b22e8d2621a10a6ae380ac751d20a9a53229846804/pygount-1.0.0-py3-none-any.whl"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "58736def6a8075207b3c4f8292919630",
"sha256": "8f1f89ed152b70f4b3553cf855cc4179d55d13858a6aaf46dcc213bbcde2d560"
},
"downloads": -1,
"filename": "pygount-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "58736def6a8075207b3c4f8292919630",
"packagetype": "bdist_wheel",
"python_version": "3.6",
"requires_python": null,
"size": 29707,
"upload_time": "2017-07-03T22:25:32",
"url": "https://files.pythonhosted.org/packages/e5/cd/dd79cbb044b4c64575b22e8d2621a10a6ae380ac751d20a9a53229846804/pygount-1.0.0-py3-none-any.whl"
}
]
}