Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.13-bookworm

RUN apt-get update -y \
&& export DEBIAN_FRONTEND=noninteractive
61 changes: 61 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers-extra/features/curl-apt-get:1": {}
},
"customizations": {
"settings": {
"files.eol": "\n",
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--config", "./pyproject.toml"],
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": ["--config=./pyproject.toml"],
"python.linting.mypyEnabled": true,
"python.analysis.extraPaths": [
"./src"
],
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"terminal.integrated.defaultProfile.linux": "bash",
"workbench.iconTheme": "vscode-icons",
"workbench.colorTheme": "Visual Studio Dark",
"remote.extensionKind": {
"ms-azuretools.vscode-docker": "workspace"
}
},
"vscode": {
"extensions": [
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"Gruntfuggly.todo-tree",
"hashicorp.terraform",
"ms-azuretools.vscode-docker",
"ms-python.debugpy",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.mypy",
"streetsidesoftware.code-spell-checker",
"vscode-icons-team.vscode-icons"
]
}
},
"postCreateCommand": ".devcontainer/scripts/postCreate.sh",
"remoteUser": "root",
"workspaceFolder": "/workspaces/test",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/test,type=bind,consistency=cached"
}
58 changes: 58 additions & 0 deletions .devcontainer/scripts/postCreate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e # Exit immediately if a command exits with a non-zero status

# Display system information
echo "System Information:"
uname -a

# Install Poetry
echo "Installing Poetry..."
if ! command -v poetry &> /dev/null; then
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
else
echo "Poetry is already installed."
fi

# Verify Poetry installation
if ! command -v poetry &> /dev/null; then
echo "Error: Poetry installation failed."
exit 1
fi

# Configure Poetry to create virtual environments inside the project
poetry config virtualenvs.in-project true

# Install dependencies via Poetry
echo "Installing dependencies with Poetry..."
poetry install --with dev

# Ensure PYTHONPATH is set in the current session and persists across sessions
PYTHONPATH_ENTRY="/workspaces/test/src"
if ! grep -Fxq "export PYTHONPATH=$PYTHONPATH_ENTRY:\$PYTHONPATH" ~/.bashrc; then
echo "Configuring PYTHONPATH..."
echo "export PYTHONPATH=$PYTHONPATH_ENTRY:\$PYTHONPATH" >> ~/.bashrc
fi

# Add the Poetry virtual environment's `bin` directory to PATH
VENV_BIN_PATH="/workspaces/test/.venv/bin"
if ! grep -Fxq "export PATH=$VENV_BIN_PATH:\$PATH" ~/.bashrc; then
echo "Adding Poetry virtual environment to PATH..."
echo "export PATH=$VENV_BIN_PATH:\$PATH" >> ~/.bashrc
fi

# Load the updated bashrc configuration for the current session
source ~/.bashrc

# Validate that validate-devschema is accessible
echo "Validating script installation..."
if ! validate-devschema --help &> /dev/null; then
echo "Error: validate-devschema script is not globally accessible."
exit 1
else
echo "validate-devschema is installed and ready to use."
fi

# Display completion message
echo "Development container setup complete!"
11 changes: 11 additions & 0 deletions .github/workflows/commitmsg-conform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: commit-message-conformance
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
commitmsg-conform:
uses: jdevto/actions/.github/workflows/commitmsg-conform.yml@main
11 changes: 11 additions & 0 deletions .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: markdown-lint
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
markdown-lint:
uses: jdevto/actions/.github/workflows/markdown-lint.yml@main
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"recommendations": [
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"Gruntfuggly.todo-tree",
"hashicorp.terraform",
"ms-azuretools.vscode-docker",
"ms-python.autopep8",
"ms-python.debugpy",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.flake8",
"streetsidesoftware.code-spell-checker",
"vscode-icons-team.vscode-icons"
]
}
27 changes: 27 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--config", "./pyproject.toml"],
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.flake8Args": ["--config=./pyproject.toml"],
"python.analysis.extraPaths": [
"./src"
],
"python.pythonPath": "/workspaces/test/.venv/bin/python",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"prettier.requireConfig": true,
"workbench.iconTheme": "vscode-icons",
"workbench.colorTheme": "Visual Studio Dark"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# python-poetry-hello
# python-poetry-hello
11 changes: 11 additions & 0 deletions commitmsg-conform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: commit-message-conformance
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
commitmsg-conform:
uses: actionsforge/actions/.github/workflows/commitmsg-conform.yml@main
Empty file added hello-world/README.md
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions hello-world/hello_world/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# hello_world/main.py
def main():
print("Hello, World!")


if __name__ == "__main__":
main()
6 changes: 6 additions & 0 deletions hello-world/hello_world/tests/test_hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def test_main(capsys):
from hello_world.main import main

main()
captured = capsys.readouterr()
assert captured.out == "Hello, World!\n"
7 changes: 7 additions & 0 deletions hello-world/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions hello-world/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[project]
name = "hello-world"
version = "0.1.0"
description = ""
authors = [
{name = "Your Name",email = "you@example.com"}
]
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
]


[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
hello-world = "hello_world.main:main"
Empty file added hello-world/tests/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: markdown-lint
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
markdown-lint:
uses: actionsforge/actions/.github/workflows/markdown-lint.yml@main
Loading