python-launcher | Python launcher for Unix | Command Line Interface library

 by   brettcannon Rust Version: v1.0.0 License: MIT

kandi X-RAY | python-launcher Summary

kandi X-RAY | python-launcher Summary

python-launcher is a Rust library typically used in Utilities, Command Line Interface applications. python-launcher has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Launch your Python interpreter the lazy/smart way!. This project is an implementation of the py command for Unix-based platforms (with some potential experimentation for good measure ). The goal is to have py become the cross-platform command that Python users typically use to launch an interpreter while doing development. By having a command that is version-agnostic when it comes to Python, it side-steps the "what should the python command point to?" debate by clearly specifying that upfront (i.e. the newest version of Python that can be found). This also unifies the suggested command to document for launching Python on both Windows as Unix as py has existed as the preferred command on Windows since 2012 with the release of Python 3.3.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              python-launcher has a low active ecosystem.
              It has 525 star(s) with 27 fork(s). There are 11 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 11 open issues and 57 have been closed. On average issues are closed in 51 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of python-launcher is v1.0.0

            kandi-Quality Quality

              python-launcher has 0 bugs and 0 code smells.

            kandi-Security Security

              python-launcher has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              python-launcher code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              python-launcher is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              python-launcher releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              It has 143 lines of code, 10 functions and 6 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of python-launcher
            Get all kandi verified functions for this library.

            python-launcher Key Features

            No Key Features are available at this moment for python-launcher.

            python-launcher Examples and Code Snippets

            No Code Snippets are available at this moment for python-launcher.

            Community Discussions

            QUESTION

            On Windows, what is the python launcher 'py' doing that lets control-C cross between process groups?
            Asked 2017-Apr-24 at 06:27

            Right, this is extremely obscure...

            So on Windows, when you hit control-C to interrupt a console program, this sends a CTRL_C_EVENT to the process. You can also do this manually via GenerateConsoleCtrlEvent. In Python, os.kill acts as a wrapper around the C-level GenerateConsoleCtrlEvent, and allows us to send a CTRL_C_EVENT to the current process by doing:

            ...

            ANSWER

            Answered 2017-Apr-24 at 06:27

            Every process is in a process group. It either inherits its parent's group, or it gets created as the leader of a new group via the CREATE_NEW_PROCESS_GROUP creation flag. As far as I know, GenerateConsoleCtrlEvent is the only API that uses process groups, and there's no API to query the process group ID. You could grab it from the ProcessParameters in the PEB, but that involves using undocumented internal structures. No one should do that, so GenerateConsoleCtrlEvent should only send to either group 0 to broadcast an event or to a child process that you know was created as a new group.

            The problem that you've uncovered here is that sending an event to a process that's attached to the console but not the leader of a group gets silently handled as if the target were group 0. Specifically in your case you're starting py.exe as the group leader and then trying to send CTRL_C_EVENT to python.exe, i.e. os.getpid(). You'd have to send to os.getppid() in this case.

            This problem is common with Python scripts on Windows because of the confusing implementation of os.kill. It conflates process IDs and process group IDs. It would have been less confusing had GenerateConsoleCtrlEvent been used for os.killpg (currently not implemented on Windows) and TerminateProcess alone used for os.kill.

            Experiencing random hangs when calling os.kill(os.getpid(), signal.CTRL_C_EVENT); time.sleep(10) may be due to a race condition. time.sleep is implemented by pysleep in Modules/timemodule.c. On Windows, when called in the main thread, it waits on an event that gets set by the signal handler for SIGINT (but not SIGBREAK for some reason). The possible race here is that pysleep resets the event before waiting on it. The signal handler executes on a new thread, and occasionally it may have already set the event before pysleep resets it. This is conceivable since executing CPython bytecode is relatively slow. That said, I'd expect it to be a close race because there are a lot of steps involved to create the control handler thread, as the following overview shows for Windows 10.

            Source https://stackoverflow.com/questions/42180468

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install python-launcher

            There are various ways to install the Python Launcher for Unix. Some will install the extras provided by this project while others will not. Specifically, those extras are:.
            The man page
            Shell completions for fish
            This README

            Support

            The general control flow for finding the appropriate Python executable is the following (with Python 3.6, Python 3, and the newest version of Python installed as examples):. See the man page or the top section of py --help for more details.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/brettcannon/python-launcher.git

          • CLI

            gh repo clone brettcannon/python-launcher

          • sshUrl

            git@github.com:brettcannon/python-launcher.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Command Line Interface Libraries

            ohmyzsh

            by ohmyzsh

            terminal

            by microsoft

            thefuck

            by nvbn

            fzf

            by junegunn

            hyper

            by vercel

            Try Top Libraries by brettcannon

            caniusepython3

            by brettcannonPython

            gidgethub

            by brettcannonPython

            sans-io

            by brettcannonPython

            desugar

            by brettcannonPython

            microvenv

            by brettcannonPython