8000 Deprecate `py-mount` · Issue #1220 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

Deprecate py-mount #1220

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

Closed
JeffersGlass opened this issue Feb 24, 2023 · 1 comment · Fixed by #1330
Closed

Deprecate py-mount #1220

JeffersGlass opened this issue Feb 24, 2023 · 1 comment · Fixed by #1330
Labels
tag:deprecation Related to deprecating and removing features.

Comments

@JeffersGlass
Copy link
Contributor
JeffersGlass commented Feb 24, 2023

We don't really document or make use of the py-mount functionality in the codebase - it's a 'convenience' function that finds all the elements on the page with the py-mount attribute, and dynamically creates Python objects pointing at those elements, where the object name is the id of the HTML element:

/** Mount all elements with attribute py-mount into the Python namespace */
export async function mountElements(interpreter: Interpreter) {
const matches: NodeListOf<HTMLElement> = document.querySelectorAll('[py-mount]');
logger.info(`py-mount: found ${matches.length} elements`);
let source = '';
for (const el of matches) {
const mountName = el.getAttribute('py-mount') || el.id.split('-').join('_');
source += `\n${mountName} = Element("${el.id}")`;
}
await interpreter.run(source);
}

Let's deprecate and then remove this.

(This was something the team noticed during the Plugins discussion the morning of Friday Feb 24 at the offsite.)

@JeffersGlass JeffersGlass added the tag:deprecation Related to deprecating and removing features. label Feb 24, 2023
@antocuni
Copy link < 817D div aria-live="polite" aria-atomic="true" class="sr-only" data-clipboard-copy-feedback>
Contributor

+1 for deprecating it.
I think it should be easy: in the next release, we show a deprecation warning in case we notice a py-mount. In the next next release, we kill it.
PRs are welcome ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag:deprecation Related to deprecating and removing features.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0