Skip to content
Snippets Groups Projects
Commit 94cc0c1c authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Merge branch 'use-black-for-codestyle' into 'master'

Use black for codestyle

See merge request !28
parents 139b7407 68207c8a
No related branches found
No related tags found
1 merge request!28Use black for codestyle
Pipeline #32197 passed with warnings
......@@ -68,7 +68,7 @@ code-style:
stage: test
script:
- *virtualenv_definition
- yapf -r -d -e "venv" .
- make black-check
allow_failure: true
coverage:
......
......@@ -33,9 +33,18 @@ dependencies:
dependencies-dev:
pip install -Ur requirements-dev.txt
yapf:
yapf -i -r $(PKGNAME)
yapf -i -r tests
yapf -i setup.py
.PHONY: all clean install install-dev venv test test-cov test-loop dependencies dependencies-dev yapf
.PHONY: black
black:
black --exclude '/_definitions/|version.py' $(PKGNAME)
black tests
black doc/conf.py
black setup.py
.PHONY: black-check
black-check:
black --exclude '/_definitions/|version.py' $(PKGNAME)
black --check tests
black --check doc/conf.py
black --check setup.py
.PHONY: all clean install install-dev venv test test-cov test-loop dependencies dependencies-dev
......@@ -21,11 +21,11 @@ from pkg_resources import get_distribution
# -- Project information -----------------------------------------------------
version = get_distribution('km3net_testdata').version
short_version = '.'.join(version.split('.')[:2])
project = 'km3net_testdata {}'.format(short_version)
copyright = '{0}, Tamas Gal'.format(date.today().year)
author = 'Tamas Gal'
version = get_distribution("km3net_testdata").version
short_version = ".".join(version.split(".")[:2])
project = "km3net_testdata {}".format(short_version)
copyright = "{0}, Tamas Gal".format(date.today().year)
author = "Tamas Gal"
# -- General configuration ---------------------------------------------------
......@@ -33,33 +33,35 @@ author = 'Tamas Gal'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.viewcode',
'autoapi.extension', 'numpydoc',
'sphinx_gallery.gen_gallery'
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"autoapi.extension",
"numpydoc",
"sphinx_gallery.gen_gallery",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# 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', 'version.py']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "version.py"]
# AutoAPI
autoapi_type = 'python'
autoapi_dirs = ['../km3net_testdata']
autoapi_ignore = ['*version.py*']
autoapi_type = "python"
autoapi_dirs = ["../km3net_testdata"]
autoapi_ignore = ["*version.py*"]
autoapi_add_toctree_entry = True
# Gallery
sphinx_gallery_conf = {
'backreferences_dir': 'modules/generated',
'default_thumb_file': '_static/default_gallery_thumbnail.png',
'examples_dirs': '../examples', # path to your example scripts
'gallery_dirs':
'auto_examples', # path to where to save gallery generated output
'show_memory': True,
"backreferences_dir": "modules/generated",
"default_thumb_file": "_static/default_gallery_thumbnail.png",
"examples_dirs": "../examples", # path to your example scripts
"gallery_dirs": "auto_examples", # path to where to save gallery generated output
"show_memory": True,
}
# -- Options for HTML output -------------------------------------------------
......@@ -67,11 +69,11 @@ sphinx_gallery_conf = {
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# 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"]
html_title = "km3net_testdata {}".format(version)
black==22.3.0
matplotlib
memory_profiler
numpydoc
......@@ -12,5 +13,4 @@ sphinx-autoapi
sphinx-gallery>=0.1.12
sphinx_rtd_theme
sphinxcontrib-versioning
yapf>=0.30.0
wheel
......@@ -21,23 +21,23 @@ except UnicodeDecodeError:
long_description = "KM3NeT TestData"
setup(
name='km3net_testdata',
url='https://git.km3net.de/km3py/km3net-testdata',
description='KM3NeT TestData',
name="km3net_testdata",
url="https://git.km3net.de/km3py/km3net-testdata",
description="KM3NeT TestData",
long_description=long_description,
author='Tamas Gal',
author_email='tgal@km3net.de',
packages=['km3net_testdata'],
author="Tamas Gal",
author_email="tgal@km3net.de",
packages=["km3net_testdata"],
include_package_data=True,
platforms='any',
setup_requires=['setuptools_scm'],
platforms="any",
setup_requires=["setuptools_scm"],
use_scm_version=True,
python_requires='>=2.7',
python_requires=">=2.7",
install_requires=read_stripped_lines("requirements.txt"),
extras_require={"dev": read_stripped_lines("requirements-dev.txt")},
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
],
)
......@@ -8,8 +8,7 @@ from km3net_testdata import data_path, latest, LATEST_VERSIONS
class TestDataPath(unittest.TestCase):
def test_access(self):
assert data_path("online/km3net_online.root").endswith(
"km3net_online.root")
assert data_path("online/km3net_online.root").endswith("km3net_online.root")
def test_accessing_nonexistent_files(self):
with self.assertRaises(RuntimeError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment