Skip to content

Make ServerProcess and LauncherEntry a HasTraits, update CLI flags for consistency #521

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

Merged
merged 3 commits into from
May 21, 2025

Conversation

jwindgassen
Copy link
Contributor

As I have mentioned in #507 and #501, I do not think there is a good reason to make ServerProcess and LauncherIcon a Configurable. I like the new approach of using traitlets for these two, but ServerProxy is already a Configurable, so I think we should be fine when downgrading them to a HasTraits.

I also allowed the entries of ServerProxy.servers to be an instance of ServerProcess, so users can now do ServerProxy.servers[name] = ServerProxy(command=[...], ...) instead of using a dictionary.

@manics manics requested review from yuvipanda and minrk February 27, 2025 00:04
@manics
Copy link
Member

manics commented Feb 27, 2025

@minrk @yuvipanda do either you have time to review this? I know enough about Traitlets to work with them using trial and error, but not enough about the finer details.

Copy link
Member

@minrk minrk left a comment

Choose a reason for hiding this comment

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

I think this makes sense, generally.

For generic classes like ServerProcess, it doesn't make sense for values that should be unique like name to be configurable, and I like the kwarg construction which relies only on HasTraits, not specific to Configurable.

For Configurable, only common defaults really make sense in config (e.g. timeout or environment), so if there are none of those, HasTraits makes sense. If there are any, Configurable should probably be kept and instead remove config=True from the fields that don't make sense to be shared.

e.g. this PR currently removes the possibility of setting

c.ServerProcess.timeout = 10

for a common default. I'm not sure that is useful or meaningful to remove, so I'm

  • +1 on using HasTraits for LauncherEntry
  • +1 on removing config=True on most ServerProcess fields that don't make sense as having common overrideable defaults
  • -0.5 on removing config from ServerProcess altogether, unless we determine that having user-set common defaults really doesn't make sense

@jwindgassen
Copy link
Contributor Author

Yes, the current commit would remove the possibility to set default values to all proxies. I considered that, but IMHO it is not terribly important. We originally moved to traitlets Configurable to aid with #501. #507 even states, that this was not really meant as a new feature, especially given the fact, that setting defaults like this is not documented atm. But I can see it being a potentially useful side effect, even if I think the applications are niche.

But I can move back to Configurable and remove .tag(config=True) from all fields where it doesn't make sense. This seems like a very reasonable middle ground to me.

@minrk
Copy link
Member

minrk commented Feb 27, 2025

If there are common config values that make sense, let's keep them and just untag the ones that don't. But if that's not likely (especially if it wasn't intended), I've no objection to going all the way to HasTraits and removing config=True.

There really is no difference between a Configurable and a HasTraits, except for how they handle traits tagged with config=True.

@jwindgassen jwindgassen force-pushed the sp-hastraits branch 3 times, most recently from 05df15b to 5a2a799 Compare May 19, 2025 12:26
@jwindgassen
Copy link
Contributor Author

@manics @minrk This should now fix the unnecessary configurable traits of ServerProcess, as well as unify the CLI for the standalone proxy (as menioned in #501).
For the ServerProcess, I only kept the traits configurable where I thought it might be useful (environment, timeout, new_browser_tab, rewrite_response and update_last_activity). Let me know if you need anything else :)

Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

Thanks!

@minrk minrk added the breaking label May 21, 2025
@minrk minrk merged commit c190772 into jupyterhub:main May 21, 2025
16 checks passed
@minrk minrk changed the title Make ServerProcess and LauncherEntry a HasTraits Make ServerProcess and LauncherEntry a HasTraits, update CLI flags for consistency May 21, 2025
@jwindgassen jwindgassen deleted the sp-hastraits branch May 21, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants