From 956d023aba28cb2dbbcc8d81adcbf92cbcbc16c2 Mon Sep 17 00:00:00 2001 From: mnbf9rca Date: Sat, 4 Nov 2023 10:29:59 +0000 Subject: [PATCH] initial commit --- .devcontainer/devcontainer.json | 35 +++++++++++++++++++++ .env.vault | 26 +++++++++++++++ .github/tests.yml | 56 +++++++++++++++++++++++++++++++++ .gitignore | 6 ++++ pyproject.toml | 15 +++++++++ 5 files changed, 138 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .env.vault create mode 100644 .github/tests.yml create mode 100644 pyproject.toml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..2008c2a --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "image": "mcr.microsoft.com/devcontainers/python:3.10-bullseye", + "features": { + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": { + "version": "4" + }, + "ghcr.io/devcontainers-contrib/features/poetry:2": { + "version": "1.6.1" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "lts" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-azurefunctions", + "ms-vscode.azure-account", + "ms-python.python", + "ms-vscode-remote.vscode-remote-extensionpack", + "GitHub.codespaces", + "ms-azuretools.vscode-azureresourcegroups", + "ms-python.flake8", + "ms-python.black-formatter", + "ms-python.isort", + "GitHub.copilot", + "GitHub.copilot-labs", + "github.vscode-github-actions", + "dotenv.dotenv-vscode" + ] + } + }, + "postAttachCommand": "python3 -m venv venv && source venv/bin/activate && poetry install --with test,dev --no-interaction --no-root --sync" +} \ No newline at end of file diff --git a/.env.vault b/.env.vault new file mode 100644 index 0000000..3b99aa4 --- /dev/null +++ b/.env.vault @@ -0,0 +1,26 @@ +#/-------------------.env.vault---------------------/ +#/ cloud-agnostic vaulting standard / +#/ [how it works](https://dotenv.org/env-vault) / +#/--------------------------------------------------/ + +# +# Hello 👋, +# +# Your environment variables will be encrypted and +# safely stored in this .env.vault file, after you +# run the login, push, and build commands. +# +# Next run: +# +# $ npx dotenv-vault@latest login +# +# +# You can safely commit this file to code. +# +# Enjoy. 🌴 +# + +#/----------------settings/metadata-----------------/ +DOTENV_VAULT="vlt_74a0d969328c24c44288572b0b90e05a3a6f0377d071632083d71c74c28ab188" +DOTENV_API_URL="https://vault.dotenv.org" +DOTENV_CLI="npx dotenv-vault@latest" diff --git a/.github/tests.yml b/.github/tests.yml new file mode 100644 index 0000000..1ad0aac --- /dev/null +++ b/.github/tests.yml @@ -0,0 +1,56 @@ +name: Run pytest + +on: + push: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11"] + + steps: + + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 + with: + python-version: ${{ matrix.python-version }} + + - uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b # v1 + with: + version: 1.6.1 # pin the version as they keep changing their APIs + virtualenvs-create: false + virtualenvs-in-project: false + + - name: Install dependencies + run: | + python -m venv venv + . venv/bin/activate + poetry install --with test --without dev --no-interaction --no-root --sync + echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV + python -c "import os; print(os.environ['VIRTUAL_ENV'])" + + - name: Lint with flake8 + run: | + . venv/bin/activate + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Test with pytest + env: + DOTENV_KEY: ${{ secrets.DOTENV_KEY }} + run: | + . venv/bin/activate + pytest --cov-report=xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 68bc17f..60f5b44 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,9 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +.env* +.flaskenv* +!.env.project +!.env.vault +!.env.example \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..205091d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "ohme-client" +version = "0.1.0" +description = "" +authors = ["mnbf9rca "] +license = "MIT" +readme = "README.md" + +[tool.poetry.dependencies] +python = ">3.9,<3.12" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"