This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
generated from KOLANICH/python_project_boilerplate.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 212864f
Showing
16 changed files
with
2,367 additions
and
0 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,3 @@ | ||
https://github.com/tartley/colorama.git | ||
https://github.com/tomerfiliba/plumbum.git | ||
https://gitlab.com/dslackw/colored.git |
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,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = tab | ||
indent_size = 4 | ||
insert_final_newline = true | ||
end_of_line = lf | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 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 @@ | ||
KOLANICH/python_project_boilerplate.py |
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 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
- dependency-type: "all" |
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,15 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: typical python workflow | ||
uses: KOLANICH-GHActions/typical-python-workflow@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
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,7 @@ | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
/*.egg-info | ||
/build | ||
/dist | ||
/.eggs |
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,59 @@ | ||
image: pypy:latest | ||
#image: registry.gitlab.com/kolanich-subgroups/docker-images/fixed_python:latest | ||
#image: registry.gitlab.com/kolanich-subgroups/docker-images/python_graal_docker:latest | ||
|
||
|
||
variables: | ||
DOCKER_DRIVER: overlay2 | ||
SAST_ANALYZER_IMAGE_TAG: latest | ||
SAST_DISABLE_DIND: "true" | ||
SAST_CONFIDENCE_LEVEL: 5 | ||
CODECLIMATE_VERSION: latest | ||
|
||
include: | ||
- template: SAST.gitlab-ci.yml | ||
- template: Code-Quality.gitlab-ci.yml | ||
|
||
build: | ||
tags: | ||
- shared | ||
- linux | ||
stage: build | ||
variables: | ||
GIT_DEPTH: "1" | ||
PYTHONUSERBASE: ${CI_PROJECT_DIR}/python_user_packages | ||
|
||
before_script: | ||
- export PATH="$PATH:$PYTHONUSERBASE/bin" # don't move into `variables` | ||
- git clone https://github.com/pypa/setuptools.git | ||
- cd setuptools | ||
- pypy3 ./bootstrap.py | ||
- pypy3 ./setup.py bdist_wheel | ||
- pip install --upgrade --pre ./dist/*.whl | ||
- cd .. | ||
- rm -rf ./setuptools | ||
- pip3 install --user --pre --upgrade git+https://github.com/pypa/setuptools_scm.git | ||
- pip3 install --user --pre --upgrade git+https://github.com/pypa/pip.git git+https://github.com/pypa/wheel.git | ||
- pip3 install --user --pre --upgrade pep517 | ||
- pip3 install --pre --upgrade --user git+https://github.com/pytest-dev/pytest.git | ||
|
||
script: | ||
- pypy3 -m pep517.build . | ||
#- pypy3 ./setup.py bdist_wheel | ||
- mv ./dist/*.whl ./dist/RichConsole-0.CI-py3-none-any.whl | ||
- pip3 install --user --upgrade --pre "./dist/RichConsole-0.CI-py3-none-any.whl[colorama,plumbum,colored]" | ||
- coverage run -a --branch --source=RichConsole -m pytest --junitxml=./rspec.xml ./tests/tests.py | ||
- coverage run -a --branch --source=RichConsole -m RichConsole | ||
- coverage xml | ||
|
||
cache: | ||
paths: | ||
- /usr/local/site-packages | ||
- /usr/local/lib/python*/site-packages | ||
|
||
artifacts: | ||
paths: | ||
- dist | ||
reports: | ||
junit: ./rspec.xml | ||
cobertura: ./coverage.xml |
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 @@ | ||
No codes of conduct! |
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,4 @@ | ||
include UNLICENSE | ||
include *.md | ||
include tests | ||
include .editorconfig |
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,50 @@ | ||
RichConsole.py [![Unlicensed work](https://raw.githubusercontent.com/unlicense/unlicense.org/master/static/favicon.png)](https://unlicense.org/) | ||
=============== | ||
~~[wheel (GHA via `nightly.link`)](https://nightly.link/KOLANICH-libs/RichConsole.py/workflows/CI/master/RichConsole-0.CI-py3-none-any.whl)~~ | ||
~~[![GitLab Build Status](https://gitlab.com/KOLANICH/RichConsole.py/badges/master/pipeline.svg)]( https://gitlab.com/KOLANICH/RichConsole.py/pipelines/master/latest)~~ | ||
~~![GitLab Coverage](https://gitlab.com/KOLANICH/RichConsole.py/badges/master/coverage.svg)~~ | ||
~~[![GitHub Actions](https://github.com/KOLANICH-libs/RichConsole.py/workflows/CI/badge.svg)](https://github.com/KOLANICH-libs/RichConsole.py/actions/)~~ | ||
![N∅ hard dependencies](https://shields.io/badge/-N∅_Ъ_deps!-0F0) | ||
[![Libraries.io Status](https://img.shields.io/librariesio/github/KOLANICH-libs/RichConsole.py.svg)](https://libraries.io/github/KOLANICH-libs/RichConsole.py) | ||
[![Code style: antiflash](https://img.shields.io/badge/code%20style-antiflash-FFF.svg)](https://github.com/KOLANICH-tools/antiflash.py) | ||
|
||
>Yo dawg so we heard you like text styles so we put styles in your styles so you can style while you styling. | ||
This is a tool to output "poor" (because it is limited by standardized control codes, which are very limited) rich text into a console. When dealing with control codes there is a problem with nesting styles because you have to restore the state, and the state you have to restore depends on the style of the level much distant from the one you are in. This library solves this problem. | ||
|
||
You create a [directed acyclic graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) structure `RichStr` where each piece of string has its own [style`Sheet`](https://en.wikipedia.org/wiki/Style_sheet_(desktop_publishing)). After you have finished forming the output message you convert it into a string. The library does the rest. | ||
|
||
How does it work? | ||
----------------- | ||
|
||
The algorithm is damn simple: it just traverses the directed acyclic graph in depth-first way, determines exact style of each string, computes differences between them and emits control codes to apply them. | ||
|
||
Requirements | ||
------------ | ||
* A terminal supporting color codes. | ||
* Any Linux distro usually has one | ||
* Windows: | ||
* Windows 10 [has built-in support](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences) | ||
* [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](https://github.com/Maximus5/ConEmu) or [MinTTY](https://github.com/mintty/mintty) for older Windows | ||
* you can call [colorama.init()](https://github.com/tartley/colorama) to enable filtering the output with python, but this is VERY glitchy. It raises exceptions even on simple strings. The good thing in it that it supports more codes than `ansicon`. | ||
|
||
Optional requirements | ||
--------------------- | ||
This library automatically imports colors and other control codes from the following libraries: | ||
* [`colorama`](https://github.com/tartley/colorama/) | ||
[![PyPi Status](https://img.shields.io/pypi/v/colorama.svg)](https://pypi.org/pypi/colorama) | ||
[![Build Status](https://github.com/tartley/colorama/actions/workflows/test.yml/badge.svg)](https://github.com/tartley/colorama/actions/workflows/test.yml) | ||
![License](https://img.shields.io/github/license/tartley/colorama.svg) | ||
|
||
* [`plumbum.colorlib`](https://github.com/tomerfiliba/plumbum/) | ||
[![PyPi Status](https://img.shields.io/pypi/v/plumbum.svg)](https://pypi.org/pypi/plumbum) | ||
[![Build Status](https://github.com/tomerfiliba/plumbum/actions)](https://github.com/tomerfiliba/plumbum/actions) | ||
[![Docs](https://readthedocs.org/projects/plumbum/badge/)](https://plumbum.readthedocs.io/en/latest/) | ||
![License](https://img.shields.io/github/license/tomerfiliba/plumbum.svg) | ||
|
||
* [`colored`](https://gitlab.com/dslackw/colored/) | ||
[![PyPi Status](https://img.shields.io/pypi/v/colored.svg)](https://pypi.org/pypi/colored) | ||
|
||
Tutorial | ||
-------- | ||
See [`Tutorial.ipynb`](./Tutorial.ipynb) ([NBViewer](https://nbviewer.jupyter.org/github/KOLANICH-libs/RichConsole.py/blob/master/Tutorial.ipynb)). |
Oops, something went wrong.