Skip to content

Commit

Permalink
Merge pull request #23 from jacebrowning/update-tooling
Browse files Browse the repository at this point in the history
Update tooling
  • Loading branch information
jacebrowning committed Mar 23, 2023
2 parents 0757693 + c02f25d commit 175dfca
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 234 deletions.
131 changes: 18 additions & 113 deletions .pylint.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,87 +51,28 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=
print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
raw-checker-failed,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
missing-docstring,
fixme,
global-statement,
invalid-name,
missing-docstring,
redefined-outer-name,
too-few-public-methods,
fixme,
too-many-locals,
too-many-arguments,
unnecessary-pass,
broad-except,
duplicate-code,
too-many-branches,
unpacking-non-sequence,
wildcard-import,
unused-wildcard-import,
singleton-comparison,
bad-continuation,
wrong-import-order,
not-an-iterable,
no-member,
unsubscriptable-object,
too-many-return-statements,
too-many-public-methods,
too-many-ancestors,
too-many-instance-attributes,
too-many-statements,
attribute-defined-outside-init,
unsupported-assignment-operation,
unsupported-delete-operation,
too-many-nested-blocks,
protected-access,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -173,46 +114,28 @@ max-nested-blocks=5

[BASIC]

# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-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 names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

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

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

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

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1

# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand All @@ -222,21 +145,12 @@ good-names=i,j,k,ex,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no

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

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

# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-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 module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

Expand All @@ -252,9 +166,6 @@ no-docstring-rgx=^_
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty

# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand All @@ -280,12 +191,6 @@ max-line-length=88
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.10.10
2 changes: 1 addition & 1 deletion .verchew.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ version = 1

cli = dot
cli_version_arg = -V
version = 2
version = 7
optional = true
message = This is only needed to generate UML diagrams for documentation.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
### Requirements

* Make:
* macOS: `$ xcode-select --install`
* Linux: [https://www.gnu.org/software/make](https://www.gnu.org/software/make)
* Windows: [https://mingw.org/download/installer](https://mingw.org/download/installer)
* Python: `$ pyenv install`
* Poetry: [https://poetry.eustace.io/docs/#installation](https://poetry.eustace.io/docs/#installation)
- macOS: `$ xcode-select --install`
- Linux: [https://www.gnu.org](https://www.gnu.org/software/make)
- Windows: `$ choco install make` [https://chocolatey.org](https://chocolatey.org/install)
* Python: `$ asdf install` (https://asdf-vm.com)[https://asdf-vm.com/guide/getting-started.html]
* Poetry: [https://python-poetry.org](https://python-poetry.org/docs/#installation)
* Graphviz:
* macOS: `$ brew install graphviz`
* Linux: [https://graphviz.org/download](https://graphviz.org/download/)
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
PROJECT := slackoff
PACKAGE := slackoff
MODULES := $(wildcard $(PACKAGE)/*.py)

# MAIN TASKS ##################################################################

.PHONY: all
all: format check test mkdocs ## Run all tasks that determine CI status
all: doctor format check test mkdocs ## Run all tasks that determine CI status

.PHONY: dev
dev: install .clean-test ## Continuously run CI tasks when files chanage
Expand Down Expand Up @@ -128,6 +129,7 @@ $(MKDOCS_INDEX): docs/requirements.txt mkdocs.yml docs/*.md
docs/requirements.txt: poetry.lock
@ poetry export --with dev --without-hashes | grep mkdocs > $@
@ poetry export --with dev --without-hashes | grep pygments >> $@
@ poetry export --with dev --without-hashes | grep jinja2 >> $@

.PHONY: uml
uml: install docs/*.png
Expand Down Expand Up @@ -160,7 +162,6 @@ $(DIST_FILES): $(MODULES) pyproject.toml
.PHONY: exe
exe: install $(EXE_FILES)
$(EXE_FILES): $(MODULES) $(PACKAGE).spec
# For framework/shared support: https://github.com/yyuu/pyenv/wiki
poetry run pyinstaller $(PACKAGE).spec --noconfirm --clean

$(PACKAGE).spec:
Expand All @@ -172,7 +173,7 @@ $(PACKAGE).spec:
upload: dist ## Upload the current version to PyPI
git diff --name-only --exit-code
poetry publish
bin/open https://pypi.org/project/$(PACKAGE)
bin/open https://pypi.org/project/$(PROJECT)

# CLEANUP #####################################################################

Expand Down
41 changes: 21 additions & 20 deletions bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import shutil
import subprocess
import sys


CWD = os.getcwd()
TMP = tempfile.gettempdir()
CONFIG = {
Expand All @@ -25,12 +26,12 @@ CONFIG = {
}


def install(package='cookiecutter'):
def install(package="cookiecutter"):
try:
importlib.import_module(package)
except ImportError:
print("Installing cookiecutter")
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
subprocess.check_call([sys.executable, "-m", "pip", "install", package])


def run():
Expand All @@ -40,7 +41,7 @@ def run():

os.chdir(TMP)
cookiecutter(
'https://github.com/jacebrowning/template-python.git',
"https://github.com/jacebrowning/template-python.git",
no_input=True,
overwrite_if_exists=True,
extra_context=CONFIG,
Expand All @@ -49,30 +50,30 @@ def run():

def copy():
for filename in [
'.appveyor.yml',
'.coveragerc',
'.gitattributes',
'.gitignore',
'.pydocstyle.ini',
'.pylint.ini',
'.scrutinizer.yml',
'.verchew.ini',
'CONTRIBUTING.md',
'Makefile',
os.path.join('bin', 'checksum'),
os.path.join('bin', 'open'),
os.path.join('bin', 'update'),
os.path.join('bin', 'verchew'),
'scent.py',
os.path.join("bin", "update"),
os.path.join("bin", "checksum"),
os.path.join("bin", "open"),
os.path.join("bin", "verchew"),
".appveyor.yml",
".coveragerc",
".gitattributes",
".gitignore",
".pydocstyle.ini",
".pylint.ini",
".scrutinizer.yml",
".verchew.ini",
"CONTRIBUTING.md",
"Makefile",
"scent.py",
]:
src = os.path.join(TMP, CONFIG['project_name'], filename)
src = os.path.join(TMP, CONFIG["project_name"], filename)
dst = os.path.join(CWD, filename)
print("Updating " + filename)
with suppress(FileNotFoundError):
shutil.copy(src, dst)


if __name__ == '__main__':
if __name__ == "__main__":
install()
run()
copy()
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
mkdocs==1.4.2 ; python_version >= "3.10" and python_version < "4.0"
pygments==2.11.2 ; python_version >= "3.10" and python_version < "4.0"
jinja2==3.1.1 ; python_version >= "3.10" and python_version < "4.0"

0 comments on commit 175dfca

Please sign in to comment.