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 29, 2024
0 parents commit 11df2e1
Show file tree
Hide file tree
Showing 19 changed files with 165 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": "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 get stuck, refer to the walkthrough video or use the GitHub Copilot Chat extension on the left sidebar.
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"
]
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Intro to GitHub Classroom
This example project is written in Python, and tested with [pytest](https://www.python.org/).

## The assignment

The test in [`hello_test.py`](hello_test.py) is failing right now because the function in [`hello.py`](hello.py) isn't outputting the correct string. Fix this function and run the `pytest` command in the terminal to make the tests green.

Next, open the "Source Control" button on the left sidebar, write a commit message, and commit and push your changes to GitHub.

![](commit-and-push.gif)

After committing and pushing your changes, the autograder will run your tests and give you a grade. To check your autograded scores, click on the GitHub Actions extension on the left sidebar, click the refresh button at the top-right corner of the sidebar, hover over the latest workflow run, and click the globe icon 🌐. Next, click the "Autograding" job button, click the dropdown for the "Run education/autograding" step, and scroll down to see your grade.

![](github-actions-extension.gif)

▶️ If you get stuck, refer to [the walkthrough video](https://github.com/AC-Classroom/intro-github-classroom/assets/45469701/93760bf7-0d27-49dc-8f66-7d50d428677f).
Binary file added commit-and-push.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added github-actions-extension.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 11df2e1

Please sign in to comment.