-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use pyo3-stub-gen to support IDE type hints #329
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# This file is automatically generated by pyo3_stub_gen | ||
# ruff: noqa: E501, F401 | ||
|
||
import typing | ||
from enum import Enum, auto | ||
|
||
class DurationError: | ||
def __new__(cls,* _args,* * _kwargs): ... | ||
... | ||
|
||
class Epoch: | ||
r""" | ||
Defines a nanosecond-precision Epoch. | ||
|
||
Refer to the appropriate functions for initializing this Epoch from different time scales or representations. | ||
""" | ||
... | ||
|
||
class HifitimeError: | ||
def __new__(cls,* _args,* * _kwargs): ... | ||
... | ||
|
||
class LatestLeapSeconds: | ||
r""" | ||
List of leap seconds from https://www.ietf.org/timezones/data/leap-seconds.list . | ||
This list corresponds the number of seconds in TAI to the UTC offset and to whether it was an announced leap second or not. | ||
The unannoucned leap seconds come from dat.c in the SOFA library. | ||
""" | ||
def __new__(cls,): ... | ||
def __repr__(self) -> str: | ||
... | ||
|
||
|
||
class LeapSecond: | ||
r""" | ||
A structure representing a leap second | ||
""" | ||
... | ||
|
||
class LeapSecondsFile: | ||
r""" | ||
A leap second provider that uses an IERS formatted leap seconds file. | ||
""" | ||
def __new__(cls,path:str): ... | ||
def __repr__(self) -> str: | ||
... | ||
|
||
|
||
class ParsingError: | ||
def __new__(cls,* _args,* * _kwargs): ... | ||
... | ||
|
||
class TimeSeries: | ||
r""" | ||
An iterator of a sequence of evenly spaced Epochs. | ||
""" | ||
... | ||
|
||
class Ut1Provider: | ||
r""" | ||
A structure storing all of the TAI-UT1 data | ||
""" | ||
def __new__(cls,): ... | ||
def __repr__(self) -> str: | ||
... | ||
|
||
|
||
class TimeScale(Enum): | ||
r""" | ||
Enum of the different time systems available | ||
""" | ||
TAI = auto() | ||
TT = auto() | ||
ET = auto() | ||
TDB = auto() | ||
UTC = auto() | ||
GPST = auto() | ||
GST = auto() | ||
BDT = auto() | ||
QZSST = auto() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use pyo3_stub_gen::Result; | ||
|
||
#[cfg(feature = "python")] | ||
fn main() -> Result<()> { | ||
let stub = hifitime::python::stub_info()?; | ||
stub.generate()?; | ||
Ok(()) | ||
} | ||
|
||
#[cfg(not(feature = "python"))] | ||
fn main() -> Result<()> { | ||
Ok(()) | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the stub generator could not find any of the functions in any of the classes, so as-is this new
pyi
file won't help IDE users in autocompleting.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. So maybe we can turn to another way to do this, like dora's?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that dora's approach uses the package introspection, but I could not seem to get it to work correctly when I tried a few weeks (months?) ago. It kept on complaining that one of the return types was not defined although I thought I had. Feel free to give it a try of course!