Skip to content

Commit

Permalink
Check black in CI. (dask#258)
Browse files Browse the repository at this point in the history
* all files are checked except versioneer.py
* a few more files have been blackened
* fix for pre-commit to support python 3.7
  • Loading branch information
lesteve authored Apr 8, 2019
1 parent 9781a3d commit ecf0caf
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: stable
hooks:
- id: black
language_version: python3.6
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
Expand Down
9 changes: 8 additions & 1 deletion ci/none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ function jobqueue_before_install {
./ci/conda_setup.sh
export PATH="$HOME/miniconda/bin:$PATH"
conda install --yes -c conda-forge python=$TRAVIS_PYTHON_VERSION dask distributed flake8 pytest docrep
# black only available for python 3
if [[ "$TRAVIS_PYTHON_VERSION" =~ ^[3-9].+ ]]; then
pip install black
fi
}

function jobqueue_install {
Expand All @@ -14,9 +18,12 @@ function jobqueue_install {

function jobqueue_script {
flake8 -j auto dask_jobqueue
if [[ "$TRAVIS_PYTHON_VERSION" =~ ^[3-9].+ ]]; then
black --exclude versioneer.py --check .
fi
py.test --verbose
}

function jobqueue_after_script {
echo "Done."
echo "Done."
}
15 changes: 10 additions & 5 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,23 @@


def pytest_addoption(parser):
parser.addoption("-E", action="store", metavar="NAME",
help="only run tests matching the environment NAME.")
parser.addoption(
"-E",
action="store",
metavar="NAME",
help="only run tests matching the environment NAME.",
)


def pytest_configure(config):
# register an additional marker
config.addinivalue_line("markers",
"env(name): mark test to run only on named environment")
config.addinivalue_line(
"markers", "env(name): mark test to run only on named environment"
)


def pytest_runtest_setup(item):
envnames = [mark.args[0] for mark in item.iter_markers(name='env')]
envnames = [mark.args[0] for mark in item.iter_markers(name="env")]
if envnames:
if item.config.getoption("-E") not in envnames:
pytest.skip("test requires env in %r" % envnames)
89 changes: 47 additions & 42 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

# -- Project information -----------------------------------------------------

author = u'Dask-jobqueue Development Team'
project = u'Dask-jobqueue'
copyright = u'2018, Anaconda, Inc. and contributors'
author = u"Dask-jobqueue Development Team"
project = u"Dask-jobqueue"
copyright = u"2018, Anaconda, Inc. and contributors"


from dask_jobqueue import __version__ as version
Expand All @@ -40,34 +40,32 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx", "sphinx.ext.mathjax"]
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
"sphinx.ext.autodoc",
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"sphinx.ext.autosummary",
"sphinx.ext.extlinks",
"numpydoc",
]
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinx.ext.autosummary',
'sphinx.ext.extlinks',
'numpydoc']

autosummary_generate = True

numpydoc_class_members_toctree = True
numpydoc_show_class_members = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -79,18 +77,18 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
pygments_style = "default"


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'dask_sphinx_theme'
html_theme = "dask_sphinx_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -101,7 +99,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
Expand All @@ -117,7 +115,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'dask-jobqueudoc'
htmlhelp_basename = "dask-jobqueudoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -126,15 +124,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -144,19 +139,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'dask-jobqueue.tex', 'Dask-jobqueue Documentation',
[author], 'manual'),
(master_doc, "dask-jobqueue.tex", "Dask-jobqueue Documentation", [author], "manual")
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'dask-jobqueue', 'Dask-jobqueue Documentation',
[author], 1)
]
man_pages = [(master_doc, "dask-jobqueue", "Dask-jobqueue Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -165,9 +156,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'dask-jobqueue', 'Dask-jobqueue Documentation',
author, 'dask-jobqueue', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"dask-jobqueue",
"Dask-jobqueue Documentation",
author,
"dask-jobqueue",
"One line description of project.",
"Miscellaneous",
)
]


Expand All @@ -177,19 +174,27 @@

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'pandas': ('http://pandas.pydata.org/pandas-docs/stable/',
'http://pandas.pydata.org/pandas-docs/stable/objects.inv'),
'numpy': ('https://docs.scipy.org/doc/numpy/',
'https://docs.scipy.org/doc/numpy/objects.inv'),
'dask': ('https://docs.dask.org/en/latest',
'https://docs.dask.org/en/latest/objects.inv'),
'distributed': ('https://distributed.dask.org/en/stable/',
'https://distributed.dask.org/en/stable/objects.inv')
"pandas": (
"http://pandas.pydata.org/pandas-docs/stable/",
"http://pandas.pydata.org/pandas-docs/stable/objects.inv",
),
"numpy": (
"https://docs.scipy.org/doc/numpy/",
"https://docs.scipy.org/doc/numpy/objects.inv",
),
"dask": (
"https://docs.dask.org/en/latest",
"https://docs.dask.org/en/latest/objects.inv",
),
"distributed": (
"https://distributed.dask.org/en/stable/",
"https://distributed.dask.org/en/stable/objects.inv",
),
}

# Link to GitHub issues and pull requests using :pr:`1234` and :issue:`1234`
# syntax
extlinks = {
'issue': ('https://github.com/dask/dask-jobqueue/issues/%s', 'GH#'),
'pr': ('https://github.com/dask/dask-jobqueue/pull/%s', 'GH#')
"issue": ("https://github.com/dask/dask-jobqueue/issues/%s", "GH#"),
"pr": ("https://github.com/dask/dask-jobqueue/pull/%s", "GH#"),
}
38 changes: 20 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@
import versioneer
from setuptools import setup

with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")

if exists('README.rst'):
with open('README.rst') as f:
if exists("README.rst"):
with open("README.rst") as f:
long_description = f.read()
else:
long_description = ''
long_description = ""

setup(name='dask-jobqueue',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Easy deployment of Dask Distributed on job queuing systems '
'such as PBS, Slurm, or SGE.*',
url='https://github.com/dask/dask-jobqueue',
license='BSD 3-Clause',
packages=['dask_jobqueue'],
include_package_data=True,
install_requires=install_requires,
tests_require=['pytest >= 2.7.1'],
long_description=long_description,
zip_safe=False)
setup(
name="dask-jobqueue",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Easy deployment of Dask Distributed on job queuing systems "
"such as PBS, Slurm, or SGE.*",
url="https://github.com/dask/dask-jobqueue",
license="BSD 3-Clause",
packages=["dask_jobqueue"],
include_package_data=True,
install_requires=install_requires,
tests_require=["pytest >= 2.7.1"],
long_description=long_description,
zip_safe=False,
)

0 comments on commit ecf0caf

Please sign in to comment.