hackforla / CivicTechJobs

CivicTechJobs will be a platform to help prospective volunteers find interdisciplinary projects that will be useful for their career development while contributing to positive civic impact, and also a CMS (Content Mgmt System) for Hack for LA projects to be able to list their open roles.
https://civictechjobs.org
GNU General Public License v2.0
18 stars 23 forks source link

Enable linting for python code #407

Closed Aveline-art closed 1 week ago

Aveline-art commented 1 year ago

Overview

As a developer, we should make sure that our code is maintainable. For this ticket, let's start a discussion on whether linting python code is desirable.

Action Items

Resources/Instructions

Resources

This has never been up for consideration previously, since vscode did not have native support for python linting, meaning that we needed to download them as libraries, which would impact our build size. Now two things have changed:

  1. We are using poetry now, so we can specify optional dev dependencies.
  2. VSCode now has an extension for black and isort. This means that we do not to fangle with any external libraries.
irais-valenzuela commented 1 month ago

Related issue: #587

LoTerence commented 1 month ago

Note: This docker code from Ida's PR #587, that came from the main branch (written by Matt Pereira over a year ago) would enable the python linter in dev mode:

 linter:
    profiles: ["lint"]
    build:  
      context: .
      dockerfile: ./dev/linter.dockerfile
    container_name: linter
    environment:
      - PRE_COMMIT_HOME=${HOME}/.cache/pre-commit
    user: ${UID}:${GID}
    env_file:
      - ./dev/linter.env
    volumes:
      - .:/src:rw
      - ${HOME}/.cache:${HOME}/.cache:rw

I need to investigate this further.

The benefit of having a docker container for linting the backend is that no one will have to install the specific version of python or poetry or all the vscode python linter extensions, which can be overly complicated for new devs.

Things to keep in mind:

Idea

Resources

LoTerence commented 1 week ago

Next step: Add python and eslint automations to CI/CD pipeline #611