diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..2300915 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,5 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3/.devcontainer/base.Dockerfile + +# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster +ARG VARIANT="3.10-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..684b518 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,45 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3 +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local on arm64/Apple Silicon. + "VARIANT": "3.10-bullseye", + // Options + "NODE_VERSION": "none" + } + }, + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // // Set *default* container specific settings.json values on container create. + // "settings": { + // "python.defaultInterpreterPath": "/home/vscode/venv/bin/python" + // }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "GitHub.vscode-github-actions", + "GitHub.copilot", + "GitHub.copilot-chat" + ] + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + "onCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt", + "postCreateCommand": "sudo -H pip3 install -r requirements.txt" // alternatively, `pip3 install --user -r requirements.txt` + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode", + // "features": { + // "azure-cli": "latest" + // } +} \ No newline at end of file diff --git a/.devcontainer/welcome.txt b/.devcontainer/welcome.txt new file mode 100644 index 0000000..8921939 --- /dev/null +++ b/.devcontainer/welcome.txt @@ -0,0 +1,5 @@ +👋 Welcome to Codespaces! Wait a few seconds for the Python requirements to install. + +📝 In the meantime, begin following the instructions in the README. + +🤔 If you have questions, use the GitHub Copilot "Chat" extension along the left panel (note: you may need to click the ellipses (...) to see the extension) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..763a95f --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + pull_request: + branches: [ "main" ] + # Allow mannually trigger + workflow_dispatch: + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Build the Codespaces container image + run: docker build . --file .devcontainer/Dockerfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ded053 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +**/__pycache__/ +.pytest_cache/ +*.pyc +.coverage +*.egg-info/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..948a236 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1f2b0f4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "python.testing.pytestArgs": [ + "." + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "githubPullRequests.ignoredPullRequestBranches": [ + "main" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..988a477 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# + + + +## Overview + + + +## Setup command + +See `postCreateCommand` from [`devcontainer.json`](.devcontainer/devcontainer.json). + +## Run command +`pytest` + +## Notes +- pip's install path is not included in the PATH var by default, so without installing via `sudo -H`, pytest would be unaccessible. diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..a025bbf --- /dev/null +++ b/hello.py @@ -0,0 +1,2 @@ +def hello_world(): + return "Hello!" diff --git a/hello_test.py b/hello_test.py new file mode 100644 index 0000000..708a061 --- /dev/null +++ b/hello_test.py @@ -0,0 +1,5 @@ +import hello + + +def test_hello(): + assert hello.hello_world() == "Hello World!" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c953815 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[build-system] +requires = ["setuptools", "wheel"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..097a011 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +-e . # package from this repo +# numpy +# scipy +# pandas +# matplotlib +# matplotlib-inline +# ipython +# ipykernel +pytest diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..cc93fb7 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,11 @@ +[metadata] +name = helper_functions +version = 0.1 + +[options] +packages = find: +package_dir = + =src + +[options.packages.find] +where=src \ No newline at end of file diff --git a/src/mock1/__init__.py b/src/mock1/__init__.py new file mode 100644 index 0000000..d98cc4b --- /dev/null +++ b/src/mock1/__init__.py @@ -0,0 +1,2 @@ +"""Mock function that gets installed by requirements.txt""" +from mock1._mock1 import Mock1 diff --git a/src/mock1/_mock1.py b/src/mock1/_mock1.py new file mode 100644 index 0000000..43f32d9 --- /dev/null +++ b/src/mock1/_mock1.py @@ -0,0 +1,6 @@ +class Mock1: + def __init__(self): + pass + + def mock(self): + print("this is a mock function") diff --git a/src/mock2/__init__.py b/src/mock2/__init__.py new file mode 100644 index 0000000..9d29bf3 --- /dev/null +++ b/src/mock2/__init__.py @@ -0,0 +1,2 @@ +"""Mock function that gets installed by requirements.txt""" +from mock2._mock2 import Mock2 diff --git a/src/mock2/_mock2.py b/src/mock2/_mock2.py new file mode 100644 index 0000000..f5b7725 --- /dev/null +++ b/src/mock2/_mock2.py @@ -0,0 +1,6 @@ +class Mock2: + def __init__(self): + pass + + def mock(self): + print("this is a mock function")