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

Commit

Permalink
Improved documentation, adding more code examples and test case docst…
Browse files Browse the repository at this point in the history
…rings
  • Loading branch information
EdmundGoodman committed Nov 19, 2021
1 parent 1e72dc7 commit d24d210
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 16 deletions.
4 changes: 2 additions & 2 deletions jupylint/_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_keep_code_file_default(self):
self.assertFalse(path.isfile("./.jupylint_tmp_out.py"))

def test_keep_code_file_set(self):
"""Check that running with the keep flag doesn"t delete the file"""
"""Check that running with the keep flag doesn't delete the file"""
_ = get_jupylint_output(
"python3 ./jupylint_runner.py ./jupylint/test_files/stylish.ipynb ./.jupylint_tmp_out.py --keep".split(" ")
)
Expand All @@ -133,7 +133,7 @@ def test_pylintrc_inclusion(self):
self.assertTrue("Report\n======" in result)

def test_pylintrc_not_found(self):
"""Check that using a pylintrc file with """
"""Check that using a non-existent pylintrc file will fail"""
result = get_jupylint_output(
"python3 ./jupylint_runner.py ./jupylint/test_files/stylish.ipynb --rcfile ./jupylint/test_files/no_pylintrc".split(" ")
)
Expand Down
13 changes: 12 additions & 1 deletion jupylint/_test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,20 @@ def test_keep_code_file_default(self):
pass

def test_keep_code_file_set(self):
"""Check that running with the keep flag doesn"t delete the file"""
"""Check that running with the keep flag doesn't delete the file"""
pass

def test_no_pylintrc_inclusion(self):
"""Check that not specifying a pylintrc file won't use one"""
pass

def test_pylintrc_inclusion(self):
"""Check that using a pylintrc file will change the output style"""
pass

def test_pylintrc_not_found(self):
"""Check that using a non-existent pylintrc file will fail"""
pass

def get_jupylint_output(command):
"""Run a command to get its output, abstracting away error handling"""
Expand Down
4 changes: 2 additions & 2 deletions jupylint/jupylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
__copyright__ = "Copyright 2021"
__credits__ = ["Edmund Goodman"]
__license__ = "MIT"
__version__ = "2.2.1"
__version__ = "2.2.2"
__maintainer__ = "Edmund Goodman"
__email__ = "egoodman3141@gmail.com"
__status__ = "Production"
Expand Down Expand Up @@ -116,7 +116,7 @@ def run():


def main():
"""External run hook"""
"""External run hook for more convenient interfacing within python"""
Jupylint.run()


Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

setup(
name = 'jupylint',
version = '2.2.1',
version = '2.2.2',
license='MIT',
description = 'A tool to run pylint on Jupyter notebooks',
long_description=long_description,
long_description_content_type="text/markdown",
author = 'Edmund Goodman',
author_email = 'egoodman3141@gmail.com',
url = 'https://github.com/EdmundGoodman/Jupyter_Pylinter',
download_url = 'https://github.com/EdmundGoodman/Jupyter_Pylinter/archive/refs/tags/v2.2.1.tar.gz',
download_url = 'https://github.com/EdmundGoodman/Jupyter_Pylinter/archive/refs/tags/v2.2.2.tar.gz',
packages=find_packages(),
entry_points = {
"console_scripts": ['jupylint = jupylint.jupylint:main']
Expand Down
5 changes: 4 additions & 1 deletion source/autodoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Interface

.. automodule:: jupylint


Jupylint object
---------------

Expand All @@ -17,6 +16,8 @@ Jupylint object
:special-members:
:show-inheritance:

.. autofunction:: main


Unit tests
----------
Expand All @@ -28,3 +29,5 @@ Unit tests
:private-members:
:special-members:
:show-inheritance:

.. autofunction:: get_jupylint_output
2 changes: 1 addition & 1 deletion source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Edmund Goodman'

# The full version, including alpha/beta/rc tags
release = '2.2.1'
release = '2.2.2'


# -- General configuration ---------------------------------------------------
Expand Down
45 changes: 38 additions & 7 deletions source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,44 @@ Linting a file from the command line

.. code-block:: bash
jupylint ./in.ipynb
jupylint <in.ipynb>
Getting help from the command line
----------------------------------
Saving the raw python extracted from the notebook for linting
-------------------------------------------------------------

.. code-block:: bash
jupylint --help
jupylint -k <in.ipynb>
jupylint --keep <in.ipynb>
# The destination of the saved file can also be specified:
jupylint --keep <in.ipynb> <out.py>
Specifying a custom pylintrc file
---------------------------------

.. code-block:: bash
jupylint <in.ipynb> --rcfile <pylintrc>
Getting the version number
--------------------------

.. code-block:: bash
jupylint -v
jupylint --version
Getting help from the command line
----------------------------------

.. code-block:: bash
jupylint -h
jupylint --help
Expand All @@ -38,13 +60,22 @@ Linting a file from within python

.. code-block:: python
# All three dictionary keys below are required, but there is
# an additional optional one "rcfile", which specifies the
# location of a pylintrc file to use
# First, we need to import the module
from jupylint import Jupylint
# The most common use case within python is likely to be manually
# specifying the parameters to run the tool with.
# All three dictionary keys below are required, but there is an additional
# optional one "rcfile", which specifies the location of a pylintrc file
args = {
"in_file_name": ['./in.ipynb'],
"out_file_name": './jupylint_tmp_out.py',
"save_file": True
}
result = Jupylint.execute(args)
print(result)
# Additionally, if the settings are already present as keyword arguments,
# for example using `python - ./in.ipynb`, the tool can be run on those
# arguments using:
Jupylint.run()

0 comments on commit d24d210

Please sign in to comment.