aimingmed-ai/app/proto-docs/docs/computer_setup.md
2025-02-11 11:49:37 +08:00

3.6 KiB

Visual Studio Code setup

  1. Recommended vscode extensions for Python Development

  2. Enable strict typehints in the setting

    {
      "python.analysis.typeCheckingMode": "strict",
      "python.analysis.inlayHints.pytestParameters": true,
      "python.analysis.inlayHints.functionReturnTypes": true
    }
    
  3. Format using Black and Lint using Ruff on save

    !!! warning

    Set all these settings to false for existing projects that never use `Black` or `Ruff` before.
    
    {
      "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
          "source.organizeImports": true,
          "source.fixAll": true
        }
      },
      "python.formatting.provider": "none",
      "notebook.formatOnSave.enabled": true
    }
    
  4. Test using pytest

    {
      "python.testing.pytestEnabled": true,
      "python.testing.pytestArgs": ["tests"]
    }
    
  5. Use google documentation style

    {
      "autoDocstring.docstringFormat": "google"
    }
    
  6. Guides from the internet

Virtual Environment Management

Pyenv and Poetry is typically used for managing Python package, while Conda is more popular in Data Science project.

Both features virtual environment creation, but Poetry offers finer details on installing packages for production or development, publishing the Python package.

  1. Both Pyenv AND Poetry

    !!! note "Pyenv Installation" Pyenv installation may requires executing more than one line in terminal, you also need to set your shell profile (.zshrc or .bash_profile).

    Read carefully [here](https://github.com/pyenv/pyenv#installation)
    

    !!! note "Poetry Installation"

    If you have old Poetry version (<1.2), you need to uninstall it and install the latest version.
    
  2. Either Conda Miniforge OR Mambaforge

  3. Docker

Gitignore

Download gitignore template from gitignore.io.

Python and visualstudiocode are recommended arguments for starter.

Alternative Way

You may create command line function gi to download gitignore file. Follow the guide in here. Then, you can the command in the project root folder.

gi python,visualstudiocode >> .gitignore