-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
ignore = F401,F403,W503,E203,E402 | ||
max-line-length = 99 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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: ci | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
strategy: | ||
matrix: | ||
python-version: [3.7, 3.8, 3.9] | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
python -m pip install -e . | ||
- name: Test with pytest | ||
run: pytest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# build docs from docstrings and markdown-file in folder docs | ||
# publish them as github pages | ||
# | ||
#note for myself | ||
# | ||
# Do not forget to set git branch `gh-pages` as source for github pages. | ||
# This branch auto-updated by `mkdocs gh-deploy` | ||
# | ||
name: docs | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- run: | | ||
pip install -r requirements.txt | ||
python -m pip install -e . | ||
- run: ./build-docs.sh | ||
- run: mkdocs gh-deploy --force |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# build docs from docstrings and markdown-file in folder docs | ||
# publish them as github pages | ||
# | ||
#note for myself | ||
# | ||
# Do not forget to set git branch `gh-pages` as source for github pages. | ||
# This branch auto-updated by `mkdocs gh-deploy` | ||
# | ||
name: static source code checks | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
python -m pip install -e . | ||
- run: pre-commit run --verbose --all-files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
site | ||
docs/docstrings | ||
.idea | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[mypy] | ||
ignore_missing_imports = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
args: ["--unsafe"] | ||
- id: check-added-large-files | ||
exclude: (site) | ||
|
||
- repo: https://github.com/myint/autoflake | ||
rev: v1.4 | ||
hooks: | ||
- id: autoflake | ||
name: Cleanup imports | ||
args: | ||
- --in-place | ||
- --remove-all-unused-imports | ||
- --expand-star-imports | ||
- --ignore-init-module-imports | ||
|
||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v5.7.0 | ||
hooks: | ||
- id: isort | ||
name: Sorts imports | ||
args: [ | ||
# Align isort with black formatting | ||
"--multi-line=3", | ||
"--trailing-comma", | ||
"--force-grid-wrap=0", | ||
"--use-parentheses", | ||
"--line-width=99", | ||
] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
name: Fixes formatting | ||
language_version: python3 | ||
args: ["--line-length=99"] | ||
|
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
hooks: | ||
- id: flake8 | ||
name: Checks pep8 style | ||
args: | ||
- --max-line-length=99 | ||
# F405 - init imports * from module | ||
# F401 - ignore imports used in init | ||
# F403 - import * used in init | ||
- --exclude=__init__.py | ||
# ignore long comments (E501), as long lines are formatted by black | ||
# ignore Whitespace before ':' (E203) | ||
# ignore Line break occurred before a binary operator (W503) | ||
# ignore module level import not at top of file (E402) to skip tests with uninstalled modules (pytest.importorskip) | ||
- --ignore=E501,E203,W503,E402 | ||
|
||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
entry: dmypy | ||
files: \.py$ | ||
# pre-commit send full file list so exclude in .mypy.ini is ignored | ||
exclude: (tests) | ||
language: python | ||
require_serial: true | ||
args: ["run", "--", "--strict", "--implicit-reexport", "--warn-unused-ignores", "--cache-fine-grained"] | ||
|
||
- id: pylint | ||
name: Pylint | ||
entry: pylint --max-line-length=99 --ignore-imports=yes | ||
files: \.py$ | ||
exclude: (tests|version.py|setup.py) | ||
language: python | ||
|
||
- id: pydocstyle | ||
name: docstrings | ||
entry: pydocstyle | ||
language: python | ||
exclude: (tests|version.py) | ||
args: | ||
- --ignore=D100,D203,D405,D407,D213,D413 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2021 Andrey Sorokin <andrey@sorokin.engineer> | ||
|
||
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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include LICENSE.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[![Build Status](https://github.com/andgineer/ellipsize/workflows/ci/badge.svg)](https://github.com/andgineer/ellipsize/actions) | ||
# Ellipsize with style | ||
|
||
Pretty reducing huge Python objects to visualise them nicely. | ||
|
||
Handy for AWS outputs etc. | ||
|
||
# Documentation | ||
|
||
[ellipsize](https://andgineer.github.io/ellipsize/) | ||
|
||
# Developers | ||
|
||
Do not forget to run `. ./activate.sh`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# "Set-ups or/and activates development environment" | ||
# | ||
|
||
VENV_FOLDER="venv" | ||
PYTHON="python3.8" | ||
|
||
RED='\033[1;31m' | ||
GREEN='\033[1;32m' | ||
CYAN='\033[1;36m' | ||
NC='\033[0m' # No Color | ||
|
||
if ! (return 0 2>/dev/null) ; then | ||
# If return is used in the top-level scope of a non-sourced script, | ||
# an error message is emitted, and the exit code is set to 1 | ||
echo | ||
echo -e $RED"This script should be sourced like"$NC | ||
echo " . ./activate.sh" | ||
echo | ||
exit 1 | ||
fi | ||
|
||
# virtual env | ||
if [[ ! -d ${VENV_FOLDER} ]] ; then | ||
echo -e $CYAN"Creating virtual environment for python in ${VENV_FOLDER}"$NC | ||
if virtualenv ${VENV_FOLDER} --python=${PYTHON}; then | ||
python -m venv ${VENV_FOLDER} | ||
. ${VENV_FOLDER}/bin/activate | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
python -m pip install -e . | ||
else | ||
echo -e $RED"Error to create virtual env. Do you have virtualenv installed?"$NC | ||
return 1 | ||
fi | ||
else | ||
echo -e $CYAN"Activating virtual environment ..."$NC | ||
. ${VENV_FOLDER}/bin/activate | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Create docs in docs/ | ||
# | ||
|
||
lazydocs \ | ||
--output-path="./docs/docstrings" \ | ||
--overview-file="README.md" \ | ||
--src-base-url="https://github.com/andgineer/aios3/blob/master/" \ | ||
src/ellipsize | ||
|
||
mkdocs build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
# Build package. For upload use upload.sh | ||
python3 setup.py bdist_wheel |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Ellipsize | ||
|
||
Pretty reducing huge Python objects to visualise them nicely. | ||
|
||
Handy for AWS outputs etc. | ||
|
||
# Documentation | ||
|
||
[Ellipsize API reference](docstrings/) | ||
|
||
# source code | ||
|
||
[sorokin.engineer/ellipsize](https://github.com/andgineer/ellipsize) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
site_name: ellipsize | ||
site_url: https://andgineer.github.io/ellipsize | ||
site_author: Andrey Sorokin | ||
|
||
# Repository | ||
repo_name: ellipsize | ||
repo_url: https://github.com/andgineer/ellipsize | ||
edit_uri: edit/master/docs | ||
docs_dir: docs | ||
|
||
plugins: | ||
- awesome-pages | ||
- search | ||
|
||
theme: | ||
name: readthedocs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
addopts = --doctest-modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
lazydocs | ||
pylint | ||
mypy | ||
pytest | ||
pydocstyle | ||
mkdocs | ||
mkdocs-awesome-pages-plugin | ||
twine | ||
pre-commit |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[metadata] | ||
# This includes the license file(s) in the wheel. | ||
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file | ||
license_files = LICENSE.txt |