From 9235e2ed1e21c7c9282fbaab43c2543e6b6a3f62 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 8 Jul 2019 13:55:04 +0700 Subject: [PATCH 1/3] :shirt: fix import order in reporter.py --- moban/reporter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/moban/reporter.py b/moban/reporter.py index b706ef79..e79ad989 100644 --- a/moban/reporter.py +++ b/moban/reporter.py @@ -1,6 +1,5 @@ -import moban.constants as constants - import crayons +import moban.constants as constants MESSAGE_TEMPLATING = "Templating {0} to {1}" MESSAGE_UP_TO_DATE = "Everything is up to date!" From 60c6ed84124731895cbdf951884c82c788b15e4c Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 8 Jul 2019 13:06:02 +0700 Subject: [PATCH 2/3] :shirt: sync style from pypi-mobans-pkg 0.0.5 --- .moban.d/setup.py | 2 +- setup.py | 45 ++++++++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.moban.d/setup.py b/.moban.d/setup.py index 901b9222..ee8313e0 100644 --- a/.moban.d/setup.py +++ b/.moban.d/setup.py @@ -3,4 +3,4 @@ {%block platform_block%} {%endblock%} -{%block morefiles%} 'CONTRIBUTORS.rst',{%endblock%} +{%block morefiles%} "CONTRIBUTORS.rst",{%endblock%} diff --git a/setup.py b/setup.py index 06ee131a..75ca297a 100644 --- a/setup.py +++ b/setup.py @@ -32,12 +32,22 @@ VERSION = "0.4.5" EMAIL = "wangc_2011@hotmail.com" LICENSE = "MIT" -ENTRY_POINTS = {"console_scripts": ["moban = moban.main:main"]} -DESCRIPTION = "Yet another jinja2 cli command for static text generation" +ENTRY_POINTS = { + "console_scripts": [ + "moban = moban.main:main" + ], +} +DESCRIPTION = ( + "Yet another jinja2 cli command for static text generation" +) URL = "https://github.com/moremoban/moban" DOWNLOAD_URL = "%s/archive/0.4.5.tar.gz" % URL FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"] -KEYWORDS = ["python", "jinja2", "moban"] +KEYWORDS = [ + "python", + "jinja2", + "moban", +] CLASSIFIERS = [ "Topic :: Software Development :: Libraries", @@ -49,8 +59,11 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + ] INSTALL_REQUIRES = [ @@ -66,19 +79,16 @@ PACKAGES = find_packages(exclude=["ez_setup", "examples", "tests"]) -EXTRAS_REQUIRE = {} +EXTRAS_REQUIRE = { +} # You do not need to read beyond this line -PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format( - sys.executable -) -GS_COMMAND = "gs moban v0.4.5 " + "Find 0.4.5 in changelog for more details" -NO_GS_MESSAGE = ( - "Automatic github release is disabled. " - + "Please install gease to enable it." -) +PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable) +GS_COMMAND = ("gs moban v0.4.5 " + + "Find 0.4.5 in changelog for more details") +NO_GS_MESSAGE = ("Automatic github release is disabled. " + + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( - 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND -) + 'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND) HERE = os.path.abspath(os.path.dirname(__file__)) @@ -121,7 +131,9 @@ def run(self): sys.exit() -SETUP_COMMANDS.update({"publish": PublishCommand}) +SETUP_COMMANDS.update({ + "publish": PublishCommand +}) def has_gease(): @@ -132,7 +144,6 @@ def has_gease(): """ try: import gease # noqa - return True except ImportError: return False @@ -201,5 +212,5 @@ def filter_out_test_code(file_handle): zip_safe=False, entry_points=ENTRY_POINTS, classifiers=CLASSIFIERS, - cmdclass=SETUP_COMMANDS, + cmdclass=SETUP_COMMANDS ) From 0d8124221a54e029f15c2c84fb4a82d771dc4163 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Mon, 8 Jul 2019 10:33:33 +0700 Subject: [PATCH 3/3] :green_heart: check local repo using moban in CI Ensure that this repo is leading by example, and eating its own dogfood. Also reduces flake8 ignore list to only W503,W504, and updates the flake8 max line length to match black. And separate commands in test.bat with %errorlevel% handling. --- .moban.cd/moban.yml | 2 +- .travis.yml | 2 +- Makefile | 10 ++++++++++ lint.sh | 2 +- test.bat | 8 +++++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 56490822..480c0f13 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -27,4 +27,4 @@ dependencies: - giturlparse>=0.9.1 description: Yet another jinja2 cli command for static text generation scm_host: github.com -lint: sh lint.sh \ No newline at end of file +lint_command: make lint install_test format install update diff --git a/.travis.yml b/.travis.yml index d7b0b96d..6706df51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,7 +32,7 @@ stages: python: 3.6 stage: lint install: pip install flake8 - script: sh lint.sh + script: make lint install_test format install update jobs: include: diff --git a/Makefile b/Makefile index d275cdef..6315255a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,21 @@ all: test +install: + pip install . + +install_test: + pip install -r tests/requirements.txt + update: moban -m mobanfile + git diff --exit-code test: bash test.sh +lint: + bash lint.sh + format: isort -y $(find moban -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo) black -l 79 moban diff --git a/lint.sh b/lint.sh index b53891e2..08f7c655 100644 --- a/lint.sh +++ b/lint.sh @@ -1 +1 @@ -flake8 . --exclude=.moban.d,docs --ignore=E203,E121,E123,E126,E226,E24,E704,W503,W504 +flake8 --max-line-length=88 --exclude=.moban.d,docs --ignore=W503,W504 diff --git a/test.bat b/test.bat index 7f79f8f4..399c6eda 100644 --- a/test.bat +++ b/test.bat @@ -1,3 +1,9 @@ pip freeze -nosetests --with-coverage --cover-package=moban --cover-package=tests && flake8 . --exclude=docs,.moban.d --ignore=E203,E121,E123,E126,E226,E24,E704,W503,W504 +nosetests --with-coverage --cover-package=moban --cover-package=tests || goto :error + +flake8 --max-line-length=88 --exclude=docs,.moban.d --ignore=W503,W504 || goto :error + +:error +echo Failed with error #%errorlevel%. +exit /b %errorlevel%