Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/devcontainers/templates/tree/main/src/python
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/black:2": {},
"ghcr.io/devcontainers-contrib/features/pylint:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install --user -r requirements.txt",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"github.vscode-github-actions",
"GitHub.vscode-pull-request-github",
"ms-python.black-formatter",
"ms-python.isort",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.test-adapter-converter",
"njpwerner.autodocstring",
"oderwat.indent-rainbow",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Empty file added .github/workflows/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions .github/workflows/complete_action_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Create Pull Request for Release branches without Error when it already exists

on:
push:
branches:
- release/*
workflow_dispatch:

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Pull Request
run: |
echo $GITHUB_REF_NAME
pr_list=$(gh pr list --head $GITHUB_REF_NAME --json number --jq '.[] |
21 changes: 21 additions & 0 deletions .github/workflows/create_release_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Create Pull Request for Release Branch

on:
push:
branches:
- release/* #looks for branch beginnign with "release" (reg ex)
workflow_dispatch:

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with: # with option - way to pass arguments to pre-action, like passing arguments to py/R
fetch-depth: 0
- name: Create Pull Request #pointin to live branch (not develop branch)
run:
gh pr create --fill --draft --base live # github actions
env: # intitialse and interact with this
GH_TOKEN: ${{ github.token }}
12 changes: 12 additions & 0 deletions .github/workflows/hello-world.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: say Hello World! #nmae of workflow

on:
workflow_dispatch:

jobs:
hello-world: #name of job
runs-on: ubuntu-latest
steps: #what will the job actaully do
- name: Print Hello World #list with "-"
run: echo Hello World # what the job code is,
#add 2 spaces before the run
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# 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/

# VSCode specific settings
.vscode/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Joe Wilson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
This is our main python script file. This defines our functions and runs the code. Nothing fancy!
"""


def example_add(num_1: int | float, num_2: int | float) -> int | float:
"""
Adds two numbers together.

Parameters
----------
num_1 : int | float
First number you want to add together.
num_2 : int | float
Second number you want to add together

Returns
-------
int | float
Sum of num_1 and num_2
"""
return num_1 + num_2

# TODO - Implement function and tests
def example_bad_add(num_1: int | float, num_2: int | float) -> int | float:
"""
Badly adds two numbers together.

Parameters
----------
num_1 : int | float
First number you want to add together.
num_2 : int | float
Second number you want to add together

Returns
-------
int | float
Sum of num_1 and num_2... and + 1
"""
return num_1 + num_2 + 1
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
black==23.9.1
click==8.1.7
iniconfig==2.0.0
mypy-extensions==1.0.0
packaging==23.1
pathspec==0.11.2
platformdirs==3.10.0
pluggy==1.3.0
pytest==7.4.2
43 changes: 43 additions & 0 deletions test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
Tests for main.py
"""

import pytest

import main


@pytest.mark.parametrize(
["num_1", "num_2", "expected"],
[
(0, 0, 0),
(1, 1, 2),
(1, -1, 0),
(0.1, 0.1, 0.2),
]
)
def test_example_add(num_1, num_2, expected):
"""
Tests main.example_add
"""
actual = main.example_add(num_1, num_2)

assert actual==expected


@pytest.mark.parametrize(
["num_1", "num_2", "expected"],
[
(0, 0, 0),
(1, 1, 2),
(1, -1, 0),
(0.1, 0.1, 0.2),
]
)
def test_example_bad_add(num_1, num_2, expected):
"""
Tests main.example_bad_add
"""
actual = main.example_bad_add(num_1, num_2)

assert actual==expected