How to handle '-' in the 'from' part in a "from import" statement?

Chris Angelico rosuav at gmail.com
Tue Oct 8 21:46:19 EDT 2019


On Wed, Oct 9, 2019 at 12:36 PM DL Neil via Python-list
<python-list at python.org> wrote:
>
> On 9/10/19 2:12 PM, jfong at ms4.hinet.net wrote:
> > dieter於 2019年10月8日星期二 UTC+8下午1時33分20秒寫道:
> >> jfong at ms4.hinet.net writes:
> >>> ...
> >>> But most of the download from Github has a directory named 'xxxx-master' which causes a trouble sometimes.
> >>
> >> Those are likely not meant to be imported directly.
> >>
> >> Typically, you have a "setup" step which installs (in some way)
> >> a "distribution". This step usually ensures that you can use
> >> "normal" Python import syntax to access all associated packages.
> >>
> >> The "setup" step is typically performed with
> >> "python setup.py develop" or "python setup.py install" --
> >> with the "distribution" providing the "setup.py".
> >
> > Yes, I understand the normal procedure on using a package, but it's not always the case.
>
> I'm curious - if this is the correct way to do things, and the original
> author intends the package/module for you to download, why does (s)he
> choose to follow an non-Pythonic naming convention?
>
> Does this say something about the author?
> - something about his/her abilities in Python?
> - the Python-friendliness (or otherwise) of GitHub? (cf PyPi)
>

It looks like the OP asked GitHub for a zip download instead of doing
what would be far more generally common: cloning the repository.

(Or just using pip to install directly from GitHub, although not
everyone knows that that's possible.)

ChrisA



More information about the Python-list mailing list