-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(logger): Add initial version of logger with boilerplate (#1)
- Loading branch information
1 parent
bb3fe6e
commit 805ec82
Showing
32 changed files
with
1,379 additions
and
2 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,28 @@ | ||
# .coveragerc to control coverage.py | ||
[run] | ||
branch = True | ||
source = safe_security_logger | ||
# omit = bad_file.py | ||
|
||
[paths] | ||
source = | ||
src/ | ||
*/site-packages/ | ||
|
||
[report] | ||
# Regexes for lines to exclude from consideration | ||
exclude_lines = | ||
# Have to re-enable the standard pragma | ||
pragma: no cover | ||
|
||
# Don't complain about missing debug-only code: | ||
def __repr__ | ||
if self\.debug | ||
|
||
# Don't complain if tests don't hit defensive assertion code: | ||
raise AssertionError | ||
raise NotImplementedError | ||
|
||
# Don't complain if non-runnable code isn't run: | ||
if 0: | ||
if __name__ == .__main__.: |
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,5 @@ | ||
[tool] | ||
[tool.commitizen] | ||
name = "cz_conventional_commits" | ||
version = "0.1.3" | ||
tag_format = "v$version" |
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,76 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: # Run in every PR | ||
workflow_dispatch: # Allow manually triggering the workflow | ||
schedule: | ||
# Run roughly every 15 days at 00:00 UTC | ||
# (useful to check if updates on dependencies break the package) | ||
- cron: "0 0 1,16 * *" | ||
|
||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ github.ref_type }}- | ||
${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: { fetch-depth: 0 } # deep clone for setuptools-scm | ||
- uses: actions/setup-python@v4 | ||
with: { python-version: "3.10" } | ||
- name: Run static analysis and format checkers | ||
run: pipx run pre-commit run --all-files --show-diff-on-failure | ||
- name: Build package distribution files | ||
run: pipx run tox -e clean,build | ||
- name: Record the path of wheel distribution | ||
id: wheel-distribution | ||
run: echo "::set-output name=path::$(ls dist/*.whl)" | ||
- name: Store the distribution files for use in other stages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-distribution-files | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
test: | ||
needs: prepare | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.7" # oldest Python supported by PSF | ||
- "3.10" # newest Python that is stable | ||
platform: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Retrieve pre-built distribution files | ||
uses: actions/download-artifact@v3 | ||
with: { name: python-distribution-files, path: dist/ } | ||
- name: Run tests | ||
run: >- | ||
pipx run tox | ||
--installpkg '${{ needs.prepare.outputs.wheel-distribution }}' | ||
-- -rFEx --durations 10 --color yes | ||
- name: Generate coverage report | ||
run: pipx run coverage lcov -o coverage.lcov | ||
- name: Upload partial coverage report | ||
uses: coverallsapp/github-action@master | ||
with: | ||
path-to-lcov: coverage.lcov | ||
github-token: ${{ secrets.github_token }} | ||
flag-name: ${{ matrix.platform }} - py${{ matrix.python }} | ||
parallel: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: publish | ||
|
||
on: | ||
push: | ||
# Trigger only on a new tag | ||
tags: ["v[0-9]*", "[0-9]+.[0-9]+*"] # Match tags that resemble a version | ||
|
||
concurrency: | ||
group: >- | ||
${{ github.workflow }}-${{ github.ref_type }}- | ||
${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: { fetch-depth: 0 } # deep clone for setuptools-scm | ||
- uses: actions/setup-python@v4 | ||
with: { python-version: "3.10" } | ||
- name: Run static analysis and format checkers | ||
run: pipx run pre-commit run --all-files --show-diff-on-failure | ||
- name: Build package distribution files | ||
run: pipx run tox -e clean,build | ||
- name: Record the path of wheel distribution | ||
id: wheel-distribution | ||
run: echo "::set-output name=path::$(ls dist/*.whl)" | ||
- name: Store the distribution files for use in other stages | ||
# `tests` and `publish` will use the same pre-built distributions, | ||
# so we make sure to release the exact same package that was tested | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-distribution-files | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
test: | ||
needs: prepare | ||
strategy: | ||
matrix: | ||
python: | ||
- "3.7" # oldest Python supported by PSF | ||
- "3.10" # newest Python that is stable | ||
platform: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Retrieve pre-built distribution files | ||
uses: actions/download-artifact@v3 | ||
with: { name: python-distribution-files, path: dist/ } | ||
- name: Run tests | ||
run: >- | ||
pipx run tox | ||
--installpkg '${{ needs.prepare.outputs.wheel-distribution }}' | ||
-- -rFEx --durations 10 --color yes | ||
- name: Generate coverage report | ||
run: pipx run coverage lcov -o coverage.lcov | ||
- name: Upload partial coverage report | ||
uses: coverallsapp/github-action@master | ||
with: | ||
path-to-lcov: coverage.lcov | ||
github-token: ${{ secrets.github_token }} | ||
flag-name: ${{ matrix.platform }} - py${{ matrix.python }} | ||
parallel: true | ||
|
||
finalize: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Finalize coverage report | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
|
||
publish: | ||
needs: finalize | ||
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: { python-version: "3.10" } | ||
- name: Retrieve pre-built distribution files | ||
uses: actions/download-artifact@v3 | ||
with: { name: python-distribution-files, path: dist/ } | ||
- name: Publish Package | ||
env: | ||
TWINE_REPOSITORY: pypi | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: pipx run tox -e publish |
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,54 @@ | ||
# Temporary and binary files | ||
*~ | ||
*.py[cod] | ||
*.so | ||
*.cfg | ||
!.isort.cfg | ||
!setup.cfg | ||
*.orig | ||
*.log | ||
*.pot | ||
__pycache__/* | ||
.cache/* | ||
.*.swp | ||
*/.ipynb_checkpoints/* | ||
.DS_Store | ||
|
||
# Project files | ||
.ropeproject | ||
.project | ||
.pydevproject | ||
.settings | ||
.idea | ||
.vscode | ||
tags | ||
|
||
# Package files | ||
*.egg | ||
*.eggs/ | ||
.installed.cfg | ||
*.egg-info | ||
|
||
# Unittest and coverage | ||
htmlcov/* | ||
.coverage | ||
.coverage.* | ||
.tox | ||
junit*.xml | ||
coverage.xml | ||
.pytest_cache/ | ||
|
||
# Build and docs folder/files | ||
build/* | ||
dist/* | ||
sdist/* | ||
docs/api/* | ||
docs/_rst/* | ||
docs/_build/* | ||
cover/* | ||
MANIFEST | ||
|
||
# Per-project virtualenvs | ||
.venv*/ | ||
.conda*/ | ||
.python-version |
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,3 @@ | ||
[settings] | ||
profile = black | ||
known_first_party = safe_security_logger |
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,39 @@ | ||
exclude: ^docs/conf.py | ||
repos: | ||
- hooks: | ||
- id: trailing-whitespace | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: requirements-txt-fixer | ||
- args: | ||
- --fix=lf | ||
id: mixed-line-ending | ||
repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
- hooks: | ||
- args: | ||
- --in-place | ||
- --remove-all-unused-imports | ||
- --remove-unused-variables | ||
id: autoflake | ||
repo: https://github.com/myint/autoflake | ||
rev: v1.4 | ||
- hooks: | ||
- id: isort | ||
repo: https://github.com/pycqa/isort | ||
rev: 5.10.1 | ||
- hooks: | ||
- id: black | ||
language_version: python3 | ||
repo: https://github.com/psf/black | ||
rev: stable | ||
- hooks: | ||
- id: commitizen | ||
repo: https://github.com/commitizen-tools/commitizen | ||
rev: v2.32.2 |
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,23 @@ | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
# Build documentation with MkDocs | ||
#mkdocs: | ||
# configuration: mkdocs.yml | ||
|
||
# Optionally build your docs in additional formats such as PDF | ||
formats: | ||
|
||
python: | ||
version: 3.8 | ||
install: | ||
- requirements: docs/requirements.txt | ||
- {path: ., method: pip} |
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,5 @@ | ||
============ | ||
Contributors | ||
============ | ||
|
||
* deepak-sreekumar <[email protected]> |
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,8 @@ | ||
========= | ||
Changelog | ||
========= | ||
|
||
Version 0.1 | ||
=========== | ||
|
||
- Initial Release |
Oops, something went wrong.