Skip to content

fix: Update public export declarations from __init__.py files#1580

Open
kylebarron wants to merge 2 commits intopyproj4:mainfrom
kylebarron:kyle/declare-crs-exports
Open

fix: Update public export declarations from __init__.py files#1580
kylebarron wants to merge 2 commits intopyproj4:mainfrom
kylebarron:kyle/declare-crs-exports

Conversation

@kylebarron
Copy link
Copy Markdown

When I try to import CoordinateOperation, pylance gives me an error, because it wasn't included in __all__

image
  • Closes #xxxx
  • Tests added
  • Fully documented, including history.rst for all changes and api/*.rst for new API

Comment on lines +33 to +41
"CoordinateOperation",
"CoordinateSystem",
"CustomConstructorCRS",
"Datum",
"DerivedGeographicCRS",
"Ellipsoid",
"GeocentricCRS",
"GeographicCRS",
"PrimeMeridian",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

All of these newly-added exports were already in the public docs for pyproj.crs

class.
"""

from pyproj._crs import ( # noqa: F401 pylint: disable=unused-import
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

We don't need the noqa when all imports are used in __all__

"get_ellps_map",
"get_prime_meridians_map",
"get_proj_operations_map",
"get_units_map",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This was deprecated as exported from the top-level and is suggested to import from pyproj.database https://pyproj4.github.io/pyproj/stable/api/database.html#pyproj.database.get_units_map

Comment on lines -62 to -72
from pyproj.list import ( # noqa: F401 pylint: disable=unused-import
get_ellps_map,
get_prime_meridians_map,
get_proj_operations_map,
)
from pyproj.proj import Proj, pj_list # noqa: F401 pylint: disable=unused-import
from pyproj.transformer import ( # noqa: F401 pylint: disable=unused-import
Transformer,
itransform,
transform,
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This diff is just removing the unnecessary noqa: F401 because all imports are used

@snowman2
Copy link
Copy Markdown
Member

snowman2 commented Mar 9, 2026

When I try to import CoordinateOperation, pylance gives me an error

What about from pyproj.crs.coordinate_operaton import CoordinateOperation?

@kylebarron
Copy link
Copy Markdown
Author

kylebarron commented Mar 11, 2026

No, that still errors

image

In any case, the documentation for CoordinateOperation says that it comes from pyproj.crs.CoordinateOperation

@kylebarron
Copy link
Copy Markdown
Author

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