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

Consider making the project name PEP-8 compliant and importable #10

Closed
stewartadam opened this issue Dec 8, 2016 · 3 comments
Closed

Comments

@stewartadam
Copy link
Contributor

launchpad.py is awesome! Unfortunately, publishing scripts that build on top of it is difficult since users would basically have to clone this repo, and copy the dependent scripts into the launchpad.py directory (unless I fork & bundle it).

Making the module importable isn't as simple as adding __init__.py though, as the name launchpad.py is not importable due to the dot in it.

I won't ask that you rename the project, but I did want to point this issue out :)

@FMMT666
Copy link
Owner

FMMT666 commented Dec 12, 2016

Wat?
I'm a hardware developer, please bear with me :-)
I can't follow here...

@stewartadam
Copy link
Contributor Author

stewartadam commented Dec 12, 2016

No worries -- PEP-8 defines code style and naming conventions for Python.

For context, I'm currently building some software that makes use of this project. In order for import launchpad to work from my code, launchpad.py from this project (and its dependencies, i.e. launchpad_charset.py) have to reside in the same folder... So currently, I have to direct users would have to download files manually from this repo as a part of the setup process.

Ideally, one would be able to clone this repo and use it as a Python module (this would require a file __init__.py be present). However, since the . character separates submodules in Python (e.g. import os.path imports the path submodule from os), one would not be able to issue import launchpad.py even if __init__.py was present - Python would get confused and looks for a module launchpad that has a submodule py.

My suggested solution would be would be to move launchpad.py into a Python module called launchpad (so import launchpad still works) and add a setup.py file so users can install this module to their Python site-packages folder, and use it from other software. See here for example of the file layout I'm talking about.

If this sounds good to you, I can submit a PR in a few days to get that done.

@FMMT666
Copy link
Owner

FMMT666 commented Dec 12, 2016

You can use imp.load_module() :-P

No, just kidding. Thanks, understood.

Sounds interesting.
I will think about that and what it means for the documentation,
the example files and general usage (and if it breaks any of my stuff, here :-)

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