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

feat: adds tutor config edit #1099

Merged

Conversation

tecoholic
Copy link
Contributor

@tecoholic tecoholic commented Jul 24, 2024

Quickly launch the default YAML editor for editing the config.yml file.

Background

As a developer working with multiple projects, I am constantly changing the tutor config and re-running the tutor dev launch to update the devstack. While it is as simple as running vim $(tutor config printroot)/config.yml, I often found myself wanting to simply express this better using tutor config edit. So this is an attempt at cross-platform solution doing the same. It might not be the best solution, but something to start with if someone else finds this useful and improves their DevEx.

Caveat: I have only tested this on Linux (both open and xdg-open works in mine, so it could be said Unix).

tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
@tecoholic
Copy link
Contributor Author

@regisb Hi, Thanks for the review comments. I hoped to have addressed them by now. Somehow haven't found the time. I will handle the comments this week.

@kdmccormick kdmccormick removed their request for review August 9, 2024 17:14
@kdmccormick
Copy link
Collaborator

I have nothing to add beyond Regis's review--just want to say that this is a great idea and thank you for the contribution 👍🏻

@tecoholic tecoholic force-pushed the tecoholic/add-config-edit-command branch from ecf0b53 to 853e51e Compare August 12, 2024 01:06
@tecoholic tecoholic requested a review from regisb August 12, 2024 01:11
@tecoholic tecoholic force-pushed the tecoholic/add-config-edit-command branch from 853e51e to c095e45 Compare September 2, 2024 12:45
@kdmccormick
Copy link
Collaborator

Hi @tecoholic . I'm looking forward to this change! Looks like there are just a couple minor change requests left, and then we're good to merge this.

@tecoholic
Copy link
Contributor Author

@kdmccormick Hi, thanks for the ping. I was waiting on @regisb for more details about read only editor. Can we skip that scenario for now?

@regisb
Copy link
Contributor

regisb commented Sep 24, 2024

@kdmccormick I am less interested in this feature than you seem to be -- mostly because (IMHO) it doesn't bring anything more than a .bashrc alias. E.g: alias tutor-config-edit='vim "$(tutor config printroot)/env.yml"'. So I'd rather defer to you for review.

@kdmccormick kdmccormick self-requested a review September 24, 2024 13:09
Copy link
Collaborator

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Thanks for the patience @tecoholic . If you can rebase and address these comments, I'll be happy to merge this.

tutor/commands/config.py Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
@tecoholic tecoholic force-pushed the tecoholic/add-config-edit-command branch from c095e45 to 2b00211 Compare November 10, 2024 05:12
@tecoholic
Copy link
Contributor Author

@kdmccormick Thank you for your comments and your patience with this PR. I have addressed your comments to my best. Kindly take another look when you can.

Copy link
Contributor

@DawoudSheraz DawoudSheraz left a comment

Choose a reason for hiding this comment

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

Please add a changelog entry for this change.

Copy link
Collaborator

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

I tested locally, works great on Ubuntu! I also commented out the which("open") block in order to confirm that xdg-open also works.

In addition to Dawoud's request to add a changelog entry, I have just one more change request and one optional suggestion ⬇️

tutor/commands/config.py Show resolved Hide resolved
tutor/commands/config.py Outdated Show resolved Hide resolved
@tecoholic tecoholic force-pushed the tecoholic/add-config-edit-command branch from 00565bb to d3cd4c0 Compare November 14, 2024 02:32
@tecoholic
Copy link
Contributor Author

tecoholic commented Nov 14, 2024

@kdmccormick Thank you for the feedback. I added a changelog entry, new options -s and -e (explanation here), made the messages a bit more verbose. Kindly take a look.

@tecoholic
Copy link
Contributor Author

@DawoudSheraz I have addressed your comments about the docs and updated the PR.

tutor/commands/config.py Outdated Show resolved Hide resolved
tutor/commands/config.py Show resolved Hide resolved
@tecoholic
Copy link
Contributor Author

@kdmccormick Updated the PR with simpler version.

P.S: I left a reply to the comment in the review. But, it doesn't show up here. So, adding a note here, just in case.

Copy link
Collaborator

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Just one issue, looks and works great otherwise. Thanks for proposing and working through this!

Copy link
Collaborator

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Sorry @tecoholic , one last thing: could you change the PR's base to release and rebase? In order to get improvements out to the biggest set of users, the Tutor convention is to merge to release if there is nothing breaking, risky, or specific to Open edX's master branches.

@tecoholic tecoholic changed the base branch from main to release December 6, 2024 08:14
Quickly launch the default an editor for editing the config.yml file.
@tecoholic tecoholic force-pushed the tecoholic/add-config-edit-command branch from 6295887 to af7d62b Compare December 6, 2024 08:21
@tecoholic
Copy link
Contributor Author

@kdmccormick Hi, thanks for letting me correct the branch. I couldn't move all the commits and the history with it. So, I just squashed everything and based it on the release branch. I have applied the fix you pointed out as well.

Copy link
Collaborator

@kdmccormick kdmccormick left a comment

Choose a reason for hiding this comment

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

Thank you @tecoholic !

@kdmccormick kdmccormick merged commit dd731c0 into overhangio:release Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants