Skip to content
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

Update stubs.md #121

Closed
wants to merge 1 commit into from
Closed

Update stubs.md #121

wants to merge 1 commit into from

Conversation

ahmed-moubtahij
Copy link

It would be helpful for python3 -m deal stub /path/to/a/file.py to detect whether file.py already has deal annotations and generate itself based on them. This could be a neat way to separate deal contracts into their own file rather than intrude on the code, sort of like it's possible to do with type hints.

It would be helpful for `python3 -m deal stub /path/to/a/file.py` to detect whether `file.py` already has deal annotations and generate itself based on them. This could be a neat way to separate deal contracts into their own file rather than intrude on the code, sort of like it's possible to do with type hints.
@orsinium
Copy link
Member

Is it a feature request? PRs aren't for feature requests, sorry. The good news is that stubs, if I remember correctly, should include some contracts. Not all are supported. Also, stubs are for linter only, so it's not "separating" contracts, but downgrading them. To decouple contracts from code, use deal.chain.

@orsinium orsinium closed this Aug 24, 2022
@ahmed-moubtahij
Copy link
Author

ahmed-moubtahij commented Aug 25, 2022

stubs are for linter only, so it's not "separating" contracts, but downgrading them

This makes sense, I didn't get that before.

To decouple contracts from code, use deal.chain

foo_contract = deal.chain(deal.pre(...), deal.pre(...), deal.pre(...)...)
@foo_contract 
def foo():
    ...

doesn't look much like decoupling tbh. Would it be wise to group such chains in a contracts.py and import from it, or is that an anti-pattern? @orsinium
So something like

from contracts import foo_contract

@foo_contract
def foo():
    ...

@orsinium
Copy link
Member

Place it anywhere you want, why would I care? I'm sorry, I don't provide free support. See LICENSE. Some people have free time to build communities, I don't. Deal is a 100% free hobby project, and it will always be just a hobby for me. Actual contributions are welcome. Fake PRs containing only feature requests are not. Please, be mindful of other people's time and effort.

@life4 life4 locked as off-topic and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants