Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added reactive and viewable to init #3157

Merged
merged 1 commit into from
Feb 1, 2022
Merged

Added reactive and viewable to init #3157

merged 1 commit into from
Feb 1, 2022

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Jan 30, 2022

Fixes #3135

I wanted to add all missing files to __init__ but got ImportError: cannot import name 'panel_extension' from partially initialized module 'panel.config' (most likely due to a circular import) (/home/shh/Development/holoviz/panel/panel/config.py)or similar. So settled with adding the files for the two import I miss the most pn.viewable.Viewer and pn.reactive.ReactiveHTML.

I used this code to be able to find missing imports:

import re
from pathlib import Path

def find_missing_import(file):
    file = Path(file)
    matches = re.findall(r"\w+", file.read_text())

    missing = []
    for f in sorted(file.parent.glob("*.py")):
        f = f.name[:-3]
        if f[0] != "_" and f not in matches:
            missing.append(f)

    return missing


files = Path("panel").rglob("__init__.py")
for file in files:
    if "tests" in str(file):
        continue
    
    missing = find_missing_import(file)
    if missing: 
        print(file, "->", ", ".join(missing))

Which outputs:

panel/__init__.py -> auth, compiler, util
panel/template/fast/__init__.py -> base, theme
panel/layout/__init__.py -> gridstack
panel/pane/vtk/__init__.py -> enums, synchronizable_deserializer, synchronizable_serializer
panel/io/__init__.py -> admin, datamodel, jupyter_server_extension, location, notifications, reload, rest, save
panel/models/__init__.py -> ace, comm_manager, deckgl, echarts, enums, katex, mathjax, perspective, plotly, quill, speech_to_text, tabulator, terminal, text_to_speech, vega, vtk

@codecov
Copy link

codecov bot commented Jan 30, 2022

Codecov Report

Merging #3157 (c2196ea) into master (5bd9fc8) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3157      +/-   ##
==========================================
- Coverage   82.99%   82.97%   -0.03%     
==========================================
  Files         192      192              
  Lines       25482    25500      +18     
==========================================
+ Hits        21150    21159       +9     
- Misses       4332     4341       +9     
Impacted Files Coverage Δ
panel/__init__.py 100.00% <100.00%> (ø)
panel/tests/command/test_serve.py 82.50% <0.00%> (-2.50%) ⬇️
panel/pane/markup.py 96.17% <0.00%> (-1.05%) ⬇️
panel/widgets/input.py 96.29% <0.00%> (-0.46%) ⬇️
panel/widgets/tables.py 84.76% <0.00%> (-0.22%) ⬇️
panel/viewable.py 70.44% <0.00%> (ø)
panel/io/save.py 62.60% <0.00%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5bd9fc8...c2196ea. Read the comment docs.

@philippjfr philippjfr merged commit 55b0a33 into holoviz:master Feb 1, 2022
@hoxbro hoxbro deleted the init branch February 3, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add files to __init__ for autocomplete in VS Code
2 participants