# "pystart" command for terminal. Pep proposal

**URL:** <https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070>\
**Category:** Ideas\
**Created:** [September 16, 2024, 4:41am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070 "2024-09-16T04:41:52Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 16, 2024, 4:41am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/1 "2024-09-16T04:41:52Z")

</div>

Hello python community,

I congratulate you on the popularity and integration of python into Operating Systems, however this has led setting up a python environment requiring several more steps. Before, these steps were not required and installing packages did not lead to external management conflicts. It was way easier to go from idea to code.

With common adoption and the added security of environments, comes a cost of usability.  
We can chalk this up as just one more thing the user needs to learn, or we can recognize it as a rock in the road between idea, usability and execution.

I post this without prior knowledge of the discussion on this topic and beg forgiveness for stepping on any political toes or entrenched sentiments. I submit this only as a user from a previous version , and using the language more, recently.

I simply propose an alias command like i have set up in my local environment that creates a venv in the project file: “pystart”

pipx is not the solution as it does not make it’s installed dependencies available globally, as i’ve run into missing dependency errors running a script .

i am very likely going about this all wrong, and welcome configurations i am ignorant about that eliminate this alias altogether for my workflow, but my best searches so far have just revealed an attitude of “change your behavior to fit the language” and “entering two to three extra commands before you get started is really not that big of a deal” which seems odd because pythons are flexible.

adding this alias to main would modify the user behavior towards safety, being conscious of security environments and package management, while simultaneously increasing usability for all.

-Humbly submitted by a Python appreciator and Python3 enjoyer

---

<div class="post-metadata">

**Author:** ![Nineteendo](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/nineteendo/32/19122_2.png) [@Nineteendo](https://discuss.python.org/u/Nineteendo)\
**Post date:** [September 16, 2024, 7:35am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/2 "2024-09-16T07:35:39Z")

</div>

I think something like `pyvenv pystart` instead of `python -m venv pystart` would make more sense, but this already existed at some point, and was removed because of potential confusion about which Python interpreter it’s tied to: [Drop the pyvenv script · Issue #69341 · python/cpython · GitHub](https://github.com/python/cpython/issues/69341)

But isn’t that the same problem with `pip` and `python -m pip`? Is there an assumption `pip` is used more often than `python -m venv`, even though it’s the recommended approach? Or is this fine because of `python -m ensurepip`?

---

<div class="post-metadata">

**Author:** ![brass75](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brass75/32/19784_2.png) [@brass75](https://discuss.python.org/u/brass75)\
**Post date:** [September 16, 2024, 3:48pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/3 "2024-09-16T15:48:54Z")

</div>

You might try looking at [uv](https://docs.astral.sh/uv/).

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [September 16, 2024, 4:39pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/4 "2024-09-16T16:39:13Z")

</div>

> [@bardicreels](#):
>
> I simply propose an alias command like i have set up in my local environment that creates a venv in the project file

… and then what? What should happen once the virtual environment is created?

> [@bardicreels](#):
>
> however this has led setting up a python environment requiring several more steps. Before, these steps were not required and installing packages did not lead to external management conflicts.

Can you be more explicit? What commands were you used to run “before”? Before what? And what commands did you settle on running now?

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 20, 2024, 11:12am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/5 "2024-09-20T11:12:08Z")

</div>

That looks great !

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 20, 2024, 11:14am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/6 "2024-09-20T11:14:26Z")

</div>

pystart would not and does not have this confusion in my set up. using the “env” contributes to this, whereas pystart is it’s own thing and is in line with the secure behavior everyone wants.

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 20, 2024, 11:24am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/7 "2024-09-20T11:24:40Z")

</div>

the intuition is to:

$ python app.py

but one actually has to:  
 python3 -m venv myenv pip install dependencies

source myenv/bin/activate python3 app.py

my alias “pystart” eliminates those steps and so my request is to just standardize this behavior

---

<div class="post-metadata">

**Author:** ![ilotoki0804](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ilotoki0804/32/14237_2.png) [@ilotoki0804](https://discuss.python.org/u/ilotoki0804)\
**Post date:** [September 20, 2024, 3:03pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/8 "2024-09-20T15:03:20Z")

</div>

> [@bardicreels](#):
>
> I simply propose an alias command like i have set up in my local environment that creates a venv in the project file: “pystart”

With [uv](https://docs.astral.sh/uv/), just type `uv sync` and it will create a virtual environment and install all the dependencies for you.

> [@bardicreels](#):
>
> the intuition is to:
> 
> $ python app.py
> 
> but one actually has to:  
> python3 -m venv  
> pip install dependencies  
> source myenv/bin/activate  
> python3 app.py
> 
> my alias “pystart” eliminates those steps and so my request is to just standardize this behavior

Check out [script dependencies](https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies).

```console
uv add --script example.py 'requests<3' 'rich'
uv run example.py

```

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 20, 2024, 3:53pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/9 "2024-09-20T15:53:05Z")

</div>

this is great, and i will check this out, but learning a new tool does not improve pythons useability. It’s the equivalent to “conform to the language” .

To me it’s like saying: Before you could start a by turning the key, now you just need to push a button, but that button requires an app to be able to push it, for security and collision reasons.

it’s a step backwards.

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [September 20, 2024, 5:02pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/10 "2024-09-20T17:02:23Z")

</div>

I will say what I already said in [https://discuss.python.org/t/in-built-python-version-manager-pvm-and-package-manager/64354/6](https://discuss.python.org/t/in-built-python-version-manager-pvm-and-package-manager/64354/6):

Ideas like this have been discussed multiple times in #Packaging (looking for the keyword `platypus` might put you on the right track to finding some of the relevant discussion threads).

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 20, 2024, 9:36pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/11 "2024-09-20T21:36:25Z")

</div>

my idea is different though isn’t it. I’m not calling for a pkg manager.

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [September 21, 2024, 9:12am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/12 "2024-09-21T09:12:26Z")

</div>

Honestly I am not sure what your idea is. It is a bit vague. Or maybe I am just not understanding what you mean. It would be helpful if you would describe a complete use case from top to bottom in simple straightforward sentences.

If what you want is uv’s script dependencies (which is based on “[inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata)” which is implemented in other tools besides uv), then there you have it.

You say you don’t want to learn a new tool, but you propose a new thing called `pystart` that one would probably need to learn anyway, no? So I am a bit confused. : D

Why don’t you post the content of you `pystart` alias here?

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 21, 2024, 9:29am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/13 "2024-09-21T09:29:57Z")

</div>

Sure:

Let’s suppose you are on a new OS install and setting up python. You install python 3 through the pkg manager and now want to run a script. So far the commands you’ve entered are Sudo apt install python3 . What are the next commands you must enter before app.py runs ?

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [September 21, 2024, 10:29am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/14 "2024-09-21T10:29:25Z")

</div>

Why did you run `sudo apt install python3`? If the “best way” to install Python was `sudo apt install uv`, would that satisfy you? You could then run app.py using `uv run app.py`\[1\].

Or is your complaint that you want this functionality built into the distributions shipped by [python.org](http://python.org)? While I can understand that desire, you’re _already_ not using a [python.org](http://python.org) distribution if you use the build provided by your OS. There are people working on the question of what [python.org](http://python.org) should provide in the way of “official” distributions of Python, but it’s a complex and difficult problem.

So, to address your original post:

1. We’re working on this question, but it’s not as simple as you seem to think.
2. In the meantime, `uv` almost certainly gives you the sort of experience you want. It’s up to you whether you view it as an acceptable solution or not.

* * *

1. I have confirmed this works, with the exception that the version of Ubuntu I tried didn’t have `uv` packaged yet, so I used their manual install instructions

---

<div class="post-metadata">

**Author:** ![RodrigoAroeira](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/rodrigoaroeira/32/22658_2.png) [@RodrigoAroeira](https://discuss.python.org/u/RodrigoAroeira)\
**Post date:** [September 21, 2024, 11:47am UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/15 "2024-09-21T11:47:48Z")

</div>

I’m not sure how helpful what I’ll say is, but you could write a simple script to do this. A few weeks back I wrote this in bash and it’s been incredibly helpful so far

```bash
function virtualenv() {
  local env_folder="$1"
  local createdNow=false

  # If no argument is provided, check for existing environments
  if [-z "$env_folder"]; then
    if [-d ".venv"]; then
      env_folder=".venv"
    elif [-d "venv"]; then
      env_folder="venv"
    else
      echo "Usage: ${FUNCNAME[0]} <env_name>"
      return 1
    fi
  fi

  # Create the virtual environment if it doesn't exist
  if [! -d "$env_folder"]; then
    python -m venv "$env_folder"
    createdNow=true
  fi

  # Activate the virtual environment
  source "$env_folder/bin/activate"

  # Automatically install requirements if the environment was just created
  if $createdNow && [-f "requirements.txt"]; then
    echo "Automatically installing requirements.txt, please wait..."
    pip install -r requirements.txt --require-virtualenv
  fi
}

```

I’m sure more functionalities could be implemented and this could also be written in PowerShell, but this is just a little something that can be done instead of having a command built in to python

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 21, 2024, 9:19pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/16 "2024-09-21T21:19:42Z")

</div>

“if the best way to use python is this other niche tool that is not python, why did you not use that ?”

i mean… i only found out about it from replies to this post and it was not a prominent reply to the regular first level responses to my issue on reddit, stack, ect. pipx is, but is another tool like uv.

1. Awesome. I hope a user friendly solution is found. My request is more along the lines of something as simple as a “SHOULD” guidance or policy in the Docs for operating systems to set up a pystart trigger at install.

2, I will try out uv.

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 21, 2024, 9:36pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/17 "2024-09-21T21:36:42Z")

</div>

This is great, and i thank you. The problem is, i move systems a lot, upgrade to incompatible kernels and lose track of dotfiles.  
It’s more reasonable to expect a language to just run, rather than having to hack my way around the language implementation.

As an example is: if/when I install racket, clojure, gcc, js, it just runs in their respective environments without collisions with the operating system necessitating further tools.  
It’s wild to think about why and how everyone just sort of allows python to have this giant integration danger zone and breaking behavior, in a way c has never done.

The more i think about it and the more i see helpful but ultimately cope replies like “use this other tool to work around an obvious flaw” or “use this code” the more i’m curious why this is the case and what decisions led to the state of affairs that a warning about an “externally managed environment” is a satisfactory hurdle a user must contend with.

I’m trying to think of another language i’ve worked with that behaves this way. Java ? .net maybe. yeah .net and it’s eye of sauron takeover of the operating system in the early 2000’s

Again, i say this as someone who admires python’s growth and ubiquity.

I’m not crazy though right ? I shouldn’t have to run other tools or add twenty odd lines of bash to run a script file for an already installed language ?

---

<div class="post-metadata">

**Author:** ![bardicreels](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bardicreels/32/22574_2.png) [@bardicreels](https://discuss.python.org/u/bardicreels)\
**Post date:** [September 21, 2024, 9:38pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/18 "2024-09-21T21:38:05Z")

</div>

a very good point is that this might be an OS problem, though.

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [September 21, 2024, 10:14pm UTC](https://discuss.python.org/t/pystart-command-for-terminal-pep-proposal/64070/19 "2024-09-21T22:14:02Z")

</div>

> [@bardicreels](#):
>
> I install racket, clojure, gcc, js

When you install C, you don’t install C, you install gcc. When you install Javascript, you (probably) install Node. Installing a tool that isn’t technically “the language” is not as uncommon as you seem to be suggesting.

I’m not saying Python doesn’t have problems, just that you may simply be more used to the problems of other languages.

After all, you _can_ just install Python and run a Python script. If it has dependencies, you need to do some extra work, certainly, but (for example) C is _far_ worse in this regard, having no package manager, and no package repository.

It’s worth remembering that Python is over 30 years old now. Its ecosystem is much _better_ than languages of a similar age. Newer languages have in turn improved things significantly, but they don’t have years of history to consider when making any change. Python will get there, but it’s slow simply because Python is popular and hence has a huge user base invested in the current ecosystem.
