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

DM-39938: Allow schema file to be a general URI #179

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Conversation

timj
Copy link
Member

@timj timj commented Aug 29, 2023

This allows it to be read from anywhere supported by ResourcePath.

Requires lsst/alert_packet#35

self.alertSchema = alertPack.Schema.from_file(self.config.schemaFile)
uri = ResourcePath(self.config.schemaFile)
with uri.as_local() as schemaFile:
self.alertSchema = alertPack.Schema.from_file(schemaFile.ospath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to add a from_uri method to alert_packet.Schema? That would require making alert_packet dependent on lsst.resources but would hide some of this from users.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, if I did that then the lsst.alert.packet.schema could make use of ResourcePath directly and would be a bit simpler internally. I'm happy to switch over to that since it was the more natural thing for me to do, but I was worried you wouldn't like the new dependency (although it is on PyPI so shouldn't be a problem).

I will redo the PRs using ResourcePath to see what you think.

This allows it to be read from anywhere supported by ResourcePath.
@timj timj merged commit f66a16f into main Sep 11, 2023
2 checks passed
@timj timj deleted the tickets/DM-39938 branch September 11, 2023 20:40
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