GithubHelp home page GithubHelp logo

mebaysan / introduction-to-creating-cli-and-custom-package Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 8 KB

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

Makefile 3.27% Python 96.73%
data-science cli python python3 custom-package customer-analytics rfm-analysis bg-nbd gamma-gamma

introduction-to-creating-cli-and-custom-package's Introduction

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

introduction-to-creating-cli-and-custom-package's People

Contributors

mebaysan avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.