Omar Jarkas
Omar Jarkas

Reputation: 110

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

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

Upvotes: 0

Views: 323

Answers (1)

DeepSpace
DeepSpace

Reputation: 81654

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(...).

Upvotes: 3

Related Questions