GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix `src` module name (`src` -> `pythonturtle`) · Issue #106 · PythonTurtle/PythonTurtle

Fix src module name (src -> pythonturtle) #106

New issue
Copy link
New issue
Copy link
Closed
Closed
Fix src module name (src -> pythonturtle)#106
Copy link

Description

@bittner
bittner
opened on Sep 17, 2018
Issue body actions

As explained in PR #105, the module name of this software is regarded to be src from Python's point of view.

It probably makes sense to make it be pythonturtle or similar. We shall introduce a standard layout for stand-alone applications (e.g. a __main__ module in the module root, or so -- see related StackOverflow answer).

This might also play into packaging a Windows installer (not sure what the current build process for Windows depends on). There was an interesting talk on the current state of building self-contained installers with Python at this year's Python Italy (FYI, related question on SlackOverflow).

Activity

  1. cool-RR commented on Sep 18, 2018

    @cool-RR
    cool-RR
    on Sep 18, 2018
    Member
    More actions

    I looked into the homedirectory module. I haven't looked at that code in around a decade so I had no memory of it. It's terrible. There's no reason to do that. There should just be a package python_turtle and then relative imports inside of it. Let me know if you need any guidance.

  2. bittner commented on Sep 18, 2018

    @bittner
    bittner
    on Sep 18, 2018
    MemberAuthor
    More actions

    Let me know if you need any guidance.

    If you want to tackle that ... that would be cool. 👍

  3. cool-RR commented on Sep 19, 2018

    @cool-RR
    cool-RR
    on Sep 19, 2018
    Member
    More actions

    I experimented a little with __main__ now. It's a good idea, but there are a couple of things I don't like:

    1. You can't use imports in a sane way from within it. I tried both relative imports and importing the package by name, and neither work. I'm not sure what's the rationale behind this. I looked for a PEP and couldn't find one.

    2. There isn't a Python file you could just put a shebang on and run directly instead of invoking python pythonturtle.

    So my preference is this: Change the src directory to be python_turtle, and add a file run_python_turtle.py that imports python_turtle and runs a function start() in it that starts the GUI.

  4. cool-RR commented on Sep 19, 2018

    @cool-RR
    cool-RR
    on Sep 19, 2018
    Member
    More actions

    Okay, so I just loaded PythonTurtle into my IDE after almost a decade of not running it... And now I realize how much work it's going to take to get it running normally. I never tried running it under Python 3. I don't want to spend time on it. I can help you with words but I don't want to be coding.

    If you'd like to do a __main__.py file despite of my opinion, you can go ahead and do that.

  5. bittner commented on Sep 19, 2018

    @bittner
    bittner
    on Sep 19, 2018
    MemberAuthor
    More actions

    Totally fine. 😄

    At least you can truly appreciate my efforts! 😆

    And yes, __main__ is awesome! You can run python -m python_turtle with it. You can run it as a ZIP file with python python_turtle.zip. You can run it as python python_turtle/. And it's a natural starting point to jump in when you see a __main__.py file in a directory of a Python project.

    We'll get the relative efforts fixed in a sane way soon. I'm not a fan of using the full module path, but we'll see. It would have been all easier with zero complaints fromflake8 and pylint, but that doesn't look feasible at the moment.

  6. bittner commented on Sep 19, 2018

    @bittner
    bittner
    on Sep 19, 2018
    MemberAuthor
    More actions

    ... ah, and we'll get a /usr/local/bin/python_turtle script (with a shebang line) installed on target systems, so we're all set. 😃

  7. cool-RR commented on Sep 19, 2018

    @cool-RR
    cool-RR
    on Sep 19, 2018 via email
    Member
    More actions
    Sounds good to me!
    …
    On Wed, Sep 19, 2018, 10:50 Peter Bittner ***@***.***> wrote: ... ah, and we'll get a /usr/local/bin/python_turtle script (with a shebang line) installed on target systems, so we're all set. 😃 — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#106 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AADdyrgv9K209YNG3v5Tk9VCVseL-Awlks5ucfcWgaJpZM4WrtH7> .
  8. cool-RR commented on Sep 19, 2018

    @cool-RR
    cool-RR
    on Sep 19, 2018
    Member
    More actions

    I did a few more experiments with __main__.py. Once you use python -m python_turtle, you can import the package by name from __main__.py, and then from any package files you can do both relative imports and importing by full name (e.g. import python_turtle.whatever)

    So I'm happy with using __main__.py :)

  9. bittner commented on Sep 29, 2018

    @bittner
    bittner
    on Sep 29, 2018
    MemberAuthor
    More actions

    Fixed by PR #115.

  10. bittner
    closed this as completedon Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.