From 8132479ee9507621c87a48f99a8430090758406e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 19 Sep 2023 16:30:22 +0200 Subject: [PATCH] Add Python --- README.md | 7 +++++++ python/.gitignore | 5 +++++ python/.vscode/extensions.json | 9 +++++++++ python/.vscode/settings.json | 10 ++++++++++ python/main.py | 4 ++++ python/requirements.txt | 0 python/src/hello.py | 1 + 7 files changed, 36 insertions(+) create mode 100644 python/.gitignore create mode 100644 python/.vscode/extensions.json create mode 100644 python/.vscode/settings.json create mode 100644 python/main.py create mode 100644 python/requirements.txt create mode 100644 python/src/hello.py diff --git a/README.md b/README.md index 676d61e..4ccfb6d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ - [C](#c) - [C++](#c-1) +- [Python](#python) - [OCaml](#ocaml) - [Rust](#rust) - [Typescript](#typescript) @@ -30,6 +31,12 @@ Copy and paste [`cpp/`](./cpp/) directory, and you should be good to go! > Note that in headers, the syntax is `PROJECTNAME_FILENAME_HPP` +## Python + +Copy and paste [`python/`](./python/) directory, and you should be good to go! + +- **Run `python main.py` to start the program.** + ## OCaml Copy and paste [`ocaml/`](./ocaml/) directory, and you should be good to go! diff --git a/python/.gitignore b/python/.gitignore new file mode 100644 index 0000000..f45f7b8 --- /dev/null +++ b/python/.gitignore @@ -0,0 +1,5 @@ +/bin +/lib +pyvenv.cfg + +__pycache__/ diff --git a/python/.vscode/extensions.json b/python/.vscode/extensions.json new file mode 100644 index 0000000..8ee8b57 --- /dev/null +++ b/python/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "ms-python.isort", + "charliermarsh.ruff" + ] +} diff --git a/python/.vscode/settings.json b/python/.vscode/settings.json new file mode 100644 index 0000000..c227fcf --- /dev/null +++ b/python/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "editor.tabSize": 4, + "editor.insertSpaces": false, + + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + + "python.analysis.typeCheckingMode": "basic" +} diff --git a/python/main.py b/python/main.py new file mode 100644 index 0000000..fd3f39b --- /dev/null +++ b/python/main.py @@ -0,0 +1,4 @@ +from src.hello import hello + +if __name__ == "__main__": + print(hello) diff --git a/python/requirements.txt b/python/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/python/src/hello.py b/python/src/hello.py new file mode 100644 index 0000000..d731770 --- /dev/null +++ b/python/src/hello.py @@ -0,0 +1 @@ +hello = "Hello, world!"