-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from devsetgo/dev
Adding DevSetGo Library Examples
- Loading branch information
Showing
23 changed files
with
201,217 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# [Optional] If your requirements rarely change, uncomment this section to add them to the image. | ||
# COPY requirements.txt /tmp/pip-tmp/ | ||
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ | ||
# && rm -rf /tmp/pip-tmp | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/postgres | ||
{ | ||
"name": "Examples", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "app", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"features": { | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"nodeGypDependencies": true, | ||
"version": "18" | ||
}, | ||
"ghcr.io/devcontainers-contrib/features/vue-cli:2": { | ||
"version": "latest" | ||
} | ||
}, | ||
|
||
// 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. | ||
// This can be used to network with other containers or the host. | ||
"forwardPorts": [5000, 5432, 32080], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "pip3 install --upgrade pip setuptools wheel && pip3 install -r requirements.txt", //--use-deprecated=legacy-resolver", | ||
// "postStartCommand": "pip install -r requirements.txt", // Add this line to install requirements.txt after container start | ||
// 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": "/usr/local/bin/python", | ||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", | ||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black", | ||
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", | ||
"python.testing.pytestPath": "/usr/local/py-utils/bin/pytest" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
// "usernamehw.errorlens", | ||
"charliermarsh.ruff", | ||
"streetsidesoftware.code-spell-checker", | ||
"GitHub.copilot", | ||
"GitHub.copilot-chat", | ||
"ms-vscode.cpptools-extension-pack", | ||
"ms-vscode.cpptools", | ||
"aaron-bond.better-comments", | ||
"alefragnani.project-manager", | ||
"bungcip.better-toml", | ||
"dbaeumer.vscode-eslint", | ||
"DavidAnson.vscode-markdownlint", | ||
"DotJoshJohnson.xml", | ||
"donjayamanne.githistory", | ||
"ecmel.vscode-html-css", | ||
"esbenp.prettier-vscode", | ||
"george-alisson.html-preview-vscode", | ||
"genieai.chatgpt-vscode", | ||
"Gruntfuggly.todo-tree", | ||
"hnw.vscode-auto-open-markdown-preview", | ||
"kamikillerto.vscode-colorize", | ||
"mikestead.dotenv", | ||
"ms-python.isort", | ||
"ms-python.pylint", | ||
"ms-python.python", | ||
"ms-toolsai.jupyter", | ||
"ms-toolsai.jupyter-keymap", | ||
"ms-vscode.makefile-tools", | ||
"njpwerner.autodocstring", | ||
"oderwat.indent-rainbow", | ||
"peakchen90.open-html-in-browser", | ||
"pnp.polacode", | ||
"redhat.vscode-yaml", | ||
"streetsidesoftware.code-spell-checker", | ||
"Vue.volar", | ||
"waderyan.gitblame", | ||
"wayou.vscode-todo-highlight", | ||
"wholroyd.jinja", | ||
"wix.vscode-import-cost", | ||
"GrapeCity.gc-excelviewer", | ||
"supperchong.pretty-json", | ||
"ms-azuretools.vscode-docker", | ||
"ms-kubernetes-tools.vscode-kubernetes-tools", | ||
"ms-vsliveshare.vsliveshare", | ||
"ms-python.black-formatter" | ||
] | ||
} | ||
}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
volumes: | ||
- ../..:/workspaces:cached | ||
command: sleep infinity | ||
networks: | ||
- app-network | ||
|
||
|
||
networks: | ||
app-network: | ||
driver: bridge | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
name: Latest Changes | ||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
types: | ||
- closed | ||
jobs: | ||
latest-changes: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- uses: tiangolo/latest-changes@main | ||
with: | ||
token: ${{ secrets.RELEASE_NOTES }} | ||
latest_changes_file: ./docs/release-notes.md | ||
latest_changes_header: '# Release Notes\n\n' | ||
# template_file: ./.github/workflows/release-notes.jinja2 | ||
debug_logs: true | ||
# name: Latest Changes | ||
# on: | ||
# pull_request_target: | ||
# branches: | ||
# - main | ||
# types: | ||
# - closed | ||
# jobs: | ||
# latest-changes: | ||
# if: github.event.pull_request.merged == true | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Dump GitHub context | ||
# env: | ||
# GITHUB_CONTEXT: ${{ toJson(github) }} | ||
# run: echo "$GITHUB_CONTEXT" | ||
# - uses: tiangolo/latest-changes@main | ||
# with: | ||
# token: ${{ secrets.RELEASE_NOTES }} | ||
# latest_changes_file: ./docs/release-notes.md | ||
# latest_changes_header: '# Release Notes\n\n' | ||
# # template_file: ./.github/workflows/release-notes.jinja2 | ||
# debug_logs: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Author: Mike Ryan | ||
Date: 2024/05/16 | ||
License: MIT | ||
""" | ||
from dsg_lib.common_functions import calendar_functions | ||
|
||
month_list: list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | ||
month_names: list = [ | ||
"january", | ||
"february", | ||
"march", | ||
"april", | ||
"may", | ||
"june", | ||
"july", | ||
"august", | ||
"september", | ||
"october", | ||
"november", | ||
"december", | ||
"bob", | ||
] | ||
|
||
|
||
def calendar_check_number(): | ||
for i in month_list: | ||
month = calendar_functions.get_month(month=i) | ||
print(month) | ||
|
||
|
||
def calendar_check_name(): | ||
for i in month_names: | ||
month = calendar_functions.get_month_number(month_name=i) | ||
print(month) | ||
|
||
|
||
if __name__ == "__main__": | ||
calendar_check_number() | ||
calendar_check_name() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Author: Mike Ryan | ||
Date: 2024/05/16 | ||
License: MIT | ||
""" | ||
from dsg_lib.common_functions.file_functions import create_sample_files, open_csv, save_csv | ||
from dsg_lib.common_functions.logging_config import config_log | ||
|
||
config_log(logging_level="DEBUG") | ||
|
||
example_list = [ | ||
["thing_one", "thing_two"], | ||
["a", "b"], | ||
["c", "d"], | ||
["e", "f"], | ||
["g", "h"], | ||
] | ||
|
||
|
||
def save_some_data(example_list: list): | ||
# function requires file_name and data list to be sent. | ||
# see documentation for additonal information | ||
save_csv( | ||
file_name="your-file-name.csv", | ||
data=example_list, | ||
root_folder="/data", | ||
delimiter="|", | ||
quotechar='"', | ||
) | ||
|
||
|
||
def open_some_data(the_file_name: str) -> dict: | ||
""" | ||
function requires file_name and a dictionary will be returned | ||
this function is designed with the idea that the CSV file has a header row. | ||
see documentation for additonal information | ||
options | ||
file_name: str | "myfile.csv" | ||
delimit: str | example - ":" single character only inside quotes | ||
quote_level:str | ["none","non-numeric","minimal","all"] default is minimal | ||
skip_initial_space:bool | default is True | ||
See Python documentation as needed https://docs.python.org/3/library/csv.html | ||
""" | ||
|
||
result: dict = open_csv(file_name=the_file_name) | ||
return result | ||
|
||
|
||
def sample_files(): | ||
filename = "test_sample" | ||
samplesize = 1000 | ||
create_sample_files(filename, samplesize) | ||
|
||
|
||
if __name__ == "__main__": | ||
# save_some_data(example_list) | ||
# opened_file: dict = open_some_data("your-file-name.csv") | ||
# print(opened_file) | ||
sample_files() |
Oops, something went wrong.