diff --git a/content/202307291217 pythonでモジュールファイルを単体で実行したい場合.md b/content/202307291217 pythonでモジュールファイルを単体で実行したい場合.md index 5a158cd..0f9e27e 100644 --- a/content/202307291217 pythonでモジュールファイルを単体で実行したい場合.md +++ b/content/202307291217 pythonでモジュールファイルを単体で実行したい場合.md @@ -9,6 +9,7 @@ if __name__ == "__main__": # ここにやりたいことを書く ``` -cf. -[6.1.1. モジュールをスクリプトとして実行する](https://docs.python.org/ja/3/tutorial/modules.html#executing-modules-as-scripts) +## Refs. + +- [6.1.1. モジュールをスクリプトとして実行する](https://docs.python.org/ja/3/tutorial/modules.html#executing-modules-as-scripts) diff --git a/content/20231129211719 poetry.md b/content/20231129211719 poetry.md index dd39c4c..403dd9b 100644 --- a/content/20231129211719 poetry.md +++ b/content/20231129211719 poetry.md @@ -11,3 +11,4 @@ $ poetry config virtualenvs.in-project true ## Refs. - [Poetryをサクッと使い始めてみる #Python - Qiita](https://qiita.com/ksato9700/items/b893cf1db83605898d8a) +- [pyenv+PoetryでのPython環境構築方法を覚えられない人(私)のための手順書 #Python - Qiita](https://qiita.com/Ryku/items/512a6744bfa9903bf2dd) \ No newline at end of file diff --git a/content/20240329134609 pythonプロジェクトの作り方.md b/content/20240329134609 pythonプロジェクトの作り方.md index d75f113..6d20f22 100644 --- a/content/20240329134609 pythonプロジェクトの作り方.md +++ b/content/20240329134609 pythonプロジェクトの作り方.md @@ -70,6 +70,28 @@ $ poetry install [インストールしたいライブラリ] ``` でインストールされていく。 pyporoject.tomlに自動で追記される(はず) + +### 結果できる poetry.toml +```toml +[tool.poetry] +name = "python-project-template" # ここ毎回換える +version = "0.1.0" +description = "template project for pyenv+poetry" +authors = ["Kaz Saita(raspi4) "] +license = "MIT" +readme = "README.md" +package-mode = false + +[tool.poetry.dependencies] +python = "^3.11" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" +``` +``` + ### 実行 [[#20240329134609 pythonプロジェクトの実行方法 作り方#実行方法]] を参照。 @@ -80,3 +102,29 @@ $ poetry install [インストールしたいライブラリ] poetry.lock __pycache__/ ``` + +### vscode使いたい場合の設定 +#### settings.json +``` +{ +    "terminal.integrated.enablePersistentSessions": true, +    "python.terminal.activateEnvInCurrentTerminal": true, +    "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python" +} +``` +#### launch.json +``` +{ +    "version": "0.2.0", +    "configurations": [ +        { +            "type" : "debugpy", +            "request": "launch", +            "name": "Launch project", +            "cwd": "${workspaceFolder}", +            "module": "python-project-template",           // ここ毎回かえる  +            //"args": [(あれば)], +        } +] +} +``` \ No newline at end of file