Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ jobs:
extra-specs: |
python=${{ matrix.python_version }}

- name: Flake8
run: python -m flake8 voici setup.py
- name: Lint (Python)
run: |
python -m ruff check .
python -m black --check .

- name: Install voici
run: pip install .
Expand Down
45 changes: 23 additions & 22 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

# Add dev disclaimer.
_release = {}
exec(compile(open('../../voici/_version.py').read(), '../../voici/_version.py', 'exec'), _release)
if _release['version_info'][-1] == 'dev':
exec(
compile(open("../../voici/_version.py").read(), "../../voici/_version.py", "exec"),
_release,
)
if _release["version_info"][-1] == "dev":
rst_prolog = """
.. note::

Expand All @@ -12,40 +15,38 @@

"""

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

html_theme = "pydata_sphinx_theme"
html_theme_options = dict(
github_url='https://github.com/voila-dashboards/voici'
)
html_theme_options = dict(github_url="https://github.com/voila-dashboards/voici")


def setup(app):
app.add_css_file("main_stylesheet.css")


extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
]

html_static_path = ['_static']
source_suffix = '.rst'
master_doc = 'index'
project = 'voici'
copyright = u'2020, The Voilà Development Team'
author = u'The Voilà Development Team'
version = '.'.join(map(str, _release['version_info'][:2]))
release = _release['__version__']
html_static_path = ["_static"]
source_suffix = ".rst"
master_doc = "index"
project = "voici"
copyright = "2020, The Voilà Development Team"
author = "The Voilà Development Team"
version = ".".join(map(str, _release["version_info"][:2]))
release = _release["__version__"]
language = None

html_logo = 'voila-logo.svg'
html_logo = "voila-logo.svg"

exclude_patterns = []
highlight_language = 'python'
pygments_style = 'sphinx'
highlight_language = "python"
pygments_style = "sphinx"
todo_include_todos = False
htmlhelp_basename = 'voicidoc'
htmlhelp_basename = "voicidoc"

intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {"https://docs.python.org/": None}
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ channels:
- conda-forge
dependencies:
- pip
- black
- yarn=1
- flake8
- pip:
- ruff==0.0.258
- voila>=0.5.0a3,<0.6.0
- voila-material>=0.4.3
- jupyterlite-core[lab]>=0.1.0b20,<0.2.0
Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ file = "LICENSE"
[project.optional-dependencies]
dev = [
"black",
"ruff==0.0.258",
"hatch",
"jupyter_releaser",
]

[project.scripts]
Expand Down Expand Up @@ -119,3 +119,7 @@ version-cmd = "python scripts/bump-version.py"

[tool.check-wheel-contents]
ignore = ["W002"]

[tool.ruff]
target-version = "py38"
line-length = 100
6 changes: 3 additions & 3 deletions voici/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def setup_template_dirs(self):
self.jinja2_env.install_gettext_translations(nbui, newstyle=False)

def post_build(self, manager):
"""copies the Voici application files to the JupyterLite output and generate static dashboards."""
"""Copies the Voici application files to the JupyterLite output
and generate static dashboards."""

# Do nothing if Voici is disabled
if not self.manager.apps or (
Expand Down Expand Up @@ -113,8 +114,7 @@ def post_build(self, manager):

# Convert Notebooks content into static dashboards
tree_exporter = VoiciTreeExporter(
jinja2_env=self.jinja2_env,
voici_configuration=self.voici_configuration
jinja2_env=self.jinja2_env, voici_configuration=self.voici_configuration
)

for file_path, generate_file in tree_exporter.generate_contents(
Expand Down
8 changes: 4 additions & 4 deletions voici/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

voici_aliases = dict(
**lite_aliases,
show_tracebacks='VoilaConfiguration.show_tracebacks',
strip_sources='VoilaConfiguration.strip_sources',
template='VoilaConfiguration.template',
theme='VoilaConfiguration.theme',
show_tracebacks="VoilaConfiguration.show_tracebacks",
strip_sources="VoilaConfiguration.strip_sources",
template="VoilaConfiguration.template",
theme="VoilaConfiguration.theme",
)


Expand Down
17 changes: 12 additions & 5 deletions voici/tree_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def render_tree(page_config) -> StringIO:

return StringIO(
template.render(
frontend='voici',
frontend="voici",
contents=contents,
page_title=page_title,
breadcrumbs=breadcrumbs,
Expand Down Expand Up @@ -143,15 +143,21 @@ def render_notebook(page_config) -> StringIO:

return render_notebook

def generate_contents(self, path: Path, lite_files_output: Path, relative_to=None) -> Tuple[Dict, List[str]]:
"""Generate the Tree content. This is a generator method that generates tuples (filepath, filecreation_function)."""
def generate_contents(
self, path: Path, lite_files_output: Path, relative_to=None
) -> Tuple[Dict, List[str]]:
"""Generate the Tree content.
This is a generator method that generates tuples (filepath, filecreation_function).
"""
if relative_to is None:
relative_to = path
relative_path = Path(".")
breadcrumbs = []
else:
relative_path = path.relative_to(relative_to)
breadcrumbs = self.generate_breadcrumbs(relative_path, len(relative_path.parts))
breadcrumbs = self.generate_breadcrumbs(
relative_path, len(relative_path.parts)
)

template = self.jinja2_env.get_template("tree.html")

Expand All @@ -174,7 +180,8 @@ def generate_contents(self, path: Path, lite_files_output: Path, relative_to=Non
yield (
Path("render") / file["path"],
self.will_render_notebook(
lite_files_output / file["path"].replace(".html", ".ipynb"), relative_path
lite_files_output / file["path"].replace(".html", ".ipynb"),
relative_path,
),
)
elif file["type"] == "directory":
Expand Down