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

Allow to load pages from package #2556

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

rnestler
Copy link
Contributor

@rnestler rnestler commented Jun 1, 2023

This allows to load the pages from an imported python package which is recursively scanned. This is useful if one compiles an application using Cython where the modules are then not .py files anymore, but compiled .so files.

In our application we compile everything with Cython in the end, to get some performance gains. Since the current implementation of the pages feature only searches for .py files in the pages folder I worked around it in our application using this approach.

Would this be a feature of general interest? IMO it is nice, since the implementation is way simpler and it uses built in tools to load the modules.

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • Agree that this is a useful feature
    • Agree on the naming of the new parameter
    • Add documentation for the new parameter
    • Add more tests
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

This allows to load the pages from an imported python package which is
recursively scanned. This is useful if one compiles an application using
Cython where the modules are then not .py files anymore, but compiled
.so files.
Apparently not all tests that add modules to the PAGE_REGISTRY also add
them to sys.modules.
@rnestler rnestler force-pushed the allow-to-load-pages-from-package branch from 282e606 to 3bb355b Compare June 2, 2023 07:55
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.

None yet

1 participant