Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ac68acb
Add Flake8 configuration
PGijsbers Jun 25, 2020
e7ef1f5
Add mypy configuration file
PGijsbers Jun 25, 2020
956c9e0
Pre-commit mypy flake8, add flake8 excludes
PGijsbers Jun 26, 2020
d8e4a28
Add Black to pre-commit
PGijsbers Jun 26, 2020
20fa286
Set max line length to 100
PGijsbers Jun 26, 2020
e48b9ed
Blacken code
PGijsbers Jun 26, 2020
e037d90
Add unit tests to flake8 and mypy pre-commit
PGijsbers Jun 26, 2020
04b6b3f
Use pre-commit for flake8, mypy and black checks
PGijsbers Jun 26, 2020
d46c72a
Update docs, add 'test' dependencies
PGijsbers Jun 26, 2020
6708821
Uninstall pytest-cov on appveyor ci
PGijsbers Jun 26, 2020
4c332a7
Add -y to uninstall
PGijsbers Jun 26, 2020
5a31f8e
Sphinx issue fix (#923)
Neeratyoy Jul 1, 2020
861600b
More robust handling of openml_url (#921)
joaquinvanschoren Jul 1, 2020
f49c3eb
format for black artifacts
PGijsbers Jul 2, 2020
7d8a6a3
Add Flake8 configuration
PGijsbers Jun 25, 2020
74cce61
Add mypy configuration file
PGijsbers Jun 25, 2020
ffffab4
Pre-commit mypy flake8, add flake8 excludes
PGijsbers Jun 26, 2020
f4aa438
Add Black to pre-commit
PGijsbers Jun 26, 2020
64002cd
Set max line length to 100
PGijsbers Jun 26, 2020
8a3c6ae
Blacken code
PGijsbers Jun 26, 2020
d4c6150
Add unit tests to flake8 and mypy pre-commit
PGijsbers Jun 26, 2020
3596c87
Use pre-commit for flake8, mypy and black checks
PGijsbers Jun 26, 2020
d77606e
Update docs, add 'test' dependencies
PGijsbers Jun 26, 2020
d9d25af
Uninstall pytest-cov on appveyor ci
PGijsbers Jun 26, 2020
477238c
Add -y to uninstall
PGijsbers Jun 26, 2020
6bfbb69
format for black artifacts
PGijsbers Jul 2, 2020
887810e
Resolve merge conflicts
PGijsbers Jul 2, 2020
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
Prev Previous commit
Next Next commit
Blacken code
There are a few places where big indentation is introduced that may
warrant refactoring so it looks better.
I did not refactor anything yet, but did exlude three (?) lists (of ids)
to not be formatted.
  • Loading branch information
PGijsbers committed Jul 2, 2020
commit 8a3c6ae7ce220f08894f527f834669c44861501c
126 changes: 58 additions & 68 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.')# )

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", ".."))

# -- General configuration ------------------------------------------------

Expand All @@ -35,38 +35,38 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.autosectionlabel',
'sphinx_gallery.gen_gallery',
'numpydoc'
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.autosectionlabel",
"sphinx_gallery.gen_gallery",
"numpydoc",
]

autosummary_generate = True
numpydoc_show_class_members = False

autodoc_default_flags = ['members', 'inherited-members']
autodoc_default_flags = ["members", "inherited-members"]

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

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

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

# General information about the project.
project = u'OpenML'
copyright = (
u'2014-{}, the OpenML-Python team.'.format(time.strftime("%Y,%m,%d,%H,%M,%S").split(',')[0])
project = u"OpenML"
copyright = u"2014-{}, the OpenML-Python team.".format(
time.strftime("%Y,%m,%d,%H,%M,%S").split(",")[0]
)

# The version info for the project you're documenting, acts as replacement for
Expand All @@ -90,7 +90,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', '_templates', '_static']
exclude_patterns = ["_build", "_templates", "_static"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand All @@ -108,7 +108,7 @@
# show_authors = False

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

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
Expand All @@ -121,69 +121,57 @@

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

html_theme_options = {
# Navigation bar title. (Default: ``project`` value)
'navbar_title': "OpenML",

"navbar_title": "OpenML",
# Tab name for entire site. (Default: "Site")
# 'navbar_site_name': "Site",

# A list of tuples containting pages to link to. The value should
# be in the form [(name, page), ..]
'navbar_links': [
('Start', 'index'),
('User Guide', 'usage'),
('API', 'api'),
('Examples', 'examples/index'),
('Contributing', 'contributing'),
('Changelog', 'progress'),
"navbar_links": [
("Start", "index"),
("User Guide", "usage"),
("API", "api"),
("Examples", "examples/index"),
("Contributing", "contributing"),
("Changelog", "progress"),
],

# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': False,

"navbar_sidebarrel": False,
# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': False,

"navbar_pagenav": False,
# Tab name for the current pages TOC. (Default: "Page")
'navbar_pagenav_name': "On this page",

"navbar_pagenav_name": "On this page",
# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 1,

"globaltoc_depth": 1,
# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
# non-hidden ``toctree`` directives in the same page, or else the build
# will break.
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "false",

"globaltoc_includehidden": "false",
# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
'navbar_class': "navbar",

"navbar_class": "navbar",
# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
'navbar_fixed_top': "true",

"navbar_fixed_top": "true",
# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
'source_link_position': "None",

"source_link_position": "None",
# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing with "" (default) or the name of a valid theme
# such as "amelia" or "cosmo".
'bootswatch_theme': "flatly",

"bootswatch_theme": "flatly",
# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",
"bootstrap_version": "3",
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down Expand Up @@ -224,7 +212,7 @@
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {'**': ['localtoc.html']}
html_sidebars = {"**": ["localtoc.html"]}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand Down Expand Up @@ -257,27 +245,26 @@
# html_file_suffix = None

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


# -- 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': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [('index', 'OpenML.tex', u'OpenML Documentation',
u'Matthias Feurer', 'manual'), ]
latex_documents = [
("index", "OpenML.tex", u"OpenML Documentation", u"Matthias Feurer", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
Expand All @@ -304,10 +291,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'openml', u'OpenML Documentation',
[u'Matthias Feurer'], 1)
]
man_pages = [("index", "openml", u"OpenML Documentation", [u"Matthias Feurer"], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
Expand All @@ -319,9 +303,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'OpenML', u'OpenML Documentation',
u'Matthias Feurer', 'OpenML', 'One line description of project.',
'Miscellaneous'),
(
"index",
"OpenML",
u"OpenML Documentation",
u"Matthias Feurer",
"OpenML",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand All @@ -343,13 +333,13 @@
# Sphinx-gallery configuration.
sphinx_gallery_conf = {
# disable mini galleries clustered by the used functions
'backreferences_dir': None,
"backreferences_dir": None,
# path to the examples
'examples_dirs': '../examples',
"examples_dirs": "../examples",
# path where to save gallery generated examples
'gallery_dirs': 'examples',
"gallery_dirs": "examples",
# compile execute examples in the examples dir
'filename_pattern': '.*example.py$|.*tutorial.py$',
"filename_pattern": ".*example.py$|.*tutorial.py$",
# TODO: fix back/forward references for the examples.
}

Expand Down
13 changes: 8 additions & 5 deletions examples/20_basic/simple_datasets_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
# License: BSD 3-Clause

import openml

############################################################################
# List datasets
# =============

datasets_df = openml.datasets.list_datasets(output_format='dataframe')
datasets_df = openml.datasets.list_datasets(output_format="dataframe")
print(datasets_df.head(n=10))

############################################################################
Expand All @@ -29,8 +30,10 @@
dataset = openml.datasets.get_dataset(61)

# Print a summary
print(f"This is dataset '{dataset.name}', the target feature is "
f"'{dataset.default_target_attribute}'")
print(
f"This is dataset '{dataset.name}', the target feature is "
f"'{dataset.default_target_attribute}'"
)
print(f"URL: {dataset.url}")
print(dataset.description[:500])

Expand All @@ -45,8 +48,7 @@
# attribute_names - the names of the features for the examples (X) and
# target feature (y)
X, y, categorical_indicator, attribute_names = dataset.get_data(
dataset_format='dataframe',
target=dataset.default_target_attribute
dataset_format="dataframe", target=dataset.default_target_attribute
)
############################################################################
# Visualize the dataset
Expand All @@ -55,6 +57,7 @@
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

sns.set_style("darkgrid")


Expand Down
3 changes: 1 addition & 2 deletions examples/20_basic/simple_flows_and_runs_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
# NOTE: We are using dataset 20 from the test server: https://test.openml.org/d/20
dataset = openml.datasets.get_dataset(20)
X, y, categorical_indicator, attribute_names = dataset.get_data(
dataset_format='array',
target=dataset.default_target_attribute
dataset_format="array", target=dataset.default_target_attribute
)
clf = neighbors.KNeighborsClassifier(n_neighbors=3)
clf.fit(X, y)
Expand Down
6 changes: 4 additions & 2 deletions examples/30_extended/configure_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
# License: BSD 3-Clause

import openml
openml.datasets.get_dataset('iris')

openml.datasets.get_dataset("iris")

# With default configuration, the above example will show no output to console.
# However, in your cache directory you should find a file named 'openml_python.log',
Expand All @@ -37,9 +38,10 @@
# The processed log levels can be configured programmatically:

import logging

openml.config.console_log.setLevel(logging.DEBUG)
openml.config.file_log.setLevel(logging.WARNING)
openml.datasets.get_dataset('iris')
openml.datasets.get_dataset("iris")

# Now the log level that was previously written to file should also be shown in the console.
# The message is now no longer written to file as the `file_log` was set to level `WARNING`.
Expand Down
Loading