Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable linting for python code #407

Closed
1 of 2 tasks
Aveline-art opened this issue Jun 3, 2023 · 3 comments
Closed
1 of 2 tasks

Enable linting for python code #407

Aveline-art opened this issue Jun 3, 2023 · 3 comments
Assignees
Labels
feature: GitHub Actions Pertains to all GHAs (and other GH automations) PBV: dev all issues for engineering roles (devops, backend, frontend, db) ready for milestone role: backend Pertains to backend tasks size: 2pt Can be done in 7-12 hours

Comments

@Aveline-art
Copy link
Member

Aveline-art commented Jun 3, 2023

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

  • Discuss with the team on whether adding a python linter is desirable.
  • Enable the python linter for super-linter if needed.

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.
@Aveline-art Aveline-art added role: backend Pertains to backend tasks size: 2pt Can be done in 7-12 hours feature: GitHub Actions Pertains to all GHAs (and other GH automations) labels Jun 3, 2023
@Aveline-art Aveline-art moved this from 🆕 New to 📋 Backlog in P: CTJ: Project Board Jun 3, 2023
@ExperimentsInHonesty ExperimentsInHonesty added the PBV: dev all issues for engineering roles (devops, backend, frontend, db) label Jun 12, 2024
@LoTerence LoTerence self-assigned this Sep 20, 2024
@LoTerence LoTerence moved this from 📋 Prioritized Backlog to 🏗 In progress in P: CTJ: Project Board Sep 20, 2024
@irais-valenzuela
Copy link
Member

Related issue: #587

@LoTerence
Copy link
Member

LoTerence commented Oct 8, 2024

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.

  • Test the dev python linter container
  • Upgrade it or make changes if necessary
  • Finally, document changes in mkdocs

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:

  • this implementation enables the pre-commit config + hooks through the docker container. Not sure how I feel about this yet.
  • It also has a separate linter.env file specifically for the pre-commit
  • At the moment, the installation instructions in the mkdocs include instructions on how to start the linter container detailed here. This needs to be changed, as of now we are not using it (at least in the develop branch)
  • I believe there is also a github action for linting the backend before merging to main.. Need to look into this. It is likely using the same config Matt Pereira made here.
  • There exists a linters/ folder in the .github/ folder. I need to investigate what this is for.

Idea

  • separate codebase into v1 and v2 branches first so there are no conflicts between what we have in develop now and the linter config that was in main before

Resources

@LoTerence
Copy link
Member

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

@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in P: CTJ: Project Board Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: GitHub Actions Pertains to all GHAs (and other GH automations) PBV: dev all issues for engineering roles (devops, backend, frontend, db) ready for milestone role: backend Pertains to backend tasks size: 2pt Can be done in 7-12 hours
Projects
Archived in project
Development

No branches or pull requests

6 participants