Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
komuw committed Feb 27, 2019
1 parent 331dc05 commit ab0d873
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 117 deletions.
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Thank you for thinking of contributing to xyzabc.
Every contribution to xyzabc is important to.
Thank you for thinking of contributing to wiji.
Every contribution to wiji is important to.


Contributor offers to license certain software (a “Contribution” or multiple
“Contributions”) to xyzabc, and xyzabc agrees to accept said Contributions,
“Contributions”) to wiji, and wiji agrees to accept said Contributions,
under the terms of the MIT License.
Contributor understands and agrees that xyzabc shall have the irrevocable and perpetual right to make
Contributor understands and agrees that wiji shall have the irrevocable and perpetual right to make
and distribute copies of any Contribution, as well as to create and distribute collective works and
derivative works of any Contribution, under the MIT License.

Expand All @@ -31,7 +31,7 @@ flake8 .
```
- run [pylint](https://pypi.python.org/pypi/pylint) on the code and fix any issues:
```shell
pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ xyzabc/ tests/ cli/
pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ wiji/ tests/ cli/
```
- run bandit
```shell
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## What operating system and version of operating system are you using?

## What version of xyzabc are you using? `xyzabc-cli --version`
## What version of wiji are you using? `wiji-cli --version`

## What did you do? (be as detailed as you can)

## What did you expect to see/happen/not happen?

## What did you actually see/happen?

## Paste here the log output generated by `xyzabc`, if any. Please remember to remove any sensitive items from the log before pasting here.
## If you can, run xyzabc with loglevel set to debug; eg `xyzabc-cli --loglevel DEBUG`
## Paste here the log output generated by `wiji`, if any. Please remember to remove any sensitive items from the log before pasting here.
## If you can, run wiji with loglevel set to debug; eg `wiji-cli --loglevel DEBUG`
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Thank you for contributing to xyzabc.
Every contribution to xyzabc is important.
Thank you for contributing to wiji.
Every contribution to wiji is important.


Contributor offers to license certain software (a “Contribution” or multiple
“Contributions”) to xyzabc, and xyzabc agrees to accept said Contributions,
“Contributions”) to wiji, and wiji agrees to accept said Contributions,
under the terms of the MIT License.
Contributor understands and agrees that xyzabc shall have the irrevocable and perpetual right to make
Contributor understands and agrees that wiji shall have the irrevocable and perpetual right to make
and distribute copies of any Contribution, as well as to create and distribute collective works and
derivative works of any Contribution, under the MIT License.

