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

Automatically create the directory path for a JSONTokenStorage #998

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

derek-globus
Copy link
Contributor

@derek-globus derek-globus commented Jul 9, 2024

What?

  • Automatically create the directory path for a JSONTokenStorage

Why?

  • The first usage of GlobusApp with default configuration raised an error on my machine (~/.globus/app dir didn't exist).

📚 Documentation preview 📚: https://globus-sdk-python--998.org.readthedocs.build/en/998/

@derek-globus derek-globus merged commit 26bb70a into globus:main Jul 9, 2024
16 checks passed
~~~~~

- When a JSONTokenStorage is used, the containing directory will be automatically be
created if it doesn't exist instead of erroring (on Mac).
Copy link
Member

Choose a reason for hiding this comment

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

Since it's not mac-specific, I don't think we should note the platform. Since I was suggesting an edit, I also went ahead and restored the pr link text from the template (:pr:`998` also works).

Suggested change
created if it doesn't exist instead of erroring (on Mac).
created if it doesn't exist instead of erroring. (:pr:`NUMBER`)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if it's mac exclusive or not. I only know it doesn't work on mac.

@@ -40,8 +41,15 @@ def __init__(self, filename: pathlib.Path | str, *, namespace: str = "DEFAULT"):
:param namespace: A user-supplied namespace for partitioning token data
"""
self.filename = str(filename)
self._ensure_containing_dir_exists()
Copy link
Member

Choose a reason for hiding this comment

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

If we're adding this, shouldn't we do it on the parent class, not here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's a fair question. Would you like to open that PR or me?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, I'll work that up!

(Also, no worries about merge/review order. I noticed it, and we'll sort out now. 😄 )

@sirosen
Copy link
Member

sirosen commented Jul 9, 2024

Given that this has already merged, I'm going to open a PR to post-fix the changelog entry and separately ask about moving the ensure_dir behavior up-tree.

@derek-globus
Copy link
Contributor Author

Yep, sorry didn't realize you were reviewing & expected this change to be small & uncontroversial enough to not wait around in case someone else was reviewing like I normally try to.

@derek-globus derek-globus deleted the auto-create-json-token-path branch July 15, 2024 13:32
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.

3 participants