Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Refactor - split to modules, add parser tests, update readme #200

Merged
merged 21 commits into from
Sep 11, 2016
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ docstring conventions.
`PEP 257 <http://www.python.org/dev/peps/pep-0257/>`_ out of the box, but it
should not be considered a reference implementation.

The framework for checking docstring style is flexible, and
custom checks can be easily added, for example to cover
NumPy `docstring conventions
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_.

**pydocstyle** supports Python 2.6, 2.7, 3.3, 3.4, 3.5, pypy and pypy3.

Quick Start
Expand All @@ -27,16 +22,19 @@ Install

pip install pydocstyle


Run
^^^
^^^^

.. code::

$ pydocstyle test.py
test.py:18 in private nested class `meta`:
D101: Docstring missing
test.py:22 in public method `method`:
D102: Docstring missing
test.py:27 in public function `get_user`:
D300: Use """triple double quotes""" (found '''-quotes)
test:75 in public function `init_database`:
D201: No blank lines allowed before function docstring (found 1)
...


Expand All @@ -50,7 +48,7 @@ Links
:target: https://readthedocs.org/projects/pydocstyle/?badge=latest
:alt: Documentation Status

* `Read the full documentation here <https://pydocstyle.readthedocs.io>`_.
* `Read the full documentation here <https://pydocstyle.org>`_.

* `Fork pydocstyle on GitHub <https://github.com/PyCQA/pydocstyle>`_.

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@


def generate_error_code_table():
from pydocstyle import ErrorRegistry
from pydocstyle.violations import ErrorRegistry
with open(os.path.join('snippets', 'error_code_table.rst'), 'wt') as outf:
outf.write(ErrorRegistry.to_rst())

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r requirements/docs.txt
-r requirements/tests.txt
-r requirements/runtime.txt
File renamed without changes.
3 changes: 2 additions & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest==2.7.3
pytest-pep8
mock
tox
tox
pathlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I have a quibble with this file. Is tox a test dependency and the rest are dependencies enumerated in tox, or are these test dependencies and tox is a different kind of requirement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated to tests.txt and test_env.txt.

11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from setuptools import setup


with open(os.path.join('src', 'pydocstyle.py')) as f:
this_dir = os.path.dirname(__file__)

with open(os.path.join(this_dir, 'src', 'pydocstyle', 'utils.py')) as f:
for line in f:
if line.startswith('__version__'):
version = eval(line.split('=')[-1])
Expand All @@ -27,12 +29,13 @@
'License :: OSI Approved :: MIT License',
],
keywords='pydocstyle, PEP 257, pep257, PEP 8, pep8, docstrings',
packages=('pydocstyle',),
py_modules=('main',),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you packaging main?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of this is to allow to run pydocstyle from the command line without the entry point (e.g., if you want to just unzip it somewhere and run it without installing).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you investigated how this is actually installed on a person's computer though? I think this might not do exactly what you want.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do some experiments to make sure.

package_dir={'': 'src'},
py_modules=['pydocstyle'],
entry_points={
'console_scripts': [
'pydocstyle = pydocstyle:main',
'pep257 = pydocstyle:main_pep257',
'pydocstyle = pydocstyle.cli:main',
'pep257 = pydocstyle.cli:main_pep257',
],
},
)
19 changes: 19 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file in the right place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in setup.py.

"""Static analysis tool for checking docstring conventions and style.

The repository is located at:
https://github.com/PyCQA/pydocstyle

"""


__all__ = ()


def main():
from pydocstyle import cli
cli.main()


if __name__ == '__main__':
main()
Loading