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

Add PYTHONBREAKPOINT as exposed config variable #688

Merged
merged 5 commits into from
Jun 22, 2022

Conversation

Carlos-Muniz
Copy link

@Carlos-Muniz Carlos-Muniz commented Jun 8, 2022

Criteria

  • Exposes PYTHONBREAKPOINT as a Tutor configuration variable
  • Sets ENV PYTHONBREAKPOINT={{ PYTHONBREAKPOINT }} in the openedx dockerfile
  • Changes the docs to recommend using breakpoint(). Explains that PYTHONBREAKPOINT can be modified in order to use a custom debugger.

Testing

  1. Build openedx: tutor images build openedx
  2. Build openedx-dev: tutor dev dc build
  3. Run bash in lms: tutor dev run lms bash
  4. Within bash, check for PYTHONBREAKPOINT: env | grep PYTHONBREAKPOINT

And make test

Closes openedx-unsupported/wg-developer-experience#45

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

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

Can you please add an entry to the CHANGELOG.md file? https://docs.tutor.overhang.io/tutor.html#contributing Also, please squash your commits.

tutor/templates/config/defaults.yml Outdated Show resolved Hide resolved
tutor/templates/build/openedx/Dockerfile Outdated Show resolved Hide resolved
@Carlos-Muniz Carlos-Muniz changed the title Add PYTHONBREAKPOINT as exposed config variable with default of ipdb Add PYTHONBREAKPOINT as exposed config variable Jun 9, 2022
@Carlos-Muniz Carlos-Muniz marked this pull request as ready for review June 9, 2022 17:53
@Carlos-Muniz Carlos-Muniz requested a review from regisb June 9, 2022 17:53
@Carlos-Muniz Carlos-Muniz force-pushed the Carlos-Muniz/pythonbreakpoint branch 3 times, most recently from 5e64d26 to 3e0cc4d Compare June 9, 2022 18:27
CHANGELOG.md Outdated Show resolved Hide resolved
PYTHONBREAKPOINT has been exposed as a Tutor configuration variable in
the dockerfile available to be changed in config.yml. It has also
been added as an empty variable in default.yml as required by the
test suite. The docs have also been changed to recommend using
breakpoint and explaining how PYTHONBREAKPOINT can be modified to use a
custom debugger. An entry in CHANGELOG has been added about this change.
@Carlos-Muniz Carlos-Muniz force-pushed the Carlos-Muniz/pythonbreakpoint branch from 3e0cc4d to 5331ca5 Compare June 9, 2022 19:31
@kdmccormick
Copy link
Collaborator

@regisb I am a little confused by your feedback. The goal of openedx-unsupported/wg-developer-experience#45 was to default to ipdb.set_trace (as ipdb is already installed into the image) while allowing users to easily configure a different debugger. Why would we install ipdb if pdb is going to be the default? And why is a plugin better than a config setting here?

Now, I do realize that a Docker build ARG might not be the best way to do this, since it requires a rebuild -- perhaps setting PYTHONBREAKPOINT in the environment section of env/dev/docker-compose.yml would be better.

@regisb
Copy link
Contributor

regisb commented Jun 17, 2022

I understand your confusion @kdmccormick, as there was a one-letter typo in my previous comment...

Let me recap:

  1. We should have ipdb.set_trace() as the default breakpoint in the openedx development Docker image.
  2. There should not be a Tutor configuration setting to govern that value.
  3. There is no need to add a build-time Docker ARG.
  4. Users who want to override the default breakpoint should override the runtime PYTHONBREAKPOINT environment variable.

@kdmccormick
Copy link
Collaborator

@regisb

We should have ipdb.set_trace() as the default breakpoint in the openedx development Docker image.

👍🏻

There should not be a Tutor configuration setting to govern that value.

I'll respect your discretion here but it is not clear to me where the line is between "expose a config setting" and "just let users override it with a plugin". Do you have a general philosophy that @Carlos-Muniz and I can use in the future?

There is no need to add a build-time Docker ARG.

Okay, so I imagine the Dockerfile line would just be:

ENV PYTHONBREAKPOINT=ipdb.set_trace

(@Carlos-Muniz ^)

Users who want to override the default breakpoint should override the runtime PYTHONBREAKPOINT environment variable.

How would a user do this (other than manually setting PYTHONBREAKPOINT=... every time they enter an LMS/CMS bash shell)? Is there patch or hook I am missing for runtime environment variables?

tutor/templates/config/defaults.yml Outdated Show resolved Hide resolved
docs/dev.rst Outdated Show resolved Hide resolved
@regisb
Copy link
Contributor

regisb commented Jun 20, 2022

I'll respect your discretion here but it is not clear to me where the line is between "expose a config setting" and "just let users override it with a plugin". Do you have a general philosophy that @Carlos-Muniz and I can use in the future?

I've had this conversation multiple times in a few recent issues; here are a few pointers:

#675 (comment)
#677 (comment)

Basically, the policy is "do not introduce a new setting for a small percentage of users".

I realize that I need to better articulate this policy and make it clearer to contributors. This will be resolved in #683.

How would a user do this (other than manually setting PYTHONBREAKPOINT=... every time they enter an LMS/CMS bash shell)? Is there patch or hook I am missing for runtime environment variables?

Either the "openedx-dev-dockerfile-post-python-requirements" or "openedx-dockerfile-final" patch can be used to override this environment variable in a more sustainable way.

@Carlos-Muniz
Copy link
Author

@regisb I've addressed your comments and can squash if there are no further concerns.

Copy link
Contributor

@regisb regisb 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 this PR Carlos! and sorry about the back-and-forth comments...

@regisb regisb merged commit 4dac139 into overhangio:master Jun 22, 2022
@Carlos-Muniz Carlos-Muniz deleted the Carlos-Muniz/pythonbreakpoint branch June 22, 2022 13:10
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.

Expose PYTHONBREAKPOINT config variable with default of ipdb
3 participants