Skip to content

Conversation

@Remco646
Copy link

@Remco646 Remco646 commented Dec 29, 2025

This PR adds initial type stubs for the ephem library (PyPI: pyephem).

ephem is a widely used library for high-precision astronomy calculations. Since it is largely implemented in C, static analysis tools currently have difficulty providing completions and type safety for it.

The stubs provide comprehensive coverage for the publicly accessible API, including:

  • The main ephem namespace (__init__)
  • The underlying _libastro C-extension interface
  • The cities and stars databases

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks, just a few smaller remarks below.

Comment on lines +1 to +6
ephem.tests.*
ephem.stars.k
ephem.stars.v
ephem._libastro.Observer.__init__
ephem.FixedBody.__init__
ephem._libastro.FixedBody.__init__
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add comments to group and explain these entries? Probably something like this:

# Tests
ephem.tests.*

# Leaked loop variables
ephem.stars.k
ephem.stars.v

# ?
ephem._libastro.Observer.__init__
ephem.FixedBody.__init__
ephem._libastro.FixedBody.__init__


from . import _libastro

__version__: str
Copy link
Collaborator

Choose a reason for hiding this comment

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

Constants should be marked as Final:

Suggested change
__version__: str
__version__: Final[str]

(Also applies to all the constants below.)

Comment on lines +14 to +15
STAR_NUMBER_NAME: dict[int, str]
STAR_NAME_NUMBER: dict[str, int]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should probably be Final, too.

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