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

[New] saveframe utility #356

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

saharan-deshaw
Copy link
Collaborator

This commit adds a new utility named 'saveframe' in pyflyby.

This utility can be used to save information for debugging / reproducing an issue.

Usage:
If you have a piece of code that is currently failing due to an issue originating from another team's code, and you cannot share your private code as a reproducer, use this utility to save relevant information to a file. Share the generated file with the other team, enabling them to reproduce and diagnose the issue independently.

This utility is provided with 2 interfaces: a script and a function.

Script location: pyflyby/bin/saveframe
Function location: pyflyby.saveframe (from pyflyby import saveframe)

For more information on the savefrane script, checkout the help message using pyflyby/bin/saveframe --help

For more information on the saveframe function, checkout the doc of pyflyby.saveframe.

This commit adds a new utility named 'saveframe' in pyflyby.

This utility can be used to save information for debugging / reproducing
an issue.

Usage:
If you have a piece of code that is currently failing due to an issue originating
from another team's code, and you cannot share your private code as a reproducer,
use this utility to save relevant information to a file. Share the generated file
with the other team, enabling them to reproduce and diagnose the issue
independently.

This utility is provided with 2 interfaces: a script and a function.

Script location: `pyflyby/bin/saveframe`
Function location: `pyflyby.saveframe` (`from pyflyby import saveframe`)

For more information on the `savefrane` script, checkout the help message
using `pyflyby/bin/saveframe --help`

For more information on the `saveframe` function, checkout the doc of
`pyflyby.saveframe`.
@saharan-deshaw
Copy link
Collaborator Author

saharan-deshaw commented Sep 10, 2024

cc @sac111gp

FYI this PR is for #355

lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Show resolved Hide resolved


@contextmanager
def _open_file(filename, mode):

Choose a reason for hiding this comment

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

Can we accept file permission as a argument similar to mode, instead of having a global constant?

Such that if users want to modify the permissions through script it will be easier to facilitate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I'll post this idea on the original request!
I think we can take this up in v2 given that for now the owner of the file can change the permissions explicitly if they want, so it's not necessary.

lib/python/pyflyby/_saveframe.py Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
lib/python/pyflyby/_saveframe.py Outdated Show resolved Hide resolved
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.

2 participants