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

Update blacklist and whitelist keywords #1367

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

trungleduc
Copy link
Member

@trungleduc trungleduc commented Aug 1, 2023

References

Closes #1366

Code changes

User-facing changes

  • Keywords with blacklist are replaced by denylist
  • Keywords with whitelist are replaced by allowlist
  • A DeprecationWarning message is raised on using the old keywords.

Backwards-incompatible changes

N/A

@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

Binder 👈 Launch a Binder on branch trungleduc/voila/wording

@trungleduc trungleduc added the enhancement New feature or request label Aug 1, 2023
@trungleduc trungleduc added maintenance and removed enhancement New feature or request labels Aug 1, 2023
@trungleduc trungleduc marked this pull request as ready for review August 1, 2023 16:23
@trungleduc trungleduc added this to the 0.5.0 milestone Aug 1, 2023
@@ -10,6 +10,9 @@
from ._version import __version__ # noqa
from .server_extension import _load_jupyter_server_extension # noqa
from .server_extension import load_jupyter_server_extension # noqa
import warnings

warnings.filterwarnings("default", category=DeprecationWarning, module="traitlets")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmh, Maybe we should not do that and fix the deprecation warnings instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, the DeprecationWarning is hidden by default https://docs.python.org/3/library/exceptions.html#DeprecationWarning

Comment on lines +68 to +82
file_whitelist = List(
Unicode(),
[r".*\.(png|jpg|gif|svg)"],
config=True,
help="""Deprecated, use `file_allowlist`""",
)

@validate("file_whitelist")
def _valid_file_whitelist(self, proposal):
warn(
"Deprecated, use VoilaConfiguration.file_allowlist instead.",
DeprecationWarning,
stacklevel=2,
)
return proposal["value"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest another approach for this?

@property
def file_whitelist(self):
   warn(
        "Deprecated, use VoilaConfiguration.file_allowlist instead.",
        DeprecationWarning,
        stacklevel=2,
    )
   return self.file_allowlist 


@file_whitelist.setter
def file_whitelist(self, value):
   warn(
        "Deprecated, use VoilaConfiguration.file_allowlist instead.",
        DeprecationWarning,
        stacklevel=2,
    )
   self.file_allowlist = value

That way we can get rid of the

warnings.filterwarnings("default", category=DeprecationWarning, module="traitlets")

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion applies if we consider going from a traitlet to a property is not backward incompatible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing so, users can not set the allow/deny list from the CLI or the voila.json file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point 👍🏽

Copy link
Member

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@martinRenou martinRenou merged commit 72a7e56 into voila-dashboards:main Aug 2, 2023
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update keywords for white/black list
2 participants