summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJensDiemer <git@jensdiemer.de>2020-01-18 19:18:20 +0100
committerJensDiemer <git@jensdiemer.de>2020-01-18 19:32:15 +0100
commitf5bc0d6b695403c5bd3905f85b34f28548513580 (patch)
treec930eac7b3bc345e3d415f8027f109816b84c64e
parent6e3f14bca5b77f24c86fb7fc4e9eb912432a9cba (diff)
downloadcreole-f5bc0d6b695403c5bd3905f85b34f28548513580.tar.gz
Update Makefile and use autopep8 instead of black
-rw-r--r--.flake82
-rw-r--r--.github/workflows/pythonapp.yml35
-rw-r--r--Makefile51
-rw-r--r--pyproject.toml4
-rw-r--r--setup.cfg10
-rwxr-xr-xsetup.py4
-rw-r--r--tox.ini8
7 files changed, 54 insertions, 60 deletions
diff --git a/.flake8 b/.flake8
index 40e3b5f..826c171 100644
--- a/.flake8
+++ b/.flake8
@@ -1,4 +1,4 @@
[flake8]
exclude = .pytest_cache, python_creole.egg-info
-ignore = E402
+ignore = E115,E124,E128,E265,E301,E309,E501
max-line-length = 119
diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml
index d1c6fd7..2480f8a 100644
--- a/.github/workflows/pythonapp.yml
+++ b/.github/workflows/pythonapp.yml
@@ -1,9 +1,9 @@
-name: build
+name: test
on: [push]
jobs:
- lint:
+ test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@@ -13,31 +13,16 @@ jobs:
python-version: 3.7
- name: Install package
- run: make install
+ run: |
+ make install-poetry
+ source $HOME/.poetry/env
+ make install
- name: List installed packages
run: poetry run pip freeze
- - name: Run linters
- run: make lint
-
- test:
- needs: lint
- runs-on: ${{ matrix.platform }}
- strategy:
- matrix:
- platform: [ubuntu-latest, macos-latest, windows-latest]
- python-version: [3.6, 3.7, 3.8]
- steps:
- - uses: actions/checkout@v1
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Install package
- run: make install
+# - name: Run linters
+# run: make lint
- - name: Run unit tests
- run: make test
+ - name: Run pytest via tox
+ run: make tox
diff --git a/Makefile b/Makefile
index d16c2a9..a3988c3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,47 @@
-.PHONY: help install lint fix test release
-
-VERSION := $$(poetry version | sed -n 's/contxt-sdk //p')
+SHELL := /bin/bash
+MAX_LINE_LENGTH := 119
+POETRY_VERSION := $(shell poetry --version 2>/dev/null)
help: ## List all commands
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z -]+:.*?## / {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
-install:
- pip install poetry
+check-poetry:
+ @if [[ "${POETRY_VERSION}" == *"Poetry"* ]] ; \
+ then \
+ echo "Found version poetry v${POETRY_VERSION}, ok." ; \
+ else \
+ echo 'Please install poetry first, with e.g.:' ; \
+ echo 'make install-poetry' ; \
+ exit 1 ; \
+ fi
+
+install-poetry: ## install or update poetry
+ @if [[ "${POETRY_VERSION}" == *"Poetry"* ]] ; \
+ then \
+ echo 'Update poetry v$(POETRY_VERSION)' ; \
+ poetry self update ; \
+ else \
+ echo 'Install poetry' ; \
+ curl -sSL "https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py" | python3 ; \
+ fi
+
+install: check-poetry ## install python-creole via poetry
poetry install
lint: ## Run code formatters and linter
- poetry run isort --check-only --recursive creole
- poetry run black --line-length=119 --check creole
+# poetry run isort --check-only --recursive creole
+# poetry run black --line-length=119 --check creole
poetry run flake8 creole
-fix: ## Fix code formatting
- poetry run flynt --line_length=119 creole
- poetry run isort --apply --recursive creole
- poetry run black --line-length=119 creole
+fix-code-style: ## Fix code formatting
+# poetry run flynt --line_length=119 creole
+# poetry run isort --apply --recursive creole
+ poetry run autopep8 --ignore-local-config --max-line-length=${MAX_LINE_LENGTH} --aggressive --aggressive --in-place --recursive creole
-test: ## Run unit tests
+tox: check-poetry ## Run pytest via tox
+ poetry run tox
+
+pytest: check-poetry ## Run pytest
poetry run pytest
release: ## Release new version [usage: v=rule]
@@ -30,4 +52,7 @@ release: ## Release new version [usage: v=rule]
git commit pyproject.toml CHANGELOG.md -m "Bump version to $(VERSION)" && git tag "v$(VERSION)"
git push && git push --tags
# Publish to pypi
- poetry publish --build \ No newline at end of file
+ poetry publish --build
+
+
+.PHONY: help install lint fix test release \ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index fab8cc7..9e781e4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -37,12 +37,14 @@ python = '^3.6'
docutils = "^0.16"
[tool.poetry.dev-dependencies]
+tox = "^3.14.3"
+pygments = "^2.5.2"
pytest = '^4.6'
pytest-cov = "^2.8.1"
isort = "^4.3.21"
-black = "^19.10b0"
flake8 = "^3.7.9"
flynt = "^0.40.1"
+autopep8 = "^1.4.4"
[tool.poetry.scripts]
creole2html = 'creole.cmdline:cli_creole2html'
diff --git a/setup.cfg b/setup.cfg
index b0a6182..56f4451 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,15 +1,5 @@
-[flake8]
-ignore=E115,E124,E128,E265,E301,E309,E501
-max-line-length = 119
-
[metadata]
license-file = LICENSE
[bdist_wheel]
universal = 1
-
-[nosetests]
-verbose=True
-verbosity=2
-detailed-errors=1
-with-doctest=1 \ No newline at end of file
diff --git a/setup.py b/setup.py
index fdf3d42..8ef235d 100755
--- a/setup.py
+++ b/setup.py
@@ -256,9 +256,6 @@ setup(
"html2textile = creole.cmdline:cli_html2textile",
],
},
- tests_require=[
- "nose", # https://pypi.python.org/pypi/nose
- ],
zip_safe=True, # http://packages.python.org/distribute/setuptools.html#setting-the-zip-safe-flag
keywords="creole markup creole2html html2creole rest2html html2rest html2textile",
classifiers=[
@@ -282,5 +279,4 @@ setup(
"Topic :: Text Processing :: Markup :: HTML",
"Topic :: Utilities",
],
- test_suite="nose.collector",
)
diff --git a/tox.ini b/tox.ini
index ea3d002..479fc65 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,16 +4,12 @@ envlist =
py36,
py37,
py38
+skip_missing_interpreters = True
[testenv]
whitelist_externals = make
-deps =
- pytest
- pytest-cov
- poetry
commands =
make install
- poetry run pip freeze
- make test
+ make pytest
make lint