Skip to content

Commit

Permalink
Fixed #5 Fixes #27 Fixes #43 Fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
john-g-g committed Oct 2, 2017
1 parent 3e4dd15 commit d14a745
Show file tree
Hide file tree
Showing 42 changed files with 1,269 additions and 871 deletions.
12 changes: 7 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@ root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

# 4 space indentation
[*.py]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

# isort config
force_single_line=True

known_third_party=aiocache,aiohttp,funcy,pygtrie,ujson,sanic,statsd,websockets,statsd,janus,aiojobs,cytoolz

from_first=False

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2


# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: autopep8-wrapper
args: ['--experimental', '-i', '-j 4']
args: ['--experimental', '-i', '-j 4','--max-line-length=100', '-a', '-a']
#- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
# sha: v1.1.0
# hooks:
Expand Down
8 changes: 4 additions & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ persistent=yes
load-plugins=

# Use multiple processes to speed up Pylint.
jobs=1
jobs=4

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down Expand Up @@ -144,7 +144,7 @@ disable=
# Set the output format. Available formats are text, parseable, colorized, msvs
# (visual studio) and html. You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
output-format=colorized

# 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
Expand All @@ -153,7 +153,7 @@ output-format=text
files-output=no

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

# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
Expand All @@ -164,7 +164,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme

# 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=
msg-template='{path}:{line} {symbol} {obj}'


[BASIC]
Expand Down
60 changes: 44 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PROJECT_DOCKER_RUN_ARGS := -p8080:8080

PIPENV_VENV_IN_PROJECT := 1
export PIPENV_VENV_IN_PROJECT
PYTHON_VERSION := 3.6

ENVFILE := .env

Expand All @@ -18,13 +19,23 @@ help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.PHONY: init
init:
pip3 install pipenv
init: ## install project requrements into .venv
#pip3 install pipenv
pipenv install --three --dev
pipenv run pre-commit install

.PHONY: reset-venv
reset-venv: ## reinstall pipenv
-rm -rf .venv
pip3 uninstall pipenv
pip3 install --upgrade pip
pip3 install pipenv

.PHONY: re-init
re-init: reset-venv init ## and project requirements into .venv

