Skip to content

Commit

Permalink
Merge pull request #284 from hameerabbasi/change-to-black
Browse files Browse the repository at this point in the history
Change code formatter to black.
  • Loading branch information
hameerabbasi authored Sep 2, 2019
2 parents b342bb4 + 8b5a049 commit 2eda2dc
Show file tree
Hide file tree
Showing 29 changed files with 2,041 additions and 1,617 deletions.
5 changes: 4 additions & 1 deletion ci/environment-3.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ channels:
- conda-forge
dependencies:
- python=3.6
- pip
- pytest
- numpy
- scipy
- pytest-cov
- nomkl
- numba
- pytest-flake8
- black
- codecov
- pip:
- pytest-black
5 changes: 4 additions & 1 deletion ci/environment-3.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ channels:
- conda-forge
dependencies:
- python=3.7
- pip
- pytest
- numpy
- scipy
- pytest-cov
- nomkl
- numba
- pytest-flake8
- black
- codecov
- pip:
- pytest-black
80 changes: 40 additions & 40 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import sys

sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))
from sparse import __version__ # flake8: noqa E402

# -- General configuration ------------------------------------------------
Expand All @@ -34,36 +34,38 @@
# ones.

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.inheritance_diagram',
'sphinx.ext.extlinks',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.extlinks",
]

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

mathjax_path = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
mathjax_path = (
"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
)

# 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"

# General information about the project.
project = 'sparse'
copyright = '2018, Sparse developers'
author = 'Sparse Developers'
project = "sparse"
copyright = "2018, Sparse developers"
author = "Sparse Developers"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -84,11 +86,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', '**tests**', '**setup**', '**extern**',
'**data**']
exclude_patterns = ["_build", "**tests**", "**setup**", "**extern**", "**data**"]

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

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand Down Expand Up @@ -130,23 +131,20 @@
# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'sparsedoc'
htmlhelp_basename = "sparsedoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# 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 @@ -156,39 +154,41 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'sparse.tex', 'sparse Documentation',
'Sparse Developers', 'manual'),
(master_doc, "sparse.tex", "sparse Documentation", "Sparse Developers", "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, 'sparse', 'sparse Documentation',
[author], 1)
]
man_pages = [(master_doc, "sparse", "sparse Documentation", [author], 1)]

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'sparse', 'sparse Documentation',
author, 'sparse', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"sparse",
"sparse Documentation",
author,
"sparse",
"One line description of project.",
"Miscellaneous",
)
]

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None)
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
}

extlinks = {
'issue': ('https://github.com/pydata/sparse/issues/%s', 'Issue #'),
'pr': ('https://github.com/pydata/sparse/pull/%s', 'PR #'),
'ghuser': ('https://github.com/%s', '@')
"issue": ("https://github.com/pydata/sparse/issues/%s", "Issue #"),
"pr": ("https://github.com/pydata/sparse/pull/%s", "PR #"),
"ghuser": ("https://github.com/%s", "@"),
}
3 changes: 1 addition & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[pytest]
addopts = --flake8 --cov-report term-missing --cov-report html --cov-report=xml --cov-report=term --cov sparse --cov-config .coveragerc --junitxml=junit/test-results.xml
addopts = --black --cov-report term-missing --cov-report html --cov-report=xml --cov-report=term --cov sparse --cov-config .coveragerc --junitxml=junit/test-results.xml
filterwarnings =
ignore::PendingDeprecationWarning
testpaths =
tests
sparse
2 changes: 1 addition & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest>=3.5
pytest-flake8
pytest-black
pytest-cov
68 changes: 35 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,72 @@
import versioneer
from pathlib import Path

def open_reqs_file(file, reqs_path=Path('.')):

def open_reqs_file(file, reqs_path=Path(".")):
with (reqs_path / file).open() as f:
reqs = list(f.read().strip().split('\n'))
reqs = list(f.read().strip().split("\n"))

i = 0
while i < len(reqs):
if reqs[i].startswith('-r'):
reqs[i:i+1] = open_reqs_file(reqs[i][2:].strip(), reqs_path=reqs_path)
if reqs[i].startswith("-r"):
reqs[i : i + 1] = open_reqs_file(reqs[i][2:].strip(), reqs_path=reqs_path)
else:
i += 1

return reqs


extras_require = {}
reqs = []


def parse_requires():
reqs_path = Path('./requirements')
reqs.extend(open_reqs_file('requirements.txt'))
reqs_path = Path("./requirements")
reqs.extend(open_reqs_file("requirements.txt"))
for f in reqs_path.iterdir():
extras_require[f.stem] = open_reqs_file(f.parts[-1], reqs_path=reqs_path)


parse_requires()

with open('README.rst') as f:
with open("README.rst") as f:
long_desc = f.read()

print(repr(reqs))
print(repr(reqs))

setup(
name='sparse',
name="sparse",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Sparse n-dimensional arrays',
url='https://github.com/pydata/sparse/',
maintainer='Hameer Abbasi',
maintainer_email='hameerabbasi@yahoo.com',
license='BSD 3-Clause License (Revised)',
keywords='sparse,numpy,scipy,dask',
packages=find_packages(
include=['sparse', 'sparse.*'],
),
description="Sparse n-dimensional arrays",
url="https://github.com/pydata/sparse/",
maintainer="Hameer Abbasi",
maintainer_email="hameerabbasi@yahoo.com",
license="BSD 3-Clause License (Revised)",
keywords="sparse,numpy,scipy,dask",
packages=find_packages(include=["sparse", "sparse.*"]),
long_description=long_desc,
install_requires=reqs,
extras_require=extras_require,
zip_safe=False,
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Operating System :: OS Independent',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
"Development Status :: 2 - Pre-Alpha",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
],
project_urls={
'Documentation': 'https://sparse.pydata.org/',
'Source': 'https://github.com/pydata/sparse/',
'Tracker': 'https://github.com/pydata/sparse/issues',
"Documentation": "https://sparse.pydata.org/",
"Source": "https://github.com/pydata/sparse/",
"Tracker": "https://github.com/pydata/sparse/issues",
},
python_requires='>=3.5, <4',
python_requires=">=3.5, <4",
)
3 changes: 2 additions & 1 deletion sparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
from ._io import save_npz, load_npz

from ._version import get_versions
__version__ = get_versions()['version']

__version__ = get_versions()["version"]
del get_versions
Loading

0 comments on commit 2eda2dc

Please sign in to comment.