Skip to content

devlights/try-python

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

try-python

This is my TUTORIAL project for python.

try-python - Python Version CodeFactor Gitpod Ready-to-Code

Requirements

  • Python 3.10 or higher
  • Poetry
    • Dependency management
  • Task
    • Task runner

Python version

$ poetry run python -V
Python 3.10.7

$ poetry env info

Virtualenv
Python:         3.10.7
Implementation: CPython
Path:           /workspace/.pyenv_mirror/poetry/virtualenvs/try-python-M1FUJLyv-py3.10
Executable:     /workspace/.pyenv_mirror/poetry/virtualenvs/try-python-M1FUJLyv-py3.10/bin/python
Valid:          True

System
Platform:   linux
OS:         posix
Python:     3.10.7
Path:       /home/gitpod/.pyenv/versions/3.10.7
Executable: /home/gitpod/.pyenv/versions/3.10.7/bin/python3.10

Make Environment

$ poetry install
$ poetry lock

REPL

$ task repl
task: [repl] poetry run python
Python 3.10.7 (main, Nov  8 2022, 08:35:33) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.system("which python")
/workspace/.pyenv_mirror/poetry/virtualenvs/try-python-M1FUJLyv-py3.10/bin/python
0

Launch

$ task run

Unit Test

$ task test

Format

$ task fmt

Lint

$ task lint

Mypy

$ task mypy

VSCode settings (Example)

settings.json

{
    "python.defaultInterpreterPath": "python",
    "python.linting.flake8Enabled": true,
    "python.linting.mypyEnabled": true,
    "python.formatting.provider": "black",
    "python.linting.pydocstyleEnabled": true,
    "python.terminal.launchArgs": [
        "-B",
        "-c",
        "\"import IPython; IPython.start_ipython()\""
    ]
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "try-python",
            "type": "python",
            "request": "launch",
            "module": "trypython",
            "pythonArgs": [
                "-X", "dev",
                "-X", "tracemalloc=10"
            ],
            "env": {
                "PYTHONDONTWRITEBYTECODE": "1"
            }
        }
    ]
}

Misc

  • try-python-extlib
    • 姉妹プロジェクト. 外部ライブラリのサンプルなどがあります。