.PHONY: clean
clean:
clean: ## clean python and dev junk
find . -name "__pycache__" | xargs rm -rf
-rm -rf .cache
-rm -rf .eggs
Expand All @@ -34,11 +45,11 @@ clean:
-rm -rf service/*/supervise

.PHONY: build
build: clean clean-perf
build: clean clean-perf ## build docker image
docker build -t $(PROJECT_DOCKER_TAG) .

.PHONY: run
run:
run: ## run docker image
docker run $(PROJECT_DOCKER_RUN_ARGS) $(PROJECT_DOCKER_TAG)

.PHONY: run-local
Expand All @@ -61,12 +72,19 @@ lint: ## lint python files
fmt: ## format python files
# yapf is disabled until the update 3.6 fstring compat
#pipenv run yapf --in-place --style pep8 --recursive $(PROJECT_NAME)
pipenv run autopep8 --aggressive --in-place --jobs 0 --recursive $(PROJECT_NAME)
pipenv run autopep8 --verbose --verbose --max-line-length=100 --experimental --aggressive --aggressive --jobs -1 --in-place --recursive $(PROJECT_NAME)

.PHONY: fix-imports
fix-imports: ## remove unused imports from python files
fix-imports: remove-unused-imports sort-imports ## remove unused and then sort imports

.PHONY: remove-unused-imports
remove-unused-imports: ## remove unused imports from python files
pipenv run autoflake --in-place --remove-all-unused-imports --recursive $(PROJECT_NAME)

.PHONY: sort-imports
sort-imports: ## sorts python imports using isort with settings from .editorconfig
pipenv run isort --verbose --recursive --atomic --settings-path .editorconfig --virtual-env .venv $(PROJECT_NAME)

.PHONY: pre-commit
pre-commit: ## run pre-commit against modified files
pipenv run pre-commit run
Expand All @@ -75,25 +93,35 @@ pre-commit: ## run pre-commit against modified files
pre-commit-all: ## run pre-commit against all files
pipenv run pre-commit run --all-files

.PHONY: check-all
check-all: pre-commit-all test

.PHONY: prepare
prepare: test build fmt fix-imports lint pre-commit-all
prepare: test fmt fix-imports lint pre-commit-all ## test fmt fix-imports lint and pre-commit

.PHONY: prepare-and-build
prepare-and-build: prepare build ## run all tests, formatting and pre-commit checks, then build docker image

.PHONY: mypy
mypy: ## run mypy type checking on python files
pipenv run mypy --ignore-missing-imports $(PROJECT_NAME)
pipenv run mypy --ignore-missing-imports --python-version $(PYTHON_VERSION) $(PROJECT_NAME)

.PHONY: curl-check
curl-check:
.PHONY: curl-8080
curl-8080:
curl http://localhost:8080/
curl http://localhost:8080/health
curl http://localhost:8080/.well-known/healthcheck.json
curl -d '{"id":1,"jsonrpc":"2.0","method":"get_block","params":[1000]}' \
-H'Content-Type:application/json' \
localhost:8080

.PHONY: curl-9000
curl-9000:
curl http://localhost:9000/
curl http://localhost:9000/health
curl http://localhost:9000/.well-known/healthcheck.json
curl -d '{"id":1,"jsonrpc":"2.0","method":"get_block","params":[1000]}' \
-H'Content-Type:application/json' \
localhost:9000


.PHONY: steemd-calls
steemd-calls:
pipenv run python tests/make_api_calls.py tests/steemd_jsonrpc_calls.json http://localhost:8080
Expand All @@ -108,9 +136,9 @@ steemd-calls:
pipenv run gprof2dot -f pstats $< | dot -Tpng -o $@

.PHONY: clean-perf
clean-perf:
clean-perf: ## clean pstats and flamegraph svgs
rm -rf $(ROOT_DIR)/perf

.PHONY: install-python-steem-macos
install-python-steem-macos:
install-python-steem-macos: ## install steem-python lib on macos using homebrew's openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pipenv install steem
41 changes: 22 additions & 19 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,44 @@ url = "https://pypi.python.org/simple"
verify_ssl = true

[dev-packages]

asynctest = "*"
autoflake = "*"
autopep8 = "*"
"autopep8" = "*"
awscli = "*"
certifi = "*"
crayons = "*"
gprof2dot = "*"
"gprof2dot" = "*"
ipython = "*"
mypy = "*"
pep8 = "*"
pre-commit = "*"
"pep8" = "*"
"pre-commit" = "*"
pylint = "*"
pyprof2calltree = "*"
"pyprof2calltree" = "*"
pytest = "*"
pytest-asyncio = "*"
pytest-console-scripts = "*"
pytest-cov = "*"
pytest-docker = "*"
pytest-mock = "*"
pytest-profiling = "*"
pytest-pylint = "*"
pytest-sanic = "*"
pytest-timeout = "*"
"pytest-asyncio" = "*"
"pytest-console-scripts" = "*"
"pytest-cov" = "*"
"pytest-docker" = "*"
"pytest-mock" = "*"
"pytest-profiling" = "*"
"pytest-pylint" = "*"
"pytest-sanic" = "*"
"pytest-timeout" = "*"
recommonmark = "*"
redis = "*"
requests = "*"
sphinx = "*"
sphinxcontrib-programoutput = "*"
sphinxcontrib-restbuilder = "*"
urllib3 = "*"
"sphinxcontrib-programoutput" = "*"
"sphinxcontrib-restbuilder" = "*"
"urllib3" = "*"
yapf = "*"
progress = "*"
jsonschema = "*"
isort = "*"

[packages]

ujson = "*"
aiohttp = "*"
toolz = "*"
Expand All @@ -52,9 +55,9 @@ pipenv = "*"
sanic = "*"
cytoolz = "*"
janus = "*"
python-json-logger = "*"
"python-json-logger" = "*"
cchardet = "*"
async-timeout = "*"
"async-timeout" = "*"
progress = "*"
pytest = "*"

Expand Down
Loading

0 comments on commit d14a745

Please sign in to comment.