From 15a6a73fa77467a9a0f601d45a1cd148cc6a535c Mon Sep 17 00:00:00 2001 From: James Bayley <36523314+jamesbayley@users.noreply.github.com> Date: Thu, 2 May 2024 19:10:07 +0000 Subject: [PATCH] Configure Python bindings --- .devcontainer/devcontainer.json | 13 ++++++++++++- .vscode/extensions.json | 3 +++ .vscode/settings.json | 19 ++++++++++++++++++- bindings/python/__init__.py | 0 bindings/python/main.py | 1 + poetry.toml | 2 ++ pyproject.toml | 23 +++++++++++++++++++++++ 7 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 bindings/python/__init__.py create mode 100644 bindings/python/main.py create mode 100644 poetry.toml create mode 100644 pyproject.toml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 911c933..ce44414 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,21 +2,32 @@ "name": "Gazelle", "runArgs": ["--name", "gazelle"], "build": { "dockerfile": "Dockerfile" }, + "postCreateCommand": "poetry install", "privileged": true, "features": { "ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers/features/powershell": {}, - "ghcr.io/devcontainers/features/rust:1": {} + "ghcr.io/devcontainers/features/rust:1": {}, + "ghcr.io/devcontainers/features/python:1": { + "version": "3.12", + "toolsToInstall": "pipx, poetry", + "installTools": true, + "optimize": false, + "enableShared": false + } }, "customizations": { "vscode": { "extensions": [ "bierner.markdown-preview-github-styles", + "charliermarsh.ruff", "github.copilot", "github.vscode-github-actions", "grapecity.gc-excelviewer", "ms-azuretools.vscode-docker", + "ms-python.python", + "ms-python.vscode-pylance", "ms-vscode.powershell", "redhat.vscode-xml", "rust-lang.rust-analyzer", diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7c87d35..a351dab 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,13 @@ { "recommendations": [ "bierner.markdown-preview-github-styles", + "charliermarsh.ruff", "github.copilot", "github.vscode-github-actions", "grapecity.gc-excelviewer", "ms-azuretools.vscode-docker", + "ms-python.python", + "ms-python.vscode-pylance", "ms-vscode.powershell", "redhat.vscode-xml", "rust-lang.rust-analyzer", diff --git a/.vscode/settings.json b/.vscode/settings.json index cebd545..6097912 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,9 @@ "files.exclude": { "**/.git": false, "**/bin": false, - "**/obj": true + "**/obj": true, + "poetry.lock": true, + ".pytest_cache": true }, "git.autofetch": true, @@ -32,6 +34,21 @@ "powershell.integratedConsole.showOnStartup": false, "powershell.suppressAdditionalExeNotFoundWarning": false, + "python.analysis.autoFormatStrings": true, + "python.defaultInterpreterPath": ".venv/bin/python", + "python.languageServer": "Pylance", + "python.testing.pytestEnabled": true, + "python.testing.pytestPath": "pytest", + + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always", + "source.fixAll": "explicit" + } + }, + "terminal.integrated.fontFamily": "'FiraCode Nerd Font Mono', 'Fira Code', Menlo, Monaco, Consolas", "workbench.editor.highlightModifiedTabs": true, diff --git a/bindings/python/__init__.py b/bindings/python/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bindings/python/main.py b/bindings/python/main.py new file mode 100644 index 0000000..f98c750 --- /dev/null +++ b/bindings/python/main.py @@ -0,0 +1 @@ +print('Welcome to Gazelle! 🦌') diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..efa46ec --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bd56767 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ +[tool.poetry] +name = "gazelle" +version = "0.1.0" +readme = "README.md" +description = "A fast engine for civil engineering design." +repository = "https://github.com/gazellekit/gazelle.git" +authors = ["James S. Bayley "] +license = "AGPL-3.0-or-later" +packages = [{ include = "bindings/python" }] + +[tool.poetry.dependencies] +python = ">=3.11" + +[tool.poetry.group.dev.dependencies] +pytest = "^8.0.1" +ruff = "^0.2.2" + +[tool.ruff] +indent-width = 2 + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file