Skip to content

Commit

Permalink
Merge pull request #1 from brainelectronics/feature/initial-implement…
Browse files Browse the repository at this point in the history
…ation

Initial implementation
  • Loading branch information
brainelectronics authored Jul 31, 2022
2 parents 918bd33 + e1c7e1e commit 0c2fff7
Show file tree
Hide file tree
Showing 23 changed files with 1,013 additions and 89 deletions.
31 changes: 31 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Configuration for python coverage package
[run]
branch = True
omit =
*/tests/*,
.venv/*,
.idea/*,
setup*,
.eggs/*
.tox/*,
build/*,
dist/*,
version.py

[report]
include = src/*
# Regexes for lines to exclude from consideration

ignore_errors = True

[html]
directory = reports/coverage/html
skip_empty = True

[xml]
output = reports/coverage/coverage.xml

[json]
output = reports/coverage/coverage.json
pretty_print = True
show_contexts = True
111 changes: 111 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Configuration for flake8 analysis
[flake8]
# Set the maximum length that any line (with some exceptions) may be.
# max-line-length = 120

# Set the maximum length that a comment or docstring line may be.
# max-doc-length = 120

# Set the maximum allowed McCabe complexity value for a block of code.
# max-complexity = 15

# Specify a list of codes to ignore.
# D107: Missing docstring in __init__
# D400: First line should end with a period
# W504: line break after binary operator -> Cannot break line with a long pathlib Path
# D204: 1 blank line required after class docstring
ignore = D107, D400, W504, D204

# Specify a list of mappings of files and the codes that should be ignored for the entirety of the file.
per-file-ignores =
tests/*:D101,D102,D104

# Provide a comma-separated list of glob patterns to exclude from checks.
exclude =
# No need to traverse our git directory
.git,
# Python virtual environments
.venv,
# tox virtual environments
.tox,
# There's no value in checking cache directories
__pycache__,
# The conf file is mostly autogenerated, ignore it
docs/source/conf.py,
# This contains our built documentation
build,
# This contains builds that we don't want to check
dist,
# We don't use __init__.py for scripts
__init__.py
# example testing folder before going live
thinking
# custom scripts, not being part of the distribution
libs_external
sdist_upip.py
setup.py
update_version.py

# Provide a comma-separated list of glob patterns to add to the list of excluded ones.
# extend-exclude =
# legacy/,
# vendor/

# Provide a comma-separate list of glob patterns to include for checks.
# filename =
# example.py,
# another-example*.py

# Enable PyFlakes syntax checking of doctests in docstrings.
doctests = False

# Specify which files are checked by PyFlakes for doctest syntax.
# include-in-doctest =
# dir/subdir/file.py,
# dir/other/file.py

# Specify which files are not to be checked by PyFlakes for doctest syntax.
# exclude-from-doctest =
# tests/*

# Enable off-by-default extensions.
# enable-extensions =
# H111,
# G123

# If True, report all errors, even if it is on the same line as a # NOQA comment.
disable-noqa = False

# Specify the number of subprocesses that Flake8 will use to run checks in parallel.
jobs = auto

# Also print output to stdout if output-file has been configured.
tee = True

# Count the number of occurrences of each error/warning code and print a report.
statistics = True

# Print the total number of errors.
count = True

# Print the source code generating the error/warning in question.
show-source = True

# Decrease the verbosity of Flake8’s output. Each time you specify it, it will print less and less information.
quiet = 0

# Select the formatter used to display errors to the user.
format = pylint

[pydocstyle]
# choose the basic list of checked errors by specifying an existing convention. Possible conventions: pep257, numpy, google.
convention = pep257

# check only files that exactly match <pattern> regular expression
# match = (?!test_).*\.py

# search only dirs that exactly match <pattern> regular expression
# match_dir = [^\.].*

# ignore any functions or methods that are decorated by a function with a name fitting the <decorators> regular expression.
# ignore_decorators =
34 changes: 25 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,40 @@ name: Release
on:
push:
branches:
- master
- main

permissions:
contents: read

jobs:
build-and-publish:
deploy:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v3
with:
python-version: '3.x'
python-version: '3.9'
- name: Install build dependencies
run: python -m pip install -U setuptools wheel build
- name: Build
run: python -m build .
- name: Publish
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Build package
run: |
update_version \
--changelog_file changelog.md \
--version_file src/changelog2version/version.py \
--version_file_type py \
--debug
python -m build .
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
verbose: true
print_hash: true
78 changes: 62 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,71 @@
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
# help test this project
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test
name: Test Python package

on: [push, pull_request]
on:
push:
# branches: [ $default-branch ]
branches-ignore:
- 'main'
- 'develop'

permissions:
contents: read

jobs:
test:
build:

runs-on: ubuntu-latest
# runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10']
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
python-version: ['3.7', '3.8', '3.9', '3.10']
# os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Install test dependencies
run: python -m pip install -U tox
- name: Test
run: python -m tox -e py
python-version: ${{ matrix.python-version }}
# python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install .[dev]
python -m pip install .[test]
- name: Test with tox
run: |
python -m tox -e py
# echo "Passing :P"
- name: Test with nose2
run: |
python create_report_dirs.py
nose2 --config tests/unittest.cfg
coverage xml
coverage html
- name: Install deploy dependencies
run: |
python -m pip install -U setuptools wheel build
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
pip install .
- name: Build package
run: |
changelog2version \
--changelog_file changelog.md \
--version_file src/changelog2version/version.py \
--version_file_type py \
--debug
python -m build .
- name: Test built package
run: |
twine check dist/*.tar.gz
- name: Archive build package artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.python-version == '3.9' }}
with:
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
# ${{ github.repository }} and ${{ github.ref_name }} can't be used for artifact name due to unallowed '/'
name: dist_py.${{ matrix.python-version }}_repo.${{ github.event.repository.name }}_sha.${{ github.sha }}_build.${{ github.run_number }}
path: dist/*.tar.gz
retention-days: 14
Loading

0 comments on commit 0c2fff7

Please sign in to comment.