Skip to content

Commit 8bd4fea

Browse files
Initial commit
0 parents  commit 8bd4fea

29 files changed

+3379
-0
lines changed

.github/workflows/build_docs.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Install Python
15+
uses: actions/setup-python@v4
16+
- name: Setup pandoc
17+
run: |
18+
wget https://github.com/jgm/pandoc/releases/download/2.18/pandoc-2.18-1-amd64.deb && sudo dpkg -i pandoc-2.18-1-amd64.deb
19+
sudo apt-get install pandoc-citeproc
20+
- name: Install poetry
21+
uses: abatilo/actions-poetry@v2
22+
- name: Setup a local virtual environment (if no poetry.toml file)
23+
run: |
24+
poetry config virtualenvs.create true --local
25+
poetry config virtualenvs.in-project true --local
26+
- uses: actions/cache@v3
27+
name: Define a cache for the virtual environment based on the dependencies lock file
28+
with:
29+
path: ./.venv
30+
key: venv-${{ hashFiles('poetry.lock') }}
31+
- name: Install the project dependencies
32+
run: poetry install
33+
34+
- name: Build docs
35+
run: poetry run mkdocs gh-deploy --force

.github/workflows/python-publish.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
environment: publish
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
- name: Build package
34+
run: python -m build
35+
- name: Publish package
36+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
ci:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11"]
15+
poetry-version: ["1.7"]
16+
# os: [ubuntu-latest, macos-latest, windows-latest]
17+
os: [ubuntu-latest]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Install Python
22+
uses: actions/setup-python@v4
23+
# see details (matrix, python-version, python-version-file, etc.)
24+
# https://github.com/actions/setup-python
25+
- name: Install poetry
26+
uses: abatilo/actions-poetry@v2
27+
- name: Setup a local virtual environment (if no poetry.toml file)
28+
run: |
29+
poetry config virtualenvs.create true --local
30+
poetry config virtualenvs.in-project true --local
31+
- uses: actions/cache@v3
32+
name: Define a cache for the virtual environment based on the dependencies lock file
33+
with:
34+
path: ./.venv
35+
key: venv-${{ hashFiles('poetry.lock') }}
36+
- name: Install the project dependencies
37+
run: poetry install
38+
39+
- name: Run tests and generate coverage report
40+
run: poetry run pytest --doctest-modules -v --cov=mppt --cov-fail-under 90 --cov-report=term --cov-report=xml --cov-report=html
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v3
44+
if: success() && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}
47+
files: ./coverage.xml
48+
fail_ci_if_error: true
49+
verbose: true

.gitignore

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# ide cache
2+
.vscode
3+
.idea
4+
5+
6+
7+
# Byte-compiled / optimized / DLL files
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
12+
# C extensions
13+
*.so
14+
15+
# Distribution / packaging
16+
.Python
17+
build/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
lib/
24+
lib64/
25+
parts/
26+
sdist/
27+
var/
28+
wheels/
29+
share/python-wheels/
30+
*.egg-info/
31+
.installed.cfg
32+
*.egg
33+
MANIFEST
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.nox/
49+
.coverage
50+
.coverage.*
51+
.cache
52+
nosetests.xml
53+
coverage.xml
54+
*.cover
55+
*.py,cover
56+
.hypothesis/
57+
.pytest_cache/
58+
cover/
59+
60+
# Translations
61+
*.mo
62+
*.pot
63+
64+
# Django stuff:
65+
*.log
66+
local_settings.py
67+
db.sqlite3
68+
db.sqlite3-journal
69+
70+
# Flask stuff:
71+
instance/
72+
.webassets-cache
73+
74+
# Scrapy stuff:
75+
.scrapy
76+
77+
# Sphinx documentation
78+
docs/_build/
79+
80+
# PyBuilder
81+
.pybuilder/
82+
target/
83+
84+
# Jupyter Notebook
85+
.ipynb_checkpoints
86+
87+
# IPython
88+
profile_default/
89+
ipython_config.py
90+
91+
# pyenv
92+
# For a library or package, you might want to ignore these files since the code is
93+
# intended to run in multiple environments; otherwise, check them in:
94+
# .python-version
95+
96+
# pipenv
97+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
99+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
100+
# install all needed dependencies.
101+
#Pipfile.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/#use-with-ide
116+
.pdm.toml
117+
118+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
119+
__pypackages__/
120+
121+
# Celery stuff
122+
celerybeat-schedule
123+
celerybeat.pid
124+
125+
# SageMath parsed files
126+
*.sage.py
127+
128+
# Environments
129+
.env
130+
.venv
131+
env/
132+
venv/
133+
ENV/
134+
env.bak/
135+
venv.bak/
136+
137+
# Spyder project settings
138+
.spyderproject
139+
.spyproject
140+
141+
# Rope project settings
142+
.ropeproject
143+
144+
# mkdocs documentation
145+
/site
146+
147+
# mypy
148+
.mypy_cache/
149+
.dmypy.json
150+
dmypy.json
151+
152+
# Pyre type checker
153+
.pyre/
154+
155+
# pytype static type analyzer
156+
.pytype/
157+
158+
# Cython debug symbols
159+
cython_debug/
160+
161+
# PyCharm
162+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164+
# and can be added to the global gitignore or merged into this file. For a more nuclear
165+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
166+
#.idea/

.pre-commit-config.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
exclude: .+\.csv
10+
- id: mixed-line-ending
11+
args: [--fix=lf]
12+
- repo: https://github.com/psf/black
13+
rev: 24.2.0
14+
hooks:
15+
- id: black
16+
- repo: https://github.com/pycqa/isort
17+
rev: 5.13.2
18+
hooks:
19+
- id: isort
20+
args: ["--profile", "black", "--filter-files"]
21+
- repo: https://github.com/pycqa/flake8
22+
rev: 7.0.0
23+
hooks:
24+
- id: flake8
25+
- repo: https://github.com/astral-sh/ruff-pre-commit
26+
# Ruff version.
27+
rev: v0.3.2
28+
hooks:
29+
# Run the linter.
30+
- id: ruff
31+
# Run the formatter.
32+
- id: ruff-format
33+
- repo: https://github.com/pre-commit/mirrors-mypy
34+
rev: v1.9.0 # Use the sha / tag you want to point at
35+
hooks:
36+
- id: mypy
37+
args: ["--install-types", "--non-interactive", "--ignore-missing-imports", "--check-untyped-defs"]

CHANGELOG.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Changelog
2+
3+
4+
## [Unreleased]
5+
6+
### Added
7+
- Add Locust as a load testing tool (#39)
8+
- Add package management tool uv (#49)
9+
- Add task runner just (#50)
10+
11+
## [0.3.0] - 2023-12-14
12+
13+
### Added
14+
- Add ruff as extra linter and formatter: both in dependency and pre-commit (#31)
15+
- Add more details about the linters and formatters with the resource from Google SRE book
16+
- Add doctest (#34)
17+
18+
## [0.2.0] - 2023-12-01
19+
20+
### Added
21+
- Documentations for all the features (#20)
22+
- Quick sort implementation for hypothesis testing (#22)
23+
24+
### Changed
25+
- Change package management from Rye to Poetry (#15, #19)
26+
27+
### Removed
28+
- Sweep AI App
29+
30+
## [0.1.1] - 2023-08-15
31+
32+
### Changed
33+
- reorg this package template
34+
35+
## [0.1.0] - 2023-08-15
36+
37+
### Added
38+
- add this package template

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Mathew Shen
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)