waka-readme/CONTRIBUTING.md
Jovial Joe Jayarson 60fa45f3f0 feat: bumped version to 0.1.9
- updates dependencies
- prefer type inference with function return
- fix typos / minor improvements
- ignore all ``*.env` files
- bumped package version to 0.1.9
2023-03-25 10:05:49 +05:30

3.5 KiB

Contributing

python_ver

First off, thank you! Please follow along.

You need to fork this repository and clone it, onto your system.

Assumes you've already installed & configured latest version of docker or podman.

Replace docker with podman everywhere, if you're using the latter.

  1. Inside the cloned folder, run:

    $ git archive -o 'waka-readme.tar.gz' HEAD
    $ docker build . -f containerfile -t 'waka-readme:dev'
    

    to build an image. (Image is identified as <name>:<tag>)

  2. Then create containers and use them as dev environments.

    • Temporary:

      $ docker run --rm -it --name 'WakaReadmeDev' 'waka-readme:dev' bash
      
    • or Persistent

      $ docker run --detach --name 'WakaReadmeDev' 'waka-readme:dev'
      

    where WakaReadmeDev is the docker container name. Then execute bash in the container:

    $ docker exec -it 'WakaReadmeDev' bash
    
  3. For development, you can attach code editor of your choice to this container.

  4. Export environnement variables with edits, as required:

    // inside container, create a file `.env`
    # micro .env
    

    paste (Ctrl+Shift+V) the following contents:

    INPUT_GH_TOKEN='<GITHUB TOKEN>'
    INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>'
    INPUT_API_BASE_URL='https://wakatime.com/api'
    INPUT_REPOSITORY='<REPOSITORY SLUG>'
    INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>'
    INPUT_SHOW_TITLE='True'
    INPUT_SECTION_NAME='waka'
    INPUT_BLOCKS='->'
    INPUT_SHOW_TIME='True'
    INPUT_SHOW_TOTAL='True'
    INPUT_TIME_RANGE='last_7_days'
    INPUT_SHOW_MASKED_TIME='True'
    

    and execute program with:

    # poetry shell
    # set -a && . ./.env && set +a # optional
    (waka-readme-py3_11)# python -m main --dev
    (waka-readme-py3_11)# python -m unittest discover # run tests
    
  5. Later, to remove stop and remove the container:

    // exit container
    # exit
    
    $ docker container stop 'WakaReadmeDev'
    $ docker container rm 'WakaReadmeDev'
    

Note

With VSCode on Windows

Add these to .vscode/settings.json

{
  "terminal.integrated.commandsToSkipShell": [
    "-workbench.action.quickOpenView"
  ]
}

To quit the micro editor from the vscode terminal.


Manual

Assumes you've already installed & configured latest version of python and poetry.

  1. Inside the cloned folder run:

    $ poetry shell
    (waka-readme-py3_11)$ poetry install
    

    to create and activate a virtual environnement and install dependencies.

  2. Put environment variables in a .env file

    INPUT_GH_TOKEN='<GITHUB TOKEN>'
    INPUT_WAKATIME_API_KEY='<WAKATIME API KEY>'
    INPUT_API_BASE_URL='https://wakatime.com/api'
    INPUT_REPOSITORY='<REPOSITORY SLUG>'
    INPUT_COMMIT_MESSAGE='<COMMIT MESSAGE>'
    INPUT_SHOW_TITLE='True'
    INPUT_SECTION_NAME='waka'
    INPUT_BLOCKS='->'
    INPUT_SHOW_TIME='True'
    INPUT_SHOW_TOTAL='True'
    INPUT_TIME_RANGE='last_7_days'
    INPUT_SHOW_MASKED_TIME='True'
    
  3. Execute program in development mode with:

    (waka-readme-py3_11)$ set -a && . ./.env && set +a # optional
    (waka-readme-py3_11)$ python -m main --dev
    (waka-readme-py3_11)$ python -m unittest discover # run tests