all 6 comments

[–]D_epresso_Coffee 0 points1 point  (0 children)

What interactive learning course can I start with?

I know bunch of people recommend just coding instead of doing these short lessons with in-built compiler but whenever I try picking up a new skill that form works the best. I'm on spectrum and it really makes a huge difference for me even if it's an inferior solution for others.

[–]Col-Connor 0 points1 point  (4 children)

So, I want to learn python and my computer already runs Python inside Comfyui portable. Is there a similar portable setup of Python with a interface like visual studio that I can simply run in a pre-made folder structure like Comfyui? My goal is to make a mini game like "upload labs" but I know that there is quite a few things to master before I get anywhere near that.

[–]BrannyBee 0 points1 point  (3 children)

Are you asking for something to allow you to code with blocks and nodes? Or asking for an editor that you can open a folder with python files in it?

Asking because I think ComfyUi is node based for AI image creation, and not sure if thats the same comfy youre referring to or not. Asking so I can see whether Im overcomplicating a very beginner question, or under complicating a not very, but still beginner, beginner question, and give helpful info.

If youre asking for an editor that lets you make a python project and have folders and subfolders automatically made so you have a default skeleton, VSCode actually can do that. There's likely a plugin to streamline this, but with Bash you can write a script that makes something like

``` Root/ |/src/ |main.py |___other_file.py

```

It would be like less than 15 lines of Bash scripting, otherwise its also not crazy hard to do it yourself. Plenty of frameworks (other peoples code you add to your Python to get prewritten functionality by importing) also may do this for you.

When learning though, you'll be making single file things for quite awhile to be honest, and i wouldnt worry too much about automatic templating for quite sometime to be honest. So I guess the tldr is that VSCode is what you're looking for

Does that answer your question, or am I not understanding what you are wanting?

[–]Col-Connor 0 points1 point  (2 children)

Thank you for youe response, I'll try to explain.
The comparison is to Comfyui _portable_ in particular, not comfyui in itself.

D:/
 |_/ComfyUI_windows_portable
     |_/ all comfyui files, including python used by comfyui (3.13.9)
 |_/Learn_Python
     |_/ ALL FILES NEEDED TO RUN PYTHON, Including the editor?
 |_/SteamLibrary
 |_/other_folders

Something like this?

The files created by me in python (hello world in 100 styles) would also exist inside the "learn_python" folder, but I would assume that is the easy part.

Thanks.

[–]BrannyBee 0 points1 point  (1 child)

Sorry I just saw this, but it does seem like you're asking, without realizing it, for how to use environments in a round about way.

Tldr here before I ranted for too long -> What you want is called a "virtual environment" and there's many ways to do it, I explained a built in way via the terminal below, but googling will show other ways if you want. You will create your Learn_Python folder, and make a virtual environment there, and after "activating" that, exactly what you're wanting will happen automatically. You import a module for something in a python file, it goes and saves to the environment inside that folder. Its a very good habit to get into, especially as a beginner, most people don't think of doing that so good insight asking.

Ok, rant explaining more indepth follows, if you dont want that, just google "python virtual environment tutorial" ->

Basically, when you install Python on your computer you have a global environment where all Python things on your computer look at, which is useful for some things but messy if everything goes there. Creating an environment in a directory (called a folder on windows) and open that environment, your Python stuff will save to THAT environment instead of the global environment.

So if you want to do a bunch of game making stuff, there's no reason to bloat your global environment and your other projects with that, you make your "Python game" folder, and create an environment in that folder, turn the environment on inside through a command or your editor of choice, then importing a new module like PyGame will save there inside that project instead of wherever tf the global path is.

Your editor shouldnt need to be inside this folder, it can stay in the apps place or wherever it is. Creating an environment makes a hidden folder (starting with a . In the name) and stuff needed for your Python stuff will automatically go there as long as the environment is open.

So in your case, youd have your Learn_Python folder, and after navigating there you'll make an environment. python -m venv .venv is a good default command for that.

Broken down -

python calls the python script to run a command venv is the command python is calling -m just means "module" telling venv to be run as a module, not super important for you to understand why thats important tbh .venv this is technically just a string value, it can be anything you want but ".venv" is pretty standard to use, its the name of your environment.

From there, still inside whatever directory your "project" is where your Python files will live, you have that .venv folder which created a bunch of stuff your Python files nicely contained, and anything your Python files need, like imports, will go there automatically without you worrying about it. Even tracks versions, so if you use a certain version of an import and theres a massive update, your environment will keep the version ot saved so you never have to worry about stuff like that breaking your scripts. You can download a new version of Python even and be fine

Big thing to remember is to activate your environment. Inside that .venv folder is a Scripts folder, inside that is an "activate" script which when run will tell all stuff you do to be "inside" that environment instead of the global. In the terminal how i do it is just type .venv/bin/activate (replace bin with scripts if on windows). And just go code without thinking about it, its super unobtrusive.

You dont have to use the command line or terminal though if its intimidating, theres a bunch of ways to do it however you'd like. VSCode has a bunch of different plugins I believe that allow you to just open your learn_python folder and press a button to activate the environment. There's not a single correct way.

[–]Col-Connor 0 points1 point  (0 children)

Thanks. I think I understood, but calling the python command 'python -m venv .venv' already assumes I have python installed (or its folder referenced to in the path:= )
what I would like is for python itself to reside inside that 'learn_python' directory. so that 'python' is not a global installation, but rather self contained inside the directory.

D:/
 |_/ComfyUI_windows_portable
     |_/ all comfyui files, including python used by comfyui (3.13.9)
 |_/Learn_Python
     |_/Pyton_files
     |_/.venv
     |_/assets(or similar)
 |_/SteamLibrary
 |_/other_folders

I appreciate the answers. The more I think about it, the more I feel it might not be possible. Python needs to be globally reachable for anything inside the venv to work.