Skip to content

Commit

Permalink
Run cruft update
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugyi200 committed Jan 16, 2024
1 parent 90f20bc commit f947bd3
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/python-boltons/cc-python",
"commit": "15b51fa172bfc123ee06597c5360fa261619b8df",
"commit": "42af5949086defc1b2f71b2b1354f1b3cfbd029a",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,9 @@ venv.bak/

# git conflict files
*.rej

# pyright config file
pyrightconfig.json

# local sqlite databases
*.db
63 changes: 0 additions & 63 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# pygtk.require().
#init-hook=

# Profiled execution.
profile=no

# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
Expand Down Expand Up @@ -39,14 +36,12 @@ enable=imports
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=design,
bad-continuation,
blacklisted-name,
broad-except,
consider-using-enumerate,
consider-using-f-string,
consider-using-in,
consider-using-with,
deprecated-lambda,
global-statement,
import-error,
import-outside-toplevel,
Expand All @@ -61,11 +56,9 @@ disable=design,
missing-docstring,
multiple-statements,
no-else-return,
no-init,
no-member,
no-name-in-module,
non-parent-init-called,
old-style-class,
protected-access,
super-init-not-called,
too-many-lines,
Expand All @@ -83,11 +76,6 @@ disable=design,
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no

# Tells whether to display a full report or only the messages
reports=no

Expand All @@ -98,10 +86,6 @@ reports=no
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

# Add a comment according to your evaluation note. This is used by the global
# evaluation report (RP0004).
comment=no

# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
Expand All @@ -124,12 +108,6 @@ ignore-imports=yes

[BASIC]

# Required attributes for module, separated by a comma
required-attributes=

# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input,file

# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,_

Expand All @@ -146,63 +124,33 @@ include-naming-hint=no
# Regular expression matching correct function names
function-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for function names
function-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct variable names
variable-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for variable names
variable-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for attribute names
attr-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct argument names
argument-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for argument names
argument-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$

# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct method names
method-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for method names
method-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=__.*__
Expand Down Expand Up @@ -238,9 +186,6 @@ ignore-long-lines=^(.*https?://\S+|.*# type: .*|\s*\S*\s*|[ ]*# TODO.*)$
# else.
single-line-if-stmt=no

# List of optional constructs for which whitespace checking is disabled
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

Expand All @@ -267,10 +212,6 @@ ignored-modules=twisted.application.internet,quickfix
# (useful for classes with attributes dynamically set).
ignored-classes=Report,Index,MultiIndex,twisted.internet.reactor,NewOrder,OESControlResponse,OrderReply,FHControlPortResponse,FHControlPortRequest,FHControlPortRequest,FHOperationRequest,GeneratedProtocolMessageType,OrderRequest

# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
zope=no

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# expressions are accepted.
Expand Down Expand Up @@ -326,10 +267,6 @@ max-public-methods=20

[CLASSES]

# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by

# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you are proposing a feature:

## Developer's Guide

### 🔢 Basic Usage
### Basic Usage 🔢

Before making a PR please run the following

Expand All @@ -30,7 +30,7 @@ Before making a PR please run the following
* `make lint` to check for any format or convention issues
* `make test` to run all tests

### How do I ...?
### How do I ...

<details><summary>🔧 See available make targets</summary>

Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ _version badges:_

[![Project Version](https://img.shields.io/pypi/v/bolton-logrus)](https://pypi.org/project/bolton-logrus/)
[![Python Versions](https://img.shields.io/pypi/pyversions/bolton-logrus)](https://pypi.org/project/bolton-logrus/)
[![Cookiecutter: cc-python](https://img.shields.io/static/v1?label=cc-python&message=2021.12.22&color=d4aa00&logo=cookiecutter&logoColor=d4aa00)](https://github.com/python-boltons/cc-python)
[![Cookiecutter: cc-python](https://img.shields.io/static/v1?label=cc-python&message=2022.01.04&color=d4aa00&logo=cookiecutter&logoColor=d4aa00)](https://github.com/python-boltons/cc-python)
[![Docker: pythonboltons/main](https://img.shields.io/static/v1?label=pythonboltons%20%2F%20main&message=2021.12.22&color=8ec4ad&logo=docker&logoColor=8ec4ad)](https://github.com/python-boltons/docker-python)


## Installation 🗹

To install `bolton-logrus` using [pip][9], run the following
To install `logrus` using [pip][9], run the following
commands in your terminal:

``` shell
Expand All @@ -29,6 +29,17 @@ python3 -m pip install --user bolton-logrus # install logrus
If you don't have pip installed, this [Python installation guide][10] can guide
you through the process.

<!-- [[[[[kooky.cog
from pathlib import Path
lines = Path("./docs/design/design.md").read_text().split("\n")
if any(L.strip() for L in lines):
fixed_lines = [L.replace("(.", "(./docs/design") if L.startswith("![") else L for L in lines]
print("## Design Diagrams\n")
print("\n".join(fixed_lines))
]]]]] -->
<!-- [[[[[end]]]]] -->


## Useful Links 🔗

Expand Down
13 changes: 11 additions & 2 deletions bin/render_all_cogs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
# after running this script.
#################################################################################

BIN="$(dirname "$0")"
ROOT="$(dirname "${BIN}")"
readonly BIN="$(dirname "$0")"
readonly ROOT="$(dirname "${BIN}")"

source "${ROOT}"/lib/bugyi.sh

readonly COG_MARKERS="[[[[[kooky.cog ]]]]] [[[[[end]]]]]"
readonly DESIGN=docs/design

COG_TEMPLATE_FILES=( "README.md" )

Expand All @@ -36,6 +37,14 @@ function run() {

for cog_template_fname in "${COG_TEMPLATE_FILES[@]}"; do
if [[ "${check_flag_is_set}" == false ]]; then
# If the mermaid-cli tool is installed...
if command -v mmdc &>/dev/null; then
local md_template="${DESIGN}"/design.template.md
if [[ -f "${md_template}" ]]; then
mmdc -i "${md_template}" -o "${DESIGN}"/design.md
fi
fi

local out_fname="$(mktemp --suffix '.md')"

log::info \
Expand Down
Empty file added docs/design/design.md
Empty file.
Empty file added docs/design/design.template.md
Empty file.
2 changes: 1 addition & 1 deletion lib/bugyi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function die() {
function log::debug() { if [[ "${DEBUG}" = true || "${VERBOSE}" -gt 0 ]]; then _log "debug" "${COLOR_PURPLE}" "$@"; fi; }
function log::error() { _log "error" "${COLOR_RED}" "$@"; }
function log::info() { _log "info" "${COLOR_GREEN}" "$@"; }
function log::warning() { _log "warning" "${COLOR_YELLOW}" "$@"; }
function log::warn() { _log "warning" "${COLOR_YELLOW}" "$@"; }
function _log() {
local level="$1"
shift
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79
experimental-string-processing = true
preview = true

[tool.pydocstyle]
match = '.*\.py'
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ black
cogapp ~= 3.3
flake8
isort
mypy != 0.920, != 0.921, != 0.930 # workaround for https://github.com/samuelcolvin/pydantic/pull/3175
mypy
pydocstyle[toml]
pylint

### TYPES
types-freezegun ~= 1.1

### Docs
m2r2
m2r2 != 0.3.3 # since this version requires docutils>=0.19 (see https://github.com/CrossNox/m2r2/compare/v0.3.2...v0.3.3)
sphinx
sphinx-rtd-theme
sphinx-autodoc-typehints
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
[ ]*pass[ ]*\#?.*
[ ]*\.\.\.[ ]*\#?.*

[coverage:run]
omit = .venv/*,tests/*,docs/*,setup.py,.tox/*
Expand All @@ -34,7 +36,7 @@ testpaths = src tests
# WPS305 no f strings allowed
# WPS337 ignore multiline condition violations
# WPS348 ignore lines starting with a dot as black does this
ignore = W503,E203,B950,E501,C81,WPS210,WPS213,WPS305,WPS337,WPS348
ignore = W503,E203,E266,E501,B950,C81,WPS210,WPS213,WPS305,WPS337,WPS348
min-name-length = 3
max-try-body-length = 2
# emit a warning if the McCabe complexity of a function
Expand Down
17 changes: 13 additions & 4 deletions targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ SHELL := /bin/bash
CRUFT = $(PYTHON) -m cruft
DOCS_SOURCE := ./docs/source
DOCS_BUILD_DIR := ./docs/build
MIN_TEST_COV := 80
PIP = $(PYTHON) -m pip
PIP_COMPILE = $(PYTHON) -m piptools compile --allow-unsafe --no-emit-index-url -q --no-emit-trusted-host
PIP_SYNC = $(PYTHON) -m piptools sync
PYTHON = $(SOURCE_VENV) python
PYTHON_VERSION := 3.8
RENDER_ALL_COGS = $(SOURCE_VENV) ./bin/render_all_cogs
SOURCE_VENV = source $(VENV_ACTIVATE);
SPHINX_APIDOC = $(SOURCE_VENV) sphinx-apidoc
SPHINX_BUILD = $(SOURCE_VENV) sphinx-build
Expand All @@ -28,18 +30,22 @@ define runtests
-vv \
--cov=src/logrus \
--cov-config=setup.cfg \
--cov-fail-under=80 \
--cov-fail-under=$(MIN_TEST_COV) \
--cov-report=xml:coverage.xml \
--cov-report=term-missing \
--cov-branch \
--doctest-modules \
--doctest-report ndiff \
# Don't remove this comment! It allows us to end the last CLI option with a backslash.
# Don't remove this comment!
endef

.PHONY: all
all: ## Build the package, build the docs, run all tests, and run all linters.
all: build build-docs lint test
all: build build-docs cogs lint test

.PHONY: cogs
cogs: sync-dev-requirements
$(RENDER_ALL_COGS)

.PHONY: lint
lint: black isort pydocstyle flake8 mypy pylint quick-lints ## Run all linting checks.
Expand Down Expand Up @@ -70,8 +76,11 @@ flake8: sync-dev-requirements ## Run flake8 checks.

.PHONY: mypy
mypy: sync-dev-requirements ## Run mypy checks.
@# HACK: Because mypy's cache has been terrible lately.
@rm -rf .mypy_cache
$(PYTHON) -m mypy src
$(PYTHON) -m mypy tests
@# HACK: Fixes weird numpy error that seemed to happen randomly.
bash -c "$(SOURCE_VENV) { python -m mypy tests || python -m mypy tests; }"

.PHONY: pylint
pylint: sync-dev-requirements ## Run pylint checks.
Expand Down

0 comments on commit f947bd3

Please sign in to comment.