From f2fa91a65fc7f12878055363e094a1d60b45f007 Mon Sep 17 00:00:00 2001 From: bpaulin Date: Fri, 26 Apr 2019 09:16:30 +0200 Subject: [PATCH] clean --- AUTHORS.rst | 13 --- CONTRIBUTING.rst | 128 ------------------------------ HISTORY.rst => HISTORY.md | 0 MANIFEST.in | 12 +-- Makefile | 88 --------------------- README.md | 15 ++++ README.rst | 41 ---------- brownpaperbag/bpbgate.py | 7 +- brownpaperbag/cli.py | 1 + docs/Makefile | 20 ----- docs/authors.rst | 1 - docs/conf.py | 161 -------------------------------------- docs/contributing.rst | 1 - docs/history.rst | 1 - docs/index.rst | 20 ----- docs/installation.rst | 51 ------------ docs/make.bat | 36 --------- docs/readme.rst | 1 - docs/usage.rst | 7 -- requirements_dev.txt | 1 - setup.py | 5 +- tox.ini | 6 +- 22 files changed, 28 insertions(+), 588 deletions(-) delete mode 100644 AUTHORS.rst delete mode 100644 CONTRIBUTING.rst rename HISTORY.rst => HISTORY.md (100%) delete mode 100644 Makefile create mode 100644 README.md delete mode 100644 README.rst delete mode 100644 docs/Makefile delete mode 100644 docs/authors.rst delete mode 100755 docs/conf.py delete mode 100644 docs/contributing.rst delete mode 100644 docs/history.rst delete mode 100644 docs/index.rst delete mode 100644 docs/installation.rst delete mode 100644 docs/make.bat delete mode 100644 docs/readme.rst delete mode 100644 docs/usage.rst diff --git a/AUTHORS.rst b/AUTHORS.rst deleted file mode 100644 index 5c37e18..0000000 --- a/AUTHORS.rst +++ /dev/null @@ -1,13 +0,0 @@ -======= -Credits -======= - -Development Lead ----------------- - -* Bruno Paulin - -Contributors ------------- - -None yet. Why not be the first? diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index d2e94f7..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,128 +0,0 @@ -.. highlight:: shell - -============ -Contributing -============ - -Contributions are welcome, and they are greatly appreciated! Every little bit -helps, and credit will always be given. - -You can contribute in many ways: - -Types of Contributions ----------------------- - -Report Bugs -~~~~~~~~~~~ - -Report bugs at https://github.com/bpaulin/brownpaperbag/issues. - -If you are reporting a bug, please include: - -* Your operating system name and version. -* Any details about your local setup that might be helpful in troubleshooting. -* Detailed steps to reproduce the bug. - -Fix Bugs -~~~~~~~~ - -Look through the GitHub issues for bugs. Anything tagged with "bug" and "help -wanted" is open to whoever wants to implement it. - -Implement Features -~~~~~~~~~~~~~~~~~~ - -Look through the GitHub issues for features. Anything tagged with "enhancement" -and "help wanted" is open to whoever wants to implement it. - -Write Documentation -~~~~~~~~~~~~~~~~~~~ - -brownpaperbag could always use more documentation, whether as part of the -official brownpaperbag docs, in docstrings, or even on the web in blog posts, -articles, and such. - -Submit Feedback -~~~~~~~~~~~~~~~ - -The best way to send feedback is to file an issue at https://github.com/bpaulin/brownpaperbag/issues. - -If you are proposing a feature: - -* Explain in detail how it would work. -* Keep the scope as narrow as possible, to make it easier to implement. -* Remember that this is a volunteer-driven project, and that contributions - are welcome :) - -Get Started! ------------- - -Ready to contribute? Here's how to set up `brownpaperbag` for local development. - -1. Fork the `brownpaperbag` repo on GitHub. -2. Clone your fork locally:: - - $ git clone git@github.com:your_name_here/brownpaperbag.git - -3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: - - $ mkvirtualenv brownpaperbag - $ cd brownpaperbag/ - $ python setup.py develop - -4. Create a branch for local development:: - - $ git checkout -b name-of-your-bugfix-or-feature - - Now you can make your changes locally. - -5. When you're done making changes, check that your changes pass flake8 and the - tests, including testing other Python versions with tox:: - - $ flake8 brownpaperbag tests - $ python setup.py test or py.test - $ tox - - To get flake8 and tox, just pip install them into your virtualenv. - -6. Commit your changes and push your branch to GitHub:: - - $ git add . - $ git commit -m "Your detailed description of your changes." - $ git push origin name-of-your-bugfix-or-feature - -7. Submit a pull request through the GitHub website. - -Pull Request Guidelines ------------------------ - -Before you submit a pull request, check that it meets these guidelines: - -1. The pull request should include tests. -2. If the pull request adds functionality, the docs should be updated. Put - your new functionality into a function with a docstring, and add the - feature to the list in README.rst. -3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check - https://travis-ci.org/bpaulin/brownpaperbag/pull_requests - and make sure that the tests pass for all supported Python versions. - -Tips ----- - -To run a subset of tests:: - -$ py.test tests.test_brownpaperbag - - -Deploying ---------- - -A reminder for the maintainers on how to deploy. -Make sure all your changes are committed (including an entry in HISTORY.rst). -Then run:: - -$ bumpversion patch # possible: major / minor / patch -$ git push -$ git push --tags - -Travis will then deploy to PyPI if tests pass. diff --git a/HISTORY.rst b/HISTORY.md similarity index 100% rename from HISTORY.rst rename to HISTORY.md diff --git a/MANIFEST.in b/MANIFEST.in index 965b2dd..3fe6be0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1 @@ -include AUTHORS.rst -include CONTRIBUTING.rst -include HISTORY.rst -include LICENSE -include README.rst - -recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +include HISTORY.md diff --git a/Makefile b/Makefile deleted file mode 100644 index ceea3a5..0000000 --- a/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -.PHONY: clean clean-test clean-pyc clean-build docs help -.DEFAULT_GOAL := help - -define BROWSER_PYSCRIPT -import os, webbrowser, sys - -try: - from urllib import pathname2url -except: - from urllib.request import pathname2url - -webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) -endef -export BROWSER_PYSCRIPT - -define PRINT_HELP_PYSCRIPT -import re, sys - -for line in sys.stdin: - match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) - if match: - target, help = match.groups() - print("%-20s %s" % (target, help)) -endef -export PRINT_HELP_PYSCRIPT - -BROWSER := python -c "$$BROWSER_PYSCRIPT" - -help: - @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) - -clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts - -clean-build: ## remove build artifacts - rm -fr build/ - rm -fr dist/ - rm -fr .eggs/ - find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + - -clean-pyc: ## remove Python file artifacts - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -fr {} + - -clean-test: ## remove test and coverage artifacts - rm -fr .tox/ - rm -f .coverage - rm -fr htmlcov/ - rm -fr .pytest_cache - -lint: ## check style with flake8 - flake8 brownpaperbag tests - -test: ## run tests quickly with the default Python - py.test - -test-all: ## run tests on every Python version with tox - tox - -coverage: ## check code coverage quickly with the default Python - coverage run --source brownpaperbag -m pytest - coverage report -m - coverage html - $(BROWSER) htmlcov/index.html - -docs: ## generate Sphinx HTML documentation, including API docs - rm -f docs/brownpaperbag.rst - rm -f docs/modules.rst - sphinx-apidoc -o docs/ brownpaperbag - $(MAKE) -C docs clean - $(MAKE) -C docs html - $(BROWSER) docs/_build/html/index.html - -servedocs: docs ## compile the docs watching for changes - watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . - -release: dist ## package and upload a release - twine upload dist/* - -dist: clean ## builds source and wheel package - python setup.py sdist - python setup.py bdist_wheel - ls -l dist - -install: clean ## install the package to the active Python's site-packages - python setup.py install diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ebc10f --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# brownpaperbag + +[![image](https://img.shields.io/pypi/v/brownpaperbag.svg)](https://pypi.python.org/pypi/brownpaperbag) + +[![image](https://img.shields.io/travis/bpaulin/brownpaperbag.svg)](https://travis-ci.org/bpaulin/brownpaperbag) + +[![Updates](https://pyup.io/repos/github/bpaulin/brownpaperbag/shield.svg)](https://pyup.io/repos/github/bpaulin/brownpaperbag/) + +But you try and tell the young people today that... + + - Free software: MIT license + +## Features + + - TODO diff --git a/README.rst b/README.rst deleted file mode 100644 index 7062dee..0000000 --- a/README.rst +++ /dev/null @@ -1,41 +0,0 @@ -============= -brownpaperbag -============= - - -.. image:: https://img.shields.io/pypi/v/brownpaperbag.svg - :target: https://pypi.python.org/pypi/brownpaperbag - -.. image:: https://img.shields.io/travis/bpaulin/brownpaperbag.svg - :target: https://travis-ci.org/bpaulin/brownpaperbag - -.. image:: https://readthedocs.org/projects/brownpaperbag/badge/?version=latest - :target: https://brownpaperbag.readthedocs.io/en/latest/?badge=latest - :alt: Documentation Status - - -.. image:: https://pyup.io/repos/github/bpaulin/brownpaperbag/shield.svg - :target: https://pyup.io/repos/github/bpaulin/brownpaperbag/ - :alt: Updates - - - -But you try and tell the young people today that... - - -* Free software: MIT license -* Documentation: https://brownpaperbag.readthedocs.io. - - -Features --------- - -* TODO - -Credits -------- - -This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template. - -.. _Cookiecutter: https://github.com/audreyr/cookiecutter -.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage diff --git a/brownpaperbag/bpbgate.py b/brownpaperbag/bpbgate.py index ef88a10..8077a38 100644 --- a/brownpaperbag/bpbgate.py +++ b/brownpaperbag/bpbgate.py @@ -65,6 +65,7 @@ async def _readuntil(self, separator): return response async def readevent(self, separator="##"): + """Listen to gateway events.""" data = await self._reader.readuntil(separator.encode()) response = data.decode() self.logger.debug("received: " + response) @@ -153,17 +154,17 @@ async def send_list(self, who): return hitems async def get_light_ids(self): - """return list of all lights ids""" + """Return list of all lights ids.""" self.logger.info("polling lights") return await self.send_list("1") async def get_cover_ids(self): - """return list of all cover ids""" + """Return list of all cover ids.""" self.logger.info("polling covers") return await self.send_list("2") async def get_energy_ids(self): - """return list of all cover ids""" + """Return list of all cover ids.""" self.logger.info("polling covers") return await self.send_list("18") diff --git a/brownpaperbag/cli.py b/brownpaperbag/cli.py index 0cac4e5..c884903 100644 --- a/brownpaperbag/cli.py +++ b/brownpaperbag/cli.py @@ -67,6 +67,7 @@ def raw(ctx, command): @click.argument("id") @click.pass_context def light(ctx, operation, id): + """Interact with a light.""" gate = ctx.obj["GATE"] loop = asyncio.get_event_loop() try: diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 7b3faed..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = python -msphinx -SPHINXPROJ = brownpaperbag -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/authors.rst b/docs/authors.rst deleted file mode 100644 index e122f91..0000000 --- a/docs/authors.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../AUTHORS.rst diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100755 index 23e0eed..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# brownpaperbag documentation build configuration file, created by -# sphinx-quickstart on Fri Jun 9 13:47:02 2017. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another -# directory, add these directories to sys.path here. If the directory is -# relative to the documentation root, use os.path.abspath to make it -# absolute, like shown here. -# -import os -import sys - -sys.path.insert(0, os.path.abspath("..")) - -import brownpaperbag - -# -- General configuration --------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = ".rst" - -# The master toctree document. -master_doc = "index" - -# General information about the project. -project = u"brownpaperbag" -copyright = u"2019, Bruno Paulin" -author = u"Bruno Paulin" - -# The version info for the project you're documenting, acts as replacement -# for |version| and |release|, also used in various other places throughout -# the built documents. -# -# The short X.Y version. -version = brownpaperbag.__version__ -# The full version, including alpha/beta/rc tags. -release = brownpaperbag.__version__ - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a -# theme further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] - - -# -- Options for HTMLHelp output --------------------------------------- - -# Output file base name for HTML help builder. -htmlhelp_basename = "brownpaperbagdoc" - - -# -- Options for LaTeX output ------------------------------------------ - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# 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, - "brownpaperbag.tex", - u"brownpaperbag Documentation", - u"Bruno Paulin", - "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, "brownpaperbag", u"brownpaperbag Documentation", [author], 1)] - - -# -- Options for Texinfo output ---------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - master_doc, - "brownpaperbag", - u"brownpaperbag Documentation", - author, - "brownpaperbag", - "One line description of project.", - "Miscellaneous", - ) -] diff --git a/docs/contributing.rst b/docs/contributing.rst deleted file mode 100644 index e582053..0000000 --- a/docs/contributing.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../CONTRIBUTING.rst diff --git a/docs/history.rst b/docs/history.rst deleted file mode 100644 index 2506499..0000000 --- a/docs/history.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../HISTORY.rst diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index dff2901..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -Welcome to brownpaperbag's documentation! -====================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - readme - installation - usage - modules - contributing - authors - history - -Indices and tables -================== -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/installation.rst b/docs/installation.rst deleted file mode 100644 index ef3da82..0000000 --- a/docs/installation.rst +++ /dev/null @@ -1,51 +0,0 @@ -.. highlight:: shell - -============ -Installation -============ - - -Stable release --------------- - -To install brownpaperbag, run this command in your terminal: - -.. code-block:: console - - $ pip install brownpaperbag - -This is the preferred method to install brownpaperbag, as it will always install the most recent stable release. - -If you don't have `pip`_ installed, this `Python installation guide`_ can guide -you through the process. - -.. _pip: https://pip.pypa.io -.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ - - -From sources ------------- - -The sources for brownpaperbag can be downloaded from the `Github repo`_. - -You can either clone the public repository: - -.. code-block:: console - - $ git clone git://github.com/bpaulin/brownpaperbag - -Or download the `tarball`_: - -.. code-block:: console - - $ curl -OL https://github.com/bpaulin/brownpaperbag/tarball/master - -Once you have a copy of the source, you can install it with: - -.. code-block:: console - - $ python setup.py install - - -.. _Github repo: https://github.com/bpaulin/brownpaperbag -.. _tarball: https://github.com/bpaulin/brownpaperbag/tarball/master diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index bdbea41..0000000 --- a/docs/make.bat +++ /dev/null @@ -1,36 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=python -msphinx -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ=brownpaperbag - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The Sphinx module was not found. Make sure you have Sphinx installed, - echo.then set the SPHINXBUILD environment variable to point to the full - echo.path of the 'sphinx-build' executable. Alternatively you may add the - echo.Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd diff --git a/docs/readme.rst b/docs/readme.rst deleted file mode 100644 index 72a3355..0000000 --- a/docs/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../README.rst diff --git a/docs/usage.rst b/docs/usage.rst deleted file mode 100644 index 911a4f6..0000000 --- a/docs/usage.rst +++ /dev/null @@ -1,7 +0,0 @@ -===== -Usage -===== - -To use brownpaperbag in a project:: - - import brownpaperbag diff --git a/requirements_dev.txt b/requirements_dev.txt index a1cdf2f..230362a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,7 +2,6 @@ pip==19.1 bumpversion==0.5.3 wheel==0.33.1 watchdog==0.9.0 -flake8==3.7.7 tox==3.9.0 coverage==4.5.3 Sphinx==2.0.1 diff --git a/setup.py b/setup.py index 999b16e..de1d720 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,11 @@ from setuptools import setup, find_packages -with open("README.rst") as readme_file: +with open("README.md") as readme_file: readme = readme_file.read() -with open("HISTORY.rst") as history_file: +history = '' +with open("HISTORY.md") as history_file: history = history_file.read() requirements = ["Click>=6.0"] diff --git a/tox.ini b/tox.ini index ac28ee1..1f1636a 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,10 @@ extend-ignore = [testenv:flake8] basepython = python -deps = flake8 +deps = + flake8 + flake8-black + flake8-docstrings commands = flake8 brownpaperbag [testenv] @@ -27,7 +30,6 @@ deps = ; requirements.txt with the pinned versions and uncomment the following line: ; -r{toxinidir}/requirements.txt commands = - pip install -U pip py.test --basetemp={envtmpdir}