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

draft: re-export symbols (classes, constants) to accessible & ergonomic locations #101

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pantheraleo-7
Copy link

Addresses #100

This PR chooses one of the many ways described in the issue. This seems like the most intuitive way but if any of the other ways are selected (if at all!) then I'll change the PR accordingly.

If the PR gets accepted, I'll be willing to update examples, docs, etc.

Per this PR, the usage example would like this:

import board
import busio
from adafruit_ads1x15 import ADS1115, AnalogIn, ads1x15 as adsx # the alias is not necessary

i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS1115(i2c)
chan = AnalogIn(ads, adsx.PIN0)

I'd say this is more pythonic and readable. This change is completely backwards compatible, and if like to move ahead with only this approach, we could add a deprecation warning to the old ones.

@pantheraleo-7
Copy link
Author

Hmm.. seems like pylint doesn't recognise redundant aliases. Ruff, pyflake, etc. recommend redundant aliases for re-exports.

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.

1 participant