Expand Down
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ script:
- find . -name '*.pyc' -delete;find . -name '__pycache__' -delete | xargs echo
- black --line-length=100 --check . || { printf "\\n\\t please use black to format your code."; exit 77; }
- flake8 .
- pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ xyzabc/ tests/ cli/ documentation/
- pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ wiji/ tests/ cli/ documentation/
- bandit -r --exclude .venv -ll .
# to find types, use reveal_type eg: reveal_type(asyncio.get_event_loop())
# see: http://mypy.readthedocs.io/en/latest/common_issues.html#displaying-the-type-of-an-expression
- mypy --show-column-numbers xyzabc/ #--strict
- xyzabc-cli --version && xyzabc-cli --help
- xyzabc-cli --config examples/example_config.json --dry-run
- mypy --show-column-numbers wiji/ #--strict
- wiji-cli --version && wiji-cli --help
- wiji-cli --config examples/example_config.json --dry-run
- coverage erase
- export CI_ENVIRONMENT=Yes && coverage run --omit="*tests*,*cli/test_*,*examples/*,*.virtualenvs/*,*virtualenv/*,*.venv/*,*__init__*" -m unittest discover -v -s . && bash <(curl -s https://codecov.io/bash)
- coverage report --show-missing --fail-under=84
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
upload:
@rm -rf build
@rm -rf dist
@sudo rm -rf xyzabc.egg-info
@sudo rm -rf wiji.egg-info
@python setup.py sdist
@python setup.py bdist_wheel
@twine upload dist/* -r testpypi
@pip install -U -i https://testpypi.python.org/pypi xyzabc
@pip install -U -i https://testpypi.python.org/pypi wiji


VERSION_STRING=$$(cat xyzabc/__version__.py | grep "__version__" | sed -e 's/"__version__"://' | sed -e 's/,//g' | sed -e 's/"//g' | sed -e 's/ //g')
VERSION_STRING=$$(cat wiji/__version__.py | grep "__version__" | sed -e 's/"__version__"://' | sed -e 's/,//g' | sed -e 's/"//g' | sed -e 's/ //g')
uploadprod:
@rm -rf build
@rm -rf dist
@sudo rm -rf xyzabc.egg-info
@sudo rm -rf wiji.egg-info
@python setup.py sdist
@python setup.py bdist_wheel
@twine upload dist/*
@printf "\n creating git tag: $(VERSION_STRING) \n"
@printf "\n with commit message, see Changelong: https://github.com/komuw/xyzabc/blob/master/CHANGELOG.md \n" && git tag -a "$(VERSION_STRING)" -m "see Changelong: https://github.com/komuw/xyzabc/blob/master/CHANGELOG.md"
@printf "\n with commit message, see Changelong: https://github.com/komuw/wiji/blob/master/CHANGELOG.md \n" && git tag -a "$(VERSION_STRING)" -m "see Changelong: https://github.com/komuw/wiji/blob/master/CHANGELOG.md"
@printf "\n git push the tag::\n" && git push --all -u --follow-tags
@pip install -U xyzabc
@pip install -U wiji

# you can run single testcase as;
# python -m unittest -v tests.test_worker.TestWorker.test_can_connect
Expand All @@ -32,11 +32,11 @@ test:
@printf "\n coverage erase::\n" && coverage erase
@printf "\n coverage run::\n" && coverage run --omit="*tests*,*cli/test_*,*examples/*,*.virtualenvs/*,*virtualenv/*,*.venv/*,*__init__*" -m unittest discover -v -s .
@printf "\n coverage report::\n" && coverage report --show-missing --fail-under=84
@printf "\n coverage report html::\n" && coverage html --fail-under=84 --title=xyzabc_coverage
@printf "\n coverage report html::\n" && coverage html --fail-under=84 --title=wiji_coverage
@printf "\n run flake8::\n" && flake8 .
@printf "\n run pylint::\n" && pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ xyzabc/ tests/ cli/ documentation/
@printf "\n run pylint::\n" && pylint --enable=E --disable=W,R,C --unsafe-load-any-extension=y examples/ wiji/ tests/ cli/ documentation/
@printf "\n run bandit::\n" && bandit -r --exclude .venv -ll .
@printf "\n run mypy::\n" && mypy --show-column-numbers --strict xyzabc/
@printf "\n run mypy::\n" && mypy --show-column-numbers --strict wiji/

sphinx:
@sphinx-build -a -E documentation/sphinx-docs/ sphinx-build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## xyzabc
## wiji


xyzabc is an async task processor/runner.
wiji is an async task processor/runner.

It is a bit like [Celery](https://github.com/celery/celery)

Expand Down
42 changes: 21 additions & 21 deletions cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import argparse


import xyzabc
import wiji

os.environ["PYTHONASYNCIODEBUG"] = "1"

Expand Down Expand Up @@ -69,8 +69,8 @@ async def produce_tasks_continously(task, *args, **kwargs):
await task.async_delay(*args, **kwargs)


def BLOCKING_DISK_IO(the_broker) -> xyzabc.task.Task:
class BlockingDiskIOTask(xyzabc.task.Task):
def BLOCKING_DISK_IO(the_broker) -> wiji.task.Task:
class BlockingDiskIOTask(wiji.task.Task):
async def async_run(self, *args, **kwargs):
print()
print("RUNNING BlockingDiskIOTask:")
Expand All @@ -89,8 +89,8 @@ async def async_run(self, *args, **kwargs):
return task


def BLOCKING_http_task(the_broker) -> xyzabc.task.Task:
class MyTask(xyzabc.task.Task):
def BLOCKING_http_task(the_broker) -> wiji.task.Task:
class MyTask(wiji.task.Task):
async def async_run(self, *args, **kwargs):
print()
print("RUNNING BLOCKING_http_task:")
Expand All @@ -111,8 +111,8 @@ async def async_run(self, *args, **kwargs):
return task


def http_task(the_broker) -> xyzabc.task.Task:
class MyTask(xyzabc.task.Task):
def http_task(the_broker) -> wiji.task.Task:
class MyTask(wiji.task.Task):
async def async_run(self, *args, **kwargs):
import aiohttp

Expand All @@ -134,8 +134,8 @@ async def async_run(self, *args, **kwargs):
return task


def print_task(the_broker) -> xyzabc.task.Task:
class MyTask(xyzabc.task.Task):
def print_task(the_broker) -> wiji.task.Task:
class MyTask(wiji.task.Task):
async def async_run(self, *args, **kwargs):
import hashlib

Expand All @@ -161,8 +161,8 @@ async def async_run(self, *args, **kwargs):


################## CHAIN ##################
def adder_task(the_broker, chain=None) -> xyzabc.task.Task:
class AdderTask(xyzabc.task.Task):
def adder_task(the_broker, chain=None) -> wiji.task.Task:
class AdderTask(wiji.task.Task):
async def async_run(self, a, b):
res = a + b
print()
Expand All @@ -184,8 +184,8 @@ async def async_run(self, a, b):
return task


def divider_task(the_broker, chain=None) -> xyzabc.task.Task:
class DividerTask(xyzabc.task.Task):
def divider_task(the_broker, chain=None) -> wiji.task.Task:
class DividerTask(wiji.task.Task):
async def async_run(self, a):
res = a / 3
print()
Expand All @@ -206,8 +206,8 @@ async def async_run(self, a):
return task


def multiplier_task(the_broker, chain=None) -> xyzabc.task.Task:
class MultiplierTask(xyzabc.task.Task):
def multiplier_task(the_broker, chain=None) -> wiji.task.Task:
class MultiplierTask(wiji.task.Task):
async def async_run(self, bbb, a=5.5):
res = bbb * a
print()
Expand All @@ -231,8 +231,8 @@ async def async_run(self, bbb, a=5.5):
################## CHAIN ##################


def exception_task(the_broker, chain=None) -> xyzabc.task.Task:
class ExceptionTask(xyzabc.task.Task):
def exception_task(the_broker, chain=None) -> wiji.task.Task:
class ExceptionTask(wiji.task.Task):
async def async_run(self):
print()
print("RUNNING exception_task:")
Expand All @@ -259,7 +259,7 @@ async def async_run(self):
python cli/cli.py
"""

MY_BROKER = xyzabc.broker.SimpleBroker()
MY_BROKER = wiji.broker.SimpleBroker()

# 1. publish task

Expand Down Expand Up @@ -300,10 +300,10 @@ async def async_run(self):
]
workers = []
for task in all_tasks:
_worker = xyzabc.Worker(the_task=task)
_worker = wiji.Worker(the_task=task)
workers.append(_worker)

watchie_worker = xyzabc.Worker(the_task=xyzabc.task.WatchDogTask)
watchie_worker = wiji.Worker(the_task=wiji.task.WatchDogTask)
workers.append(watchie_worker)

consumers = []
Expand All @@ -316,7 +316,7 @@ async def async_run(self):
produce_tasks_continously(task=adder, a=23, b=67),
produce_tasks_continously(task=exception_task22),
produce_tasks_continously(task=BLOCKING_task, url="https://httpbin.org/delay/11"),
produce_tasks_continously(task=xyzabc.task.WatchDogTask),
produce_tasks_continously(task=wiji.task.WatchDogTask),
]

# 2.consume tasks
Expand Down
20 changes: 10 additions & 10 deletions documentation/sphinx-docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import ast


project = "xyzabc"
project = "wiji"
copyright = "2019, Komu Wairagu"
author = "Komu Wairagu"


here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, "../../xyzabc", "__version__.py"), "r") as f:
with open(os.path.join(here, "../../wiji", "__version__.py"), "r") as f:
x = f.read()
y = x.replace("about = ", "")
about = ast.literal_eval(y)
Expand Down Expand Up @@ -98,15 +98,15 @@
# html_theme_options = {}
# see: https://github.com/bitprophet/alabaster/blob/master/docs/customization.rst
html_theme_options = {
"description": "xyzabc is an async blah blash.",
"description": "wiji is an async blah blash.",
"github_banner": False,
"travis_button": False, # see: https://github.com/bitprophet/alabaster/pull/147
"badge_branch": "master",
"codecov_button": True,
"show_related": True,
"github_user": "komuw",
"pre_bg": "#4c4c4c",
"github_repo": "xyzabc",
"github_repo": "wiji",
"github_type": "star",
"github_button": True,
}
Expand All @@ -130,7 +130,7 @@
# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "xyzabcdoc"
htmlhelp_basename = "wijidoc"


# -- Options for LaTeX output ------------------------------------------------
Expand All @@ -153,14 +153,14 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [(master_doc, "xyzabc.tex", "xyzabc Documentation", "Komu Wairagu", "manual")]
latex_documents = [(master_doc, "wiji.tex", "wiji Documentation", "Komu Wairagu", "manual")]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "xyzabc", "xyzabc Documentation", [author], 1)]
man_pages = [(master_doc, "wiji", "wiji Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -171,10 +171,10 @@
texinfo_documents = [
(
master_doc,
"xyzabc",
"xyzabc Documentation",
"wiji",
"wiji Documentation",
author,
"xyzabc",
"wiji",
"One line description of project.",
"Miscellaneous",
)
Expand Down
2 changes: 1 addition & 1 deletion documentation/sphinx-docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
=======================================================================
xyzabc - xyzabc is an async blah blah
wiji - wiji is an async blah blah
=======================================================================


Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, "xyzabc", "__version__.py"), "r") as f:
with open(os.path.join(here, "wiji", "__version__.py"), "r") as f:
x = f.read()
y = x.replace("about = ", "")
about = ast.literal_eval(y)
Expand Down Expand Up @@ -60,10 +60,10 @@
"Programming Language :: Python :: 3.6",
],
# What does your project relate to?
keywords="xyzabc, blah",
keywords="wiji, blah",
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
# packages=['xyzabc'],
# packages=['wiji'],
packages=find_packages(
exclude=[
"documentation",
Expand Down Expand Up @@ -121,7 +121,7 @@
# 'sample=sample:main',
# ],
# },
entry_points={"console_scripts": ["xyzabc-cli=cli.cli:main"]},
entry_points={"console_scripts": ["wiji-cli=cli.cli:main"]},
)

# python packaging documentation:
Expand Down
Loading

0 comments on commit ab0d873

Please sign in to comment.