Alias "python script" to a specified name so as to present a command for a python cli application

265 Views Asked by At

I currently writing a python cli application that takes in a CSV file as an argument and various options from the cli.

python .\test.py data.csv
usage: test.py [-h] [-v | -q] [-o] filepath

I want to alias or replace the python ./test in the cli with another word so as to look like a command like angular or git cli. For example rexona data.csv -o.

I want to do that on both Windows and Linux so as I can publish it as a PyPI distribution.

Thank you

1

There are 1 best solutions below

0
DeepSpace On

Aliasing is a very OS and environment-dependent and is not the correct way to achieve what you are looking for.

Instead, you should use the tools offered by the packaging tool you are using to create the distributed package.

For example, if using setup.py then add

entry_points={
        'console_scripts': ['rexona = path.to.module:function_name']
    },

to the call to setup(...).