Skip to main content

Easy Python Commands

Project description

bash

GitHub Release

ezpyc

Easy Python Commands allows you to execute your python scripts as if they were system commands.

Without ezpyc:

python mycommand.py
# or
python C:\Users\wintermute\dev\mycommand.py

With ezpyc:

mycommand

✅ Requirements

  • Python >=3.11
    • Add python.exe to PATH
  • Windows >=10

🖥️ How to install ezpyc for Windows

Clone repo and run python src/ezpyc.py install as administrator:

git clone https://github.com/itonx/ezpyc
cd ezpyc
python src/ezpyc.py install

Output:

└─ ...
▒ Setup done. Create a new python script at C:\Users\ayrto\.ezpyc and try to run it. If you cannot execute it, restart your terminal or open a new one.

Once the installation's done you'll be able to execute your python scripts as if they were simple windows commands. All scripts must be added to %USERPROFILE%\.ezpyc if don't want to type the full path of your scripts.

Installation details

The installation will make the next changes on your system:

  • Create .ezpyc folder: %USERPROFILE%\.ezpyc
  • Add .ezpyc folder to PATH environment variable for CURRENT_USER
  • Add .PY extension to PATHEXT environment variable for LOCAL_MACHINE
  • Add built-in ezpyc scripts

Built-in ezpyc scripts

%USERPROFILE%\.ezpyc
│   ezpyc.py
└───ezpyc
    __init__.py
    clipboard.py
    command_decorators.py
    env_variable.py
    file.py
    folder.py
    installation_wizard.py
    os_decorators.py
    output.py

Details:

Built-in scripts are created to help you getting started with your own python script commands. All scripts use click to manage command line arguments. hworld is the simplest script, you might want to follow its structure to create simple scripts/commands. The rest of built-in files are a simple abstraction of click, you could follow their structure to create your own abstraction for complex scripts/commands with your own python packages.

  • %USERPROFILE%\.ezpyc\ezpyc is a python package which contains shared code for ezpyc.py.
  • ezpyc.py manages your ezpyc installation

ezpyc command accepts -h and --help args.

⚒️ Create your first script/command

This process is as simple as creating a new file with a print.

mycommand.py

print('mycommand works')

Magic happends once you place your scripts at %USERPROFILE%\.ezpyc.

%USERPROFILE%\.ezpyc
└───mycommand.py

Open a terminal and run the command using the name of your script (no need to type the full path or restart the terminal if you add new scripts to .ezpyc folder):

mycommand

If you want to know how to process command line arguments with click see documentation: https://click.palletsprojects.com/en/stable/.

🖥️ How to uninstall

Option 1: ezpyc_installer.py

Clone repo and run python src/ezpyc.py uninstall as administrator:

git clone https://github.com/itonx/ezpyc
cd ezpyc
python src/ezpyc.py uninstall

Output:

└─ ...
▒ ezpyc's been uninstalled. C:\Users\wintermute\.ezpyc needs to be deleted manually, don't forget to backup your scripts.

Method 2: built-in ezpyc command

This will work only if you installed ezpyc.

Run as administrator:

ezpyc uninstall

Output:

└─ ...
▒ ezpyc's been uninstalled. C:\Users\wintermute\.ezpyc needs to be deleted manually, don't forget to backup your scripts.

NOTE: Commands will be available until you restart your terminal or open a new one.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezpyc-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezpyc-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file ezpyc-0.1.0.tar.gz.

File metadata

  • Download URL: ezpyc-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for ezpyc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49fa4ceda394cbcc398b900941e3219ade962f7109e23dc1a2fb86a7389cc810
MD5 46043a2272d56c6606ca1304004a51ba
BLAKE2b-256 65fd2dcfd1a3980e84e3d1fb472a7b645d61bc421e3d86213114c501430f7213

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezpyc-0.1.0.tar.gz:

Publisher: python-publish.yml on itonx/ezpyc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ezpyc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ezpyc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for ezpyc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa28390feb6b212b25a3bbed285d8ea40cd51a56d87465c9fea155da6cfb506
MD5 de9665e05226de5bff9f4a5878a4dec3
BLAKE2b-256 82bcd45c396c18c3a8c72b4b1e65d4a951aa0b6f627f083664e5d46ff8fbfa7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ezpyc-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on itonx/ezpyc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page