Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add “New > Python File” option to Windows Explorer context menu during installation #128148

Open
Unknownuserfrommars opened this issue Dec 21, 2024 · 5 comments
Labels
OS-windows topic-installation type-feature A feature request or enhancement

Comments

@Unknownuserfrommars
Copy link

Unknownuserfrommars commented Dec 21, 2024

Feature or enhancement

Proposal:

Hello Python Dev Team,

I’d like to suggest adding an option to create a new Python file directly from the Windows Explorer New context menu. This feature could be integrated into the Python installer for Windows. It would save users from having to manually configure the Windows Registry to achieve this functionality.

Proposed Behavior:

  • During installation, the installer could optionally add the necessary ShellNew registry keys for .py files. (In HEKY_CLASSES_ROOT, i believe)
  • Users could immediately create .py files via Right-click > New > Python File without additional setup.

Benefits:

  • Streamlines the experience for new Python users, especially those less comfortable with manual registry edits.
  • Aligns with the behavior of other common file types (e.g., text files, Word docs).

Potential Challenges:

  • Ensuring this feature is optional during installation.
  • Supporting user-defined Python file templates, if applicable.

Would this be a viable addition? Thanks for considering!

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

@Unknownuserfrommars Unknownuserfrommars added the type-feature A feature request or enhancement label Dec 21, 2024
@picnixz
Copy link
Contributor

picnixz commented Dec 21, 2024

@zooba Should (and can) this be done on our side or on Windows' side?

@Unknownuserfrommars
Copy link
Author

For the users, maybe a tweak in regedit will do, like change/add some values in HKEY_CLASSES_ROOT\Python.File, I've tried without success. It'd be very convenient if the Python installer does it for users.

@StanFromIreland
Copy link
Contributor

StanFromIreland commented Dec 21, 2024

This would be a good addition in my opinion!

Something like this should work I think?

reg add HKEY_CLASSES_ROOT\.py /ve /d "Python.File" /f
reg add HKEY_CLASSES_ROOT\.py\ShellNew /v NullFile /t REG_SZ /d "" /f
reg add HKEY_CLASSES_ROOT\Python.File /ve /d "Python Script" /f

The uninstaller would also have to be modified to clean these up.

@Unknownuserfrommars do you plan to open a PR or are other users free to do so?

@EEBFF123
Copy link

Something like this should work I think?

reg add HKEY_CLASSES_ROOT\.py /ve /d "Python.File" /f
reg add HKEY_CLASSES_ROOT\.py\ShellNew /v NullFile /t REG_SZ /d "" /f
reg add HKEY_CLASSES_ROOT\Python.File /ve /d "Python Script" /f

I tried it out in Powershell Administrator mode, it worked nicely
image
It created a New > Python File option, and worked just fine.
However, the problem is that AT LEAST the uninstaller needs to be modified to remove this. (It would be even better if the installer is modified so no additional regedit is needed.

@Unknownuserfrommars
Copy link
Author

@StanFromIreland It's okay, you can feel free to open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows topic-installation type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants