GithubHelp home page GithubHelp logo

arv-anshul / learn-stuffs Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 10 KB

Learning and blogging advance programming topics which helps to apply automation in projects.

Python 15.60% Makefile 84.40%
advanced-programming automation github-actions learning-by-doing pre-commit git github

learn-stuffs's Introduction

learn-git

Using this repo I am learning some essential things about git.

Roadmap

  • Publishing python project on pypi website using Github Actions.
  • Code formatting and linting with Github Actions.
  • How to use pre-commit hooks?
  • Learn tox for python project.
  • Learn cookiecutter to develop ml-project-template project.
  • Learn how to use Makefile.

๐Ÿง‘โ€๐Ÿซ Learn pre-commit

pre-commit is a very nice tool to ensure code quality by running checks on code before it is committed to the repository.

Literally, you can format and check linting of your code with this before any commit. If you want to do this in your project follow along:

โš™๏ธ Installation & Working

  1. Install pre-commit:
pip install pre-commit
  1. Create a pre-commit config file at your root directory:
touch .pre-commit-config.yaml
  1. Now, define pre-commit hooks. For example,

    • You want to check and format your codes with black formatter.
    • And you want to perform linting too with flake8.
    • Then, you have to put these texts into .pre-commit-config.yaml file.
repos:
  # black - Format python scripts
  - repo: https://github.com/psf/black-pre-commit-mirror
    rev: 23.9.1
    hooks:
      - id: black
        language_version: python3.11 # Specify your python version

  # flake8 - Python code linter
  - repo: https://github.com/PyCQA/flake8
    rev: 3.9.2
    hooks:
      - id: flake8
        name: flake8
        types: [python]
        args:
          - --max-line-length=88
          - --ignore=E203,E501,W503
  1. Run pre-commit install to install the Git hooks:

This will take some minutes to install required configs...

pre-commit install
  1. Now commit your changes as usual in your repository. The pre-commit hooks will run automatically before the commit is created.

  2. For Testing: If you want to test the pre-commit you can do it by running below command. But first you need to add all your changes to the staging area with git add . command.
    Because this will read only those files which are present at staging area of your repository.

pre-commit run
  1. Finally, if pre-commit get some issue in your code while committing then it will print those in your console right away. And then you can fix them manually and commit those fixes into the repository.

๐Ÿ“„ If you want more information about pre-commit read this blog.

๐Ÿง‘โ€๐Ÿซ Learn Makefile

Check this Makefile which I copied and configured for my own purpose.

This is a amazing yet confusing (for the beginners) way to automate and to improve your experience regarding repetitive tasks. You have to just define many sequential command in the find and assign a good name to it and then run make awesome-name as command in your terminal and boom you get all your work done in a go.

Copied from this blog.

learn-stuffs's People

Contributors

arv-anshul avatar

Watchers

 avatar

Forkers

krish-01

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.