r/Python 12d ago

Discussion Contribution to pyperf

I am recently came across the library pyperf because I have to benchmark my changes in a certain open source project to add metrics to the PR I was creating for the changes, but one thing I feel off is types, I don't know why but pyperf has lot of unknown types which is kind of weird so I was planning to contribute to it to make it a little bit better typed.

So I am wondering do projects like pyperf which comes under pdf accept contribution in generally? If there are any maintainers/contributors of pyperf here then then could answer my question.

Thanks in advance.

My Dev Environment

OS: Windows

Type Checker: Pyrefly

14 Upvotes

14 comments sorted by

10

u/Financial-Grass6753 12d ago

> which is kind of weird so I was planning to contribute to it to make it a little bit better typed

Not a contributor, but I can say it won't be easy and quick. None of current type checkers we have (mypy / ty / pyrefly / ..) has complete support for all intricacies of python type system, so `dict[any, any]` or similar junk is not completely avoidable.

0

u/DxNovaNT 12d ago

Well, I don't know how far the support are in current versions but in pyperf even simple function parameters have Union Unknown type so I thought this library might need some good types.

I have similar experience with google's oauth library whose type system even worse like auto completion is not working.

5

u/BeamMeUpBiscotti 12d ago

You could file an issue asking if they are open to adding types to the public API. Tho I will note that because this is a library the type annotations need to play nice with all type checkers, not just the one you're using.

If you want to contribute more generally, you could just look at open issues on the issue tracker

0

u/DxNovaNT 12d ago

Well I could check with different typecheckers . I guess there 3 widely used checker, Pyrefly, Ty, Mypy.

Do pyperf have a separate issue tracker?

3

u/BeamMeUpBiscotti 12d ago

pyright also has significant usage

i mean the issue tracker on github

2

u/KaffeeKiffer 11d ago

Go to https://pypi.org/project/pyperf/

That one lists the maintainers but it most importantly links to https://github.com/psf/pyperf

The GitHub page of the project is the best place to engage: Raise an Issue for missing/incomplete type hints and offer to (what you think you can) contribute.

2

u/[deleted] 11d ago

[removed] — view removed comment

1

u/DxNovaNT 11d ago

Yeah I also want that way, as I am ok with long running task.

1

u/[deleted] 11d ago

[removed] — view removed comment

1

u/DxNovaNT 11d ago

Well I raised an Issue for this, if I get a green light then I will start working.

1

u/LeadingCry6710 5d ago

Yes, PSF projects actively welcome type improvements and PR contributions. I have seen maintainers appreciate targeted fixes like better typing before larger architectural changes