-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hollanbm/poetry-devcontainer
Add Poetry, Devcontainer, Ruff Linter
- Loading branch information
Showing
12 changed files
with
1,316 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ARG PYTHON_VERSION=3.9 | ||
FROM mcr.microsoft.com/devcontainers/python:${PYTHON_VERSION} | ||
|
||
USER root | ||
|
||
RUN apt-get update -y -qq && \ | ||
apt-get dist-upgrade -y -qq && \ | ||
apt-get autoremove -y -qq | ||
|
||
# git safe directories | ||
RUN git config --global --add safe.directory "*" | ||
|
||
RUN apt-get -y -qq install \ | ||
fzf \ | ||
jq \ | ||
yq \ | ||
zsh | ||
|
||
RUN pip install pipx | ||
RUN pipx --global ensurepath | ||
RUN pipx --global install poetry==1.8.3 ruff pre-commit | ||
|
||
USER vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json", | ||
"name": "imdb-to-overseerr devContainer", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { | ||
"plugins": "git poetry poetry-env zsh-autosuggestions zsh-syntax-highlighting", | ||
"omzPlugins": "https://github.com/zsh-users/zsh-syntax-highlighting https://github.com/zsh-users/zsh-autosuggestions" | ||
}, | ||
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {} | ||
}, | ||
"containerEnv": { | ||
"POETRY_VIRTUALENVS_IN_PROJECT": "1", | ||
"POETRY_VIRTUALENVS_CREATE": "true" | ||
}, | ||
"mounts": [], | ||
"postCreateCommand": "zsh .devcontainer/postCreateCommand.sh", | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"editor.formatOnSave": false, | ||
"editor.tabSize": 2, | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/bin/zsh" | ||
} | ||
}, | ||
"files": { | ||
"eol": "\n", | ||
"trimTrailingWhitespace": true, | ||
"trimTrailingWhitespaceInRegexAndStrings": true, | ||
"insertFinalNewline": true | ||
}, | ||
"[python]": { | ||
"editor.formatOnSave": false, | ||
"editor.tabSize": 4, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "explicit" | ||
}, | ||
"editor.defaultFormatter": "charliermarsh.ruff" | ||
}, | ||
"python": { | ||
"terminal": { | ||
"activateEnvironment": false | ||
}, | ||
"analysis": { | ||
"autoFormatStrings": true, | ||
"defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python", | ||
"extraPaths": [] | ||
} | ||
} | ||
}, | ||
"extensions": [ | ||
"charliermarsh.ruff", | ||
"KevinRose.vsc-python-indent", | ||
"ms-python.debugpy", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"mutantdino.resourcemonitor", | ||
"njpwerner.autodocstring", | ||
"njqdev.vscode-python-typehint", | ||
"oderwat.indent-rainbow", | ||
"redhat.vscode-yaml", | ||
"VisualStudioExptTeam.vscodeintellicode" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/zsh | ||
|
||
git config --global --add safe.directory "*" | ||
|
||
poetry install --no-interaction --no-ansi --quiet | ||
|
||
# activate venv | ||
source $(poetry env info --path)/bin/activate | ||
|
||
# setup pre-commit hook | ||
pre-commit install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Python package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
python-ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
#---------------------------------------------- | ||
# check-out repo and set-up python | ||
#---------------------------------------------- | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
architecture: "x64" | ||
|
||
#---------------------------------------------- | ||
# install & configure poetry | ||
#---------------------------------------------- | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
#---------------------------------------------- | ||
# install dependencies if cache does not exist | ||
#---------------------------------------------- | ||
- name: Install dependencies | ||
run: poetry install --no-interaction --no-root | ||
|
||
#---------------------------------------------- | ||
# Permanent venv activation | ||
#---------------------------------------------- | ||
- name: Activate virtualenv | ||
run: | | ||
source .venv/bin/activate | ||
echo PATH=$PATH >> $GITHUB_ENV | ||
#---------------------------------------------- | ||
# run test suite and output coverage file | ||
#---------------------------------------------- | ||
# - name: Test with pytest | ||
# run: | | ||
# pytest --cov-branch --cov=src --cov-report=xml tests | ||
|
||
#---------------------------------------------- | ||
# lint and formatting | ||
#---------------------------------------------- | ||
- name: Lint with Ruff | ||
run: | | ||
ruff check --output-format=github . |
Oops, something went wrong.