Skip to content

Add a context manager for coordinate transformations #2347

@embray

Description

@embray

This isn't terribly high priority and probably only has a handful of usecases, but like in other cases where we have some kind of global state there should be a way to use a context manager to use an alternative to the global state--in this case astropy.coordinates.transformations.master_transform_graph.

This came up in the context of #1822, where a test adds a transformation alias, permanently modifying the global state. The test can be easily worked around for now, but this should be addressed at some point as a matter of principle.

One open question I have about this, is should a context manager provide a completely blank slate (which might not be very useful), or provide a copy of the existing master transformation graph (that can then be cleared or modified as needed)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions