Skip to content

Introduction to create a CLI and custom Python package. The package contains some functions to apply RFM and BG-NBD.

Notifications You must be signed in to change notification settings

mebaysan/introduction-to-creating-cli-and-custom-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Created by @mebaysan

I created this repo to have an idea about how we can create custom Python packages and how we can create CLIs by using Click.

You can go to the custom baysan-data-shortcuts package that I created for this repo by using here.

I created CLI in the main.py file.

process folder contains the some functions to use our package I mentioned above. I tried to simulate the processes of the CLI.

Extra Content

You can check the other repo that I created about "Introduction to CI and CD on AWS and Google Cloud Platform with Flask" by using it here. In this repo, we dived into;

  • Makefile
  • GitHub Actions
  • AWS: Cloud9 & EC2
  • Google Cloud Platform: Cloud Build & App Engine

Also, you can check my Medium story that I wrote detailed with step-by-step examples about the content above by using here.

Setup

After creating a virtual environment, you can install the dependencies of the CLI by using the command below.

make install

Usage

We can execute a CLI like the code below.

python main.py --param1 'Value1' --param2 12

We need to provide the following to execute our CLI:

  • start_date
  • end_date
  • rfm_date
  • statistics_date

We can execute the code below to get help about our CLI:

python main.py --help

Example

python main.py --start_date '20210101' --end_date '20220207' --rfm_date '2022-01-31' --statistics_date '2022-01-31'

If we do as executable our main.py file, we can execute the code below.

./main.py --start_date '20210101' --end_date '20220207' --rfm_date '2022-01-31' --statistics_date '2022-01-31'

How We Can Do as Executable Our Script

We have to put #! virtualenv_path/bin/python into the first line of main.py file. Then the computer will understand it needs to use the Python that we referred in the first line.

Now we need to execute the script below to do as executable our file.

chmod +x main.py

About

Introduction to create a CLI and custom Python package. The package contains some functions to apply RFM and BG-NBD.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published