Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-classroom[bot] authored Mar 28, 2024
0 parents commit eae2e26
Show file tree
Hide file tree
Showing 17 changed files with 166 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}
45 changes: 45 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
// }
}
5 changes: 5 additions & 0 deletions .devcontainer/welcome.txt
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/__pycache__/
.pytest_cache/
*.pyc
.coverage
*.egg-info/
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"python.testing.pytestArgs": [
"."
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# <Your Project Name>

<Short description of your project>

## Overview

<Long description of your project>

## 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.
2 changes: 2 additions & 0 deletions hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def hello_world():
return "Hello!"
5 changes: 5 additions & 0 deletions hello_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import hello


def test_hello():
assert hello.hello_world() == "Hello World!"
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel"]
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-e . # package from this repo
# numpy
# scipy
# pandas
# matplotlib
# matplotlib-inline
# ipython
# ipykernel
pytest
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[metadata]
name = helper_functions
version = 0.1

[options]
packages = find:
package_dir =
=src

[options.packages.find]
where=src
2 changes: 2 additions & 0 deletions src/mock1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Mock function that gets installed by requirements.txt"""
from mock1._mock1 import Mock1
6 changes: 6 additions & 0 deletions src/mock1/_mock1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Mock1:
def __init__(self):
pass

def mock(self):
print("this is a mock function")
2 changes: 2 additions & 0 deletions src/mock2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Mock function that gets installed by requirements.txt"""
from mock2._mock2 import Mock2
6 changes: 6 additions & 0 deletions src/mock2/_mock2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Mock2:
def __init__(self):
pass

def mock(self):
print("this is a mock function")

0 comments on commit eae2e26

Please sign in to comment.