8000 Decorators break function signatures · Issue #77 · prometheus/client_python · GitHub
[go: up one dir, main page]

Skip to content

Decorators break function signatures #77

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

Closed
hynek opened this issue Apr 14, 2016 · 6 comments
Closed

Decorators break function signatures #77

hynek opened this issue Apr 14, 2016 · 6 comments

Comments

@hynek
Copy link
Contributor
hynek commented Apr 14, 2016

The client does a common anti-pattern of doing a closure with *args,**kwargs but that sadly breaks introspection of wrapped methods.

This is a concrete problem e.g. if you wrap Pyramid views that get different arguments depending on how many arguments are present (either context, request or just request).

You can find more information on this in these blog posts: https://github.com/GrahamDumpleton/wrapt/tree/master/blog

Solutions to it is to either use or copy/paste from the wrapt (better) or decorator (OK-ish) packages.

@brian-brazil
Copy link
Contributor

Would you like to send a pull request to fix this?

wrapt appears to have C dependencies, so that's not going to work out.

@hynek
Copy link
Contributor Author
hynek commented Apr 15, 2016

So you could live with depending on decorator? It’s python-only without further dependencies.

I still have the problem that I can’t run the tests locally on OS X because of the s.connect(('localhost', 0)) thing. If you’d fix that, I’ll happily fix your decorators. :)

@brian-brazil
Copy link
Contributor

So you could live with depending on decorator? It’s python-only without further dependencies.

I'd prefer to copy it in. While it's old enough that it should be everywhere, let's play it safe.

@hynek
Copy link
Contributor Author
hynek commented Apr 18, 2016

As you wish.

I still need you to fix the test suite tho. :)

@brian-brazil
Copy link
Contributor
brian-brazil commented Apr 18, 2016

If you've got an alternative way to get the machine's IP that also works on Windows and Linux then I'm happy to change it.

@hynek
Copy link
Contributor Author
hynek commented Apr 18, 2016

I‘m fine with if you just skip the test on OS X (and mostly likely all BSDs? at least FreeBSD breaks too).

I just need a way to run tests locally. Once that’s fixed, I can do the tox/Travis CI/codecov integration for you too if you wish. By not being able to run the test suite on all BSDs you’re limiting the set of contributors quite a bit.

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

No branches or pull requests

2 participants
0