Skip to content

Commit

Permalink
1st commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Sorokin committed Oct 23, 2021
0 parents commit 163812c
Show file tree
Hide file tree
Showing 32 changed files with 597 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .flake8
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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
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
27 changes: 27 additions & 0 deletions .github/workflows/docs.yml
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
27 changes: 27 additions & 0 deletions .github/workflows/static.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
site
docs/docstrings
.idea

8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/ellipsize.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
ignore_missing_imports = True
87 changes: 87 additions & 0 deletions .pre-commit-config.yaml
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
19 changes: 19 additions & 0 deletions LICENSE.txt
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.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include LICENSE.txt
14 changes: 14 additions & 0 deletions README.md
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`.
40 changes: 40 additions & 0 deletions 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
12 changes: 12 additions & 0 deletions build-docs.sh
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
3 changes: 3 additions & 0 deletions build.sh
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
13 changes: 13 additions & 0 deletions docs/README.md
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)
16 changes: 16 additions & 0 deletions mkdocs.yml
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
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = --doctest-modules
9 changes: 9 additions & 0 deletions requirements.txt
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
4 changes: 4 additions & 0 deletions setup.cfg
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

0 comments on commit 163812c

Please sign in to comment.