Skip to content

Commit

Permalink
setup of project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Strigl committed Dec 19, 2020
1 parent 420a250 commit dca52c4
Show file tree
Hide file tree
Showing 24 changed files with 361 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 120
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
language: python
dist: xenial
python:
- "3.7"
- "3.8"
install: pip install tox-travis
script: tox
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# History

## 0.1.0 (202?-??-??)

* First release on PyPI.
33 changes: 33 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Heliotherm heat pump KNX gateway
Copyright (C) 2020 Daniel Strigl

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
16 changes: 16 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include HISTORY.md
include README.md
include LICENSE

include .editorconfig
include .flake8
include tox.ini

recursive-include htknx *
recursive-include requirements *.pip
recursive-include tests *

global-exclude __pycache__
global-exclude .coverage
global-exclude *.py[co]
global-exclude .git*
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,71 @@
# htknx

[![PyPI version](https://img.shields.io/pypi/v/htknx.svg)](https://pypi.org/project/htknx)
[![Python versions](https://img.shields.io/pypi/pyversions/htknx.svg)](https://pypi.org/project/htknx)
[![License](https://img.shields.io/pypi/l/htknx.svg)](https://pypi.org/project/htknx)
[![Build status](https://img.shields.io/travis/dstrigl/htknx/master?logo=travis)](https://travis-ci.org/dstrigl/htknx)
[![Updates](https://pyup.io/repos/github/dstrigl/htknx/shield.svg)](https://pyup.io/repos/github/dstrigl/htknx)


[Heliotherm](http://www.heliotherm.com/) heat pump KNX gateway for Python 3.7 and 3.8.

* GitHub repo: https://github.com/dstrigl/htknx
* Free software: [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.en.html)


> **Warning:**
>
> Please note that any incorrect or careless usage of this application as well as
> errors in the implementation can damage your heat pump!
>
> Therefore, the author does not provide any guarantee or warranty concerning
> to correctness, functionality or performance and does not accept any liability
> for damage caused by this application, examples or mentioned information.
>
> **Thus, use it on your own risk!**

### Wanna support me?

[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/N362PLZ)


## Installation

You can install or upgrade `htknx` with:

```
$ pip install htknx --upgrade
```

Or you can install from source with:

```
$ git clone https://github.com/dstrigl/htknx.git
$ cd htknx
$ python setup.py install
```


## Usage

```
TODO
```


### Example

```
TODO
```


## Credits

* Project dependencies scanned by [PyUp.io](https://pyup.io).


## License

Distributed under the terms of the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.en.html).
18 changes: 18 additions & 0 deletions htknx/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# htknx - Heliotherm heat pump KNX gateway
# Copyright (C) 2020 Daniel Strigl

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
8 changes: 4 additions & 4 deletions htknx.py → htknx/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
from htheatpump import HtHeatpump
from typing import Dict, Optional, Type

from config import Config
from htdatapoint import HtDataPoint
from htfaultnotification import HtFaultNotification
from __version__ import __version__
from .config import Config
from .htdatapoint import HtDataPoint
from .htfaultnotification import HtFaultNotification
from .__version__ import __version__


_LOGGER = logging.getLogger(__name__)
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions config_validation.py → htknx/config_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

# Adapted from:
# https://github.com/alecthomas/voluptuous/issues/115#issuecomment-144464666
#
def has_at_least_one_key(*keys: str) -> Callable:
""" Validate that at least one key exists. """

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions htknx.yaml → htknx/htknx.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#
# Sample configuration
#

general:
update_interval:
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions requirements/develop.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flake8==3.8.4
tox==3.20.1
Empty file added requirements/doc.pip
Empty file.
2 changes: 2 additions & 0 deletions requirements/install.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
htheatpump==1.2.4 # --> async-htheatpump
xknx==0.15.6
6 changes: 6 additions & 0 deletions requirements/test.pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mypy==0.790
coverage==5.3
pytest==6.2.1
pytest-mypy==0.8.0
pytest-cov==2.10.1
pytest-sugar==0.9.4
14 changes: 14 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool:pytest]
addopts =
--mypy
--cov=htknx
--cov-report=term
--cov-config=setup.cfg

[mypy]
# suppress errors about unsatisfied imports
ignore_missing_imports=True

[coverage:run]
omit =
tests/*
117 changes: 117 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" The setup script """

import io
import os
import re
from setuptools import setup, find_packages


def read(*parts):
""" Read file. """
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), *parts)
with open(filename, encoding="utf-8", mode="rt") as fp:
return fp.read()


def get_version():
""" Get current version from code. """
regex = r"__version__\s=\s\"(?P<version>[\d\.]+?)\""
path = ("htknx", "__version__.py")
return re.search(regex, read(*path)).group("version")


# Get the description from the README file
with open("README.md") as readme_file:
readme = readme_file.read()

# Get the history from the HISTORY file
with open("HISTORY.md") as history_file:
history = history_file.read()


def pip(filename):
""" Parse pip reqs file and transform it to setuptools requirements. """
requirements = []
for line in io.open(os.path.join("requirements", "{0}.pip".format(filename))):
line = line.strip()
if not line or "://" in line or line.startswith("#"):
continue
requirements.append(line)
return requirements


install_requires = pip("install")
doc_require = pip("doc")
tests_require = pip("test")
dev_require = tests_require + pip("develop")


setup(
# Project name
name="htknx",
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=get_version(),
# Project description
description="Heliotherm heat pump KNX gateway",
long_description=readme + "\n\n" + history,
long_description_content_type="text/markdown",
# Choosen license
license="GNU General Public License v3",
# The project's main homepage
url="https://github.com/dstrigl/htknx",
# Author details
author="Daniel Strigl",
# author_email="?",
# Supported platforms
platforms=["Linux"],
# Project packages
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
include_package_data=True,
# Project requirements (used by pip to install its dependencies)
install_requires=install_requires,
tests_require=tests_require,
# dev_require=dev_require, # UserWarning: Unknown distribution option: 'dev_require'
extras_require={"test": tests_require, "doc": doc_require, "dev": dev_require},
# Prevent zip archive creation
zip_safe=False,
# Keywords that describes the project
keywords="python python3 heatpump Heliotherm knx bus gateway",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
"Development Status :: 4 - Beta",
# Indicate who your project is intended for
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Intended Audience :: Manufacturing",
# Pick your license as you wish (should match "license" above)
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
# Language and Platform
"Natural Language :: English",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
# Additional topic classifier
"Topic :: Communications",
"Topic :: Home Automation",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Embedded Systems",
"Topic :: Terminals :: Serial",
],
# Entry points specification
entry_points={"console_scripts": ["htknx=htknx.__main__:main"]},
)
18 changes: 18 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# htknx - Heliotherm heat pump KNX gateway
# Copyright (C) 2020 Daniel Strigl

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22 changes: 22 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tox]
envlist = py{37,38}, flake8

[travis]
python =
3.8: py38, flake8
3.7: py37, flake8

[testenv]
deps =
-r{toxinidir}/requirements/test.pip
commands =
python --version
pytest {posargs} htknx tests

[testenv:flake8]
basepython = python
deps =
-r{toxinidir}/requirements/develop.pip
commands =
python --version
flake8 htknx tests setup.py

0 comments on commit dca52c4

Please sign in to comment.