From 70bce78f71a81f775cf39b58d71c81fe3effe138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 24 Mar 2020 13:34:13 +0100 Subject: [PATCH] Add initial project skeleton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using ionelmc's [cookiecutter][0] [template][1] with these parameters: _extensions: ['jinja2_time.TimeExtension'] _template: 'gh:ionelmc/cookiecutter-pylibrary' allow_tests_inside_package: 'no' appveyor: 'no' c_extension_function: 'longest' c_extension_module: '_oemof.network' c_extension_optional: 'no' c_extension_support: 'no' c_extension_test_pypi: 'no' c_extension_test_pypi_username: 'oemof' codacy: 'yes' codacy_projectid: 'CODACY_PROJECT_ID' codeclimate: 'yes' codecov: 'no' command_line_interface: 'no' command_line_interface_bin_name: 'oemof.network' coveralls: 'yes' coveralls_token: 'COVERALLSTOKEN' distribution_name: 'oemof.network' email: 'gnn.code@gmail.com' full_name: 'Stephan Günther' landscape: 'no' license: 'MIT license' linter: 'flake8' package_name: 'oemof.network' project_name: 'oemof.network' project_short_description: 'The network/graph submodules of oemof.' pypi_badge: 'yes' pypi_disable_upload: 'no' release_date: '2020-04-01' repo_hosting: 'github.com' repo_hosting_domain: 'github.com' repo_name: 'oemof.network' repo_username: 'oemof' requiresio: 'yes' scrutinizer: 'yes' setup_py_uses_setuptools_scm: 'no' setup_py_uses_test_runner: 'no' sphinx_docs: 'yes' sphinx_docs_hosting: 'https://oemof-network.readthedocs.io/' sphinx_doctest: 'no' sphinx_theme: 'sphinx-rtd-theme' test_matrix_configurator: 'yes' test_matrix_separate_coverage: 'yes' test_runner: 'nose' travis: 'yes' travis_osx: 'no' version: '0.4.0.dev0' website: 'https://oemof.org/' year_from: '2020' year_to: '2020' For completeness: the cookiecutter version used was 1.6.0. [0]: https://pypi.org/project/cookiecutter/ [1]: https://github.com/ionelmc/cookiecutter-pylibrary/tree/bbd851bfdd9d1cb5b25805085c406f4c492e177a --- .bumpversion.cfg | 20 ++++ .cookiecutterrc | 69 ++++++++++++ .coveragerc | 14 +++ .editorconfig | 13 +++ .gitignore | 71 ++++++++++++ .readthedocs.yml | 10 ++ .travis.yml | 78 +++++++++++++ AUTHORS.rst | 5 + CHANGELOG.rst | 8 ++ CONTRIBUTING.rst | 90 +++++++++++++++ LICENSE | 9 ++ MANIFEST.in | 19 ++++ README.rst | 116 +++++++++++++++++++ ci/bootstrap.py | 93 ++++++++++++++++ ci/requirements.txt | 4 + ci/templates/.travis.yml | 46 ++++++++ ci/templates/tox.ini | 103 +++++++++++++++++ docs/authors.rst | 1 + docs/changelog.rst | 1 + docs/conf.py | 47 ++++++++ docs/contributing.rst | 1 + docs/index.rst | 22 ++++ docs/installation.rst | 7 ++ docs/readme.rst | 1 + docs/reference/index.rst | 7 ++ docs/reference/oemof.network.rst | 9 ++ docs/requirements.txt | 2 + docs/spelling_wordlist.txt | 11 ++ docs/usage.rst | 7 ++ setup.cfg | 59 ++++++++++ setup.py | 83 ++++++++++++++ src/oemof.network/__init__.py | 1 + tests/test_oemof.network.py | 6 + tox.ini | 185 +++++++++++++++++++++++++++++++ 34 files changed, 1218 insertions(+) create mode 100644 .bumpversion.cfg create mode 100644 .cookiecutterrc create mode 100644 .coveragerc create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .readthedocs.yml create mode 100644 .travis.yml create mode 100644 AUTHORS.rst create mode 100644 CHANGELOG.rst create mode 100644 CONTRIBUTING.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100755 ci/bootstrap.py create mode 100644 ci/requirements.txt create mode 100644 ci/templates/.travis.yml create mode 100644 ci/templates/tox.ini create mode 100644 docs/authors.rst create mode 100644 docs/changelog.rst create mode 100644 docs/conf.py create mode 100644 docs/contributing.rst create mode 100644 docs/index.rst create mode 100644 docs/installation.rst create mode 100644 docs/readme.rst create mode 100644 docs/reference/index.rst create mode 100644 docs/reference/oemof.network.rst create mode 100644 docs/requirements.txt create mode 100644 docs/spelling_wordlist.txt create mode 100644 docs/usage.rst create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 src/oemof.network/__init__.py create mode 100644 tests/test_oemof.network.py create mode 100644 tox.ini diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..633e0a8 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,20 @@ +[bumpversion] +current_version = 0.4.0.dev0 +commit = True +tag = True + +[bumpversion:file:setup.py] +search = version='{current_version}' +replace = version='{new_version}' + +[bumpversion:file:README.rst] +search = v{current_version}. +replace = v{new_version}. + +[bumpversion:file:docs/conf.py] +search = version = release = '{current_version}' +replace = version = release = '{new_version}' + +[bumpversion:file:src/oemof.network/__init__.py] +search = __version__ = '{current_version}' +replace = __version__ = '{new_version}' diff --git a/.cookiecutterrc b/.cookiecutterrc new file mode 100644 index 0000000..ab8a1f8 --- /dev/null +++ b/.cookiecutterrc @@ -0,0 +1,69 @@ +# This file exists so you can easily regenerate your project. +# +# `cookiepatcher` is a convenient shim around `cookiecutter` +# for regenerating projects (it will generate a .cookiecutterrc +# automatically for any template). To use it: +# +# pip install cookiepatcher +# cookiepatcher gh:ionelmc/cookiecutter-pylibrary project-path +# +# See: +# https://pypi.org/project/cookiepatcher +# +# Alternatively, you can run: +# +# cookiecutter --overwrite-if-exists --config-file=project-path/.cookiecutterrc gh:ionelmc/cookiecutter-pylibrary + +default_context: + + _extensions: ['jinja2_time.TimeExtension'] + _template: 'gh:ionelmc/cookiecutter-pylibrary' + allow_tests_inside_package: 'no' + appveyor: 'no' + c_extension_function: 'longest' + c_extension_module: '_oemof.network' + c_extension_optional: 'no' + c_extension_support: 'no' + c_extension_test_pypi: 'no' + c_extension_test_pypi_username: 'oemof' + codacy: 'yes' + codacy_projectid: 'CODACY_PROJECT_ID' + codeclimate: 'yes' + codecov: 'no' + command_line_interface: 'no' + command_line_interface_bin_name: 'oemof.network' + coveralls: 'yes' + coveralls_token: 'COVERALLSTOKEN' + distribution_name: 'oemof.network' + email: 'gnn.code@gmail.com' + full_name: 'Stephan Günther' + landscape: 'no' + license: 'MIT license' + linter: 'flake8' + package_name: 'oemof.network' + project_name: 'oemof.network' + project_short_description: 'The network/graph submodules of oemof.' + pypi_badge: 'yes' + pypi_disable_upload: 'no' + release_date: '2020-04-01' + repo_hosting: 'github.com' + repo_hosting_domain: 'github.com' + repo_name: 'oemof.network' + repo_username: 'oemof' + requiresio: 'yes' + scrutinizer: 'yes' + setup_py_uses_setuptools_scm: 'no' + setup_py_uses_test_runner: 'no' + sphinx_docs: 'yes' + sphinx_docs_hosting: 'https://oemof-network.readthedocs.io/' + sphinx_doctest: 'no' + sphinx_theme: 'sphinx-rtd-theme' + test_matrix_configurator: 'yes' + test_matrix_separate_coverage: 'yes' + test_runner: 'nose' + travis: 'yes' + travis_osx: 'no' + version: '0.4.0.dev0' + website: 'https://oemof.org/' + year_from: '2020' + year_to: '2020' diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..770e36e --- /dev/null +++ b/.coveragerc @@ -0,0 +1,14 @@ +[paths] +source = src + +[run] +branch = true +source = + src + tests +parallel = true + +[report] +show_missing = true +precision = 2 +omit = *migrations* diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6eb7567 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# see https://editorconfig.org/ +root = true + +[*] +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 4 +charset = utf-8 + +[*.{bat,cmd,ps1}] +end_of_line = crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dfe5838 --- /dev/null +++ b/.gitignore @@ -0,0 +1,71 @@ +*.py[cod] +__pycache__ + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +.eggs +parts +bin +var +sdist +wheelhouse +develop-eggs +.installed.cfg +lib +lib64 +venv*/ +pyvenv*/ +pip-wheel-metadata/ + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox +.coverage.* +.pytest_cache/ +nosetests.xml +coverage.xml +htmlcov + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject +.idea +*.iml +*.komodoproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +docs/_build + +.DS_Store +*~ +.*.sw[po] +.build +.ve +.env +.cache +.pytest +.benchmarks +.bootstrap +.appveyor.token +*.bak + +# Mypy Cache +.mypy_cache/ diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..59ff5c0 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,10 @@ +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +version: 2 +sphinx: + configuration: docs/conf.py +formats: all +python: + install: + - requirements: docs/requirements.txt + - method: pip + path: . diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2b49f7e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,78 @@ +language: python +dist: xenial +cache: false +env: + global: + - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so + - SEGFAULT_SIGNALS=all +matrix: + include: + - python: '3.6' + env: + - TOXENV=check + - python: '3.6' + env: + - TOXENV=docs + - env: + - TOXENV=py27-cover,coveralls + python: '2.7' + - env: + - TOXENV=py27-nocov + python: '2.7' + - env: + - TOXENV=py35-cover,coveralls + python: '3.5' + - env: + - TOXENV=py35-nocov + python: '3.5' + - env: + - TOXENV=py36-cover,coveralls + python: '3.6' + - env: + - TOXENV=py36-nocov + python: '3.6' + - env: + - TOXENV=py37-cover,coveralls + python: '3.7' + - env: + - TOXENV=py37-nocov + python: '3.7' + - env: + - TOXENV=py38-cover,coveralls + python: '3.8' + - env: + - TOXENV=py38-nocov + python: '3.8' + - env: + - TOXENV=pypy-cover,coveralls + python: 'pypy' + - env: + - TOXENV=pypy-nocov + python: 'pypy' + - env: + - TOXENV=pypy3-cover,coveralls + - TOXPYTHON=pypy3 + python: 'pypy3' + - env: + - TOXENV=pypy3-nocov + - TOXPYTHON=pypy3 + python: 'pypy3' +before_install: + - python --version + - uname -a + - lsb_release -a || true +install: + - python -mpip install --progress-bar=off tox -rci/requirements.txt + - virtualenv --version + - easy_install --version + - pip --version + - tox --version +script: + - tox -v +after_failure: + - more .tox/log/* | cat + - more .tox/*/log/* | cat +notifications: + email: + on_success: never + on_failure: always diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 0000000..62c5297 --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,5 @@ + +Authors +======= + +* Stephan Günther - https://oemof.org/ diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 0000000..1bb8ffe --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,8 @@ + +Changelog +========= + +0.4.0.dev0 (2020-04-01) +----------------------- + +* First release on PyPI. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..344d6cd --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,90 @@ +============ +Contributing +============ + +Contributions are welcome, and they are greatly appreciated! Every +little bit helps, and credit will always be given. + +Bug reports +=========== + +When `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. + +Documentation improvements +========================== + +oemof.network could always use more documentation, whether as part of the +official oemof.network docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Feature requests and feedback +============================= + +The best way to send feedback is to file an issue at https://github.com/oemof/oemof.network/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 code contributions are welcome :) + +Development +=========== + +To set up `oemof.network` for local development: + +1. Fork `oemof.network `_ + (look for the "Fork" button). +2. Clone your fork locally:: + + git clone git@github.com:oemof/oemof.network.git + +3. Create a branch for local development:: + + git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +4. When you're done making changes run all the checks and docs builder with `tox `_ one command:: + + tox + +5. 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 + +6. Submit a pull request through the GitHub website. + +Pull Request Guidelines +----------------------- + +If you need some code review or feedback while you're developing the code just make the pull request. + +For merging, you should: + +1. Include passing tests (run ``tox``) [1]_. +2. Update documentation when there's new API, functionality etc. +3. Add a note to ``CHANGELOG.rst`` about the changes. +4. Add yourself to ``AUTHORS.rst``. + +.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will + `run the tests `_ for each change you add in the pull request. + + It will be slower though ... + +Tips +---- + +To run a subset of tests:: + + tox -e envname -- pytest -k test_myfeature + +To run all the test environments in *parallel* (you need to ``pip install detox``):: + + detox diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c23a91c --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2020, Stephan Günther + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..8b9e93d --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,19 @@ +graft docs +graft src +graft ci +graft tests + +include .bumpversion.cfg +include .coveragerc +include .cookiecutterrc +include .editorconfig + +include AUTHORS.rst +include CHANGELOG.rst +include CONTRIBUTING.rst +include LICENSE +include README.rst + +include tox.ini .travis.yml .appveyor.yml .readthedocs.yml + +global-exclude *.py[cod] __pycache__/* *.so *.dylib diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..2c81010 --- /dev/null +++ b/README.rst @@ -0,0 +1,116 @@ +======== +Overview +======== + +.. start-badges + +.. list-table:: + :stub-columns: 1 + + * - docs + - |docs| + * - tests + - | |travis| |requires| + | |coveralls| + | |scrutinizer| |codacy| |codeclimate| + * - package + - | |version| |wheel| |supported-versions| |supported-implementations| + | |commits-since| +.. |docs| image:: https://readthedocs.org/projects/oemof.network/badge/?style=flat + :target: https://readthedocs.org/projects/oemofnetwork + :alt: Documentation Status + +.. |travis| image:: https://api.travis-ci.org/oemof/oemof.network.svg?branch=master + :alt: Travis-CI Build Status + :target: https://travis-ci.org/oemof/oemof.network + +.. |requires| image:: https://requires.io/github/oemof/oemof.network/requirements.svg?branch=master + :alt: Requirements Status + :target: https://requires.io/github/oemof/oemof.network/requirements/?branch=master + +.. |coveralls| image:: https://coveralls.io/repos/oemof/oemof.network/badge.svg?branch=master&service=github + :alt: Coverage Status + :target: https://coveralls.io/r/oemof/oemof.network + +.. |codacy| image:: https://img.shields.io/codacy/grade/CODACY_PROJECT_ID.svg + :target: https://www.codacy.com/app/oemof/oemof.network + :alt: Codacy Code Quality Status + +.. |codeclimate| image:: https://codeclimate.com/github/oemof/oemof.network/badges/gpa.svg + :target: https://codeclimate.com/github/oemof/oemof.network + :alt: CodeClimate Quality Status + +.. |version| image:: https://img.shields.io/pypi/v/oemof.network.svg + :alt: PyPI Package latest release + :target: https://pypi.org/project/oemof.network + +.. |wheel| image:: https://img.shields.io/pypi/wheel/oemof.network.svg + :alt: PyPI Wheel + :target: https://pypi.org/project/oemof.network + +.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/oemof.network.svg + :alt: Supported versions + :target: https://pypi.org/project/oemof.network + +.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/oemof.network.svg + :alt: Supported implementations + :target: https://pypi.org/project/oemof.network + +.. |commits-since| image:: https://img.shields.io/github/commits-since/oemof/oemof.network/v0.4.0.dev0.svg + :alt: Commits since latest release + :target: https://github.com/oemof/oemof.network/compare/v0.4.0.dev0...master + + +.. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/oemof/oemof.network/master.svg + :alt: Scrutinizer Status + :target: https://scrutinizer-ci.com/g/oemof/oemof.network/ + + +.. end-badges + +The network/graph submodules of oemof. + +* Free software: MIT license + +Installation +============ + +:: + + pip install oemof.network + +You can also install the in-development version with:: + + pip install https://github.com/oemof/oemof.network/archive/master.zip + + +Documentation +============= + + +https://oemof-network.readthedocs.io/ + + +Development +=========== + +To run the all tests run:: + + tox + +Note, to combine the coverage data from all the tox environments run: + +.. list-table:: + :widths: 10 90 + :stub-columns: 1 + + - - Windows + - :: + + set PYTEST_ADDOPTS=--cov-append + tox + + - - Other + - :: + + PYTEST_ADDOPTS=--cov-append tox diff --git a/ci/bootstrap.py b/ci/bootstrap.py new file mode 100755 index 0000000..2d14d54 --- /dev/null +++ b/ci/bootstrap.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals + +import os +import sys +from os.path import abspath +from os.path import dirname +from os.path import exists +from os.path import join + +base_path = dirname(dirname(abspath(__file__))) + + +def check_call(args): + print("+", *args) + subprocess.check_call(args) + + +def exec_in_env(): + env_path = join(base_path, ".tox", "bootstrap") + if sys.platform == "win32": + bin_path = join(env_path, "Scripts") + else: + bin_path = join(env_path, "bin") + if not exists(env_path): + import subprocess + + print("Making bootstrap env in: {0} ...".format(env_path)) + try: + check_call([sys.executable, "-m", "venv", env_path]) + except subprocess.CalledProcessError: + try: + check_call([sys.executable, "-m", "virtualenv", env_path]) + except subprocess.CalledProcessError: + check_call(["virtualenv", env_path]) + print("Installing `jinja2` into bootstrap environment...") + check_call([join(bin_path, "pip"), "install", "jinja2", "tox", "matrix"]) + python_executable = join(bin_path, "python") + if not os.path.exists(python_executable): + python_executable += '.exe' + + print("Re-executing with: {0}".format(python_executable)) + print("+ exec", python_executable, __file__, "--no-env") + os.execv(python_executable, [python_executable, __file__, "--no-env"]) + +def main(): + import jinja2 + import matrix + + + print("Project path: {0}".format(base_path)) + + jinja = jinja2.Environment( + loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), + trim_blocks=True, + lstrip_blocks=True, + keep_trailing_newline=True + ) + + tox_environments = {} + for (alias, conf) in matrix.from_file(join(base_path, "setup.cfg")).items(): + python = conf["python_versions"] + deps = conf["dependencies"] + tox_environments[alias] = { + "deps": deps.split(), + } + if "coverage_flags" in conf: + cover = {"false": False, "true": True}[conf["coverage_flags"].lower()] + tox_environments[alias].update(cover=cover) + if "environment_variables" in conf: + env_vars = conf["environment_variables"] + tox_environments[alias].update(env_vars=env_vars.split()) + + for name in os.listdir(join("ci", "templates")): + with open(join(base_path, name), "w") as fh: + fh.write(jinja.get_template(name).render(tox_environments=tox_environments)) + print("Wrote {}".format(name)) + print("DONE.") + + +if __name__ == "__main__": + args = sys.argv[1:] + if args == ["--no-env"]: + main() + elif not args: + exec_in_env() + else: + print("Unexpected arguments {0}".format(args), file=sys.stderr) + sys.exit(1) + diff --git a/ci/requirements.txt b/ci/requirements.txt new file mode 100644 index 0000000..b2a21e5 --- /dev/null +++ b/ci/requirements.txt @@ -0,0 +1,4 @@ +virtualenv>=16.6.0 +pip>=19.1.1 +setuptools>=18.0.1 +six>=1.12.0 diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml new file mode 100644 index 0000000..255f60b --- /dev/null +++ b/ci/templates/.travis.yml @@ -0,0 +1,46 @@ +language: python +dist: xenial +cache: false +env: + global: + - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so + - SEGFAULT_SIGNALS=all +matrix: + include: + - python: '3.6' + env: + - TOXENV=check + - python: '3.6' + env: + - TOXENV=docs +{%- for env, config in tox_environments|dictsort %}{{ '' }} + - env: + - TOXENV={{ env }}{% if config.cover %},coveralls{% endif %} +{%- if env.startswith('pypy3') %}{{ '' }} + - TOXPYTHON=pypy3 + python: 'pypy3' +{%- elif env.startswith('pypy') %}{{ '' }} + python: 'pypy' +{%- else %}{{ '' }} + python: '{{ '{0[2]}.{0[3]}'.format(env) }}' +{%- endif %} +{%- endfor %}{{ '' }} +before_install: + - python --version + - uname -a + - lsb_release -a || true +install: + - python -mpip install --progress-bar=off tox -rci/requirements.txt + - virtualenv --version + - easy_install --version + - pip --version + - tox --version +script: + - tox -v +after_failure: + - more .tox/log/* | cat + - more .tox/*/log/* | cat +notifications: + email: + on_success: never + on_failure: always diff --git a/ci/templates/tox.ini b/ci/templates/tox.ini new file mode 100644 index 0000000..9cec832 --- /dev/null +++ b/ci/templates/tox.ini @@ -0,0 +1,103 @@ +[tox] +envlist = + clean, + check, + docs, +{% for env in tox_environments|sort %} + {{ env }}, +{% endfor %} + report + +[testenv] +basepython = + docs: {env:TOXPYTHON:python3.6} + {bootstrap,clean,check,report,coveralls}: {env:TOXPYTHON:python3} +setenv = + PYTHONPATH={toxinidir}/tests + PYTHONUNBUFFERED=yes +passenv = + * +deps = + nose +commands = + {posargs:nosetests -v tests} + +[testenv:bootstrap] +deps = + jinja2 + matrix +skip_install = true +commands = + python ci/bootstrap.py --no-env + +[testenv:check] +deps = + docutils + check-manifest + flake8 + readme-renderer + pygments + isort +skip_install = true +commands = + python setup.py check --strict --metadata --restructuredtext + check-manifest {toxinidir} + flake8 src tests setup.py + isort --verbose --check-only --diff --recursive src tests setup.py + + +[testenv:docs] +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt +commands = + sphinx-build {posargs:-E} -b html docs dist/docs + sphinx-build -b linkcheck docs dist/docs + +[testenv:coveralls] +deps = + coveralls +skip_install = true +commands = + coveralls [] + + + +[testenv:report] +deps = coverage +skip_install = true +commands = + coverage report + coverage html + +[testenv:clean] +commands = coverage erase +skip_install = true +deps = coverage +{% for env, config in tox_environments|dictsort %} + +[testenv:{{ env }}] +basepython = {env:TOXPYTHON:{{ env.split("-")[0] if env.startswith("pypy") else "python{0[2]}.{0[3]}".format(env) }}} +{% if config.cover or config.env_vars %} +setenv = + {[testenv]setenv} +{% endif %} +{% for var in config.env_vars %} + {{ var }} +{% endfor %} +{% if config.cover %} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +{% endif %} +{% if config.cover or config.deps %} +deps = + {[testenv]deps} +{% endif %} +{% if config.cover %} + coverage +{% endif %} +{% for dep in config.deps %} + {{ dep }} +{% endfor -%} +{% endfor -%} diff --git a/docs/authors.rst b/docs/authors.rst new file mode 100644 index 0000000..e122f91 --- /dev/null +++ b/docs/authors.rst @@ -0,0 +1 @@ +.. include:: ../AUTHORS.rst diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 0000000..565b052 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1 @@ +.. include:: ../CHANGELOG.rst diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..4ffaab2 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import os + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.coverage', + 'sphinx.ext.doctest', + 'sphinx.ext.extlinks', + 'sphinx.ext.ifconfig', + 'sphinx.ext.napoleon', + 'sphinx.ext.todo', + 'sphinx.ext.viewcode', +] +source_suffix = '.rst' +master_doc = 'index' +project = 'oemof.network' +year = '2020' +author = 'Stephan Günther' +copyright = '{0}, {1}'.format(year, author) +version = release = '0.4.0.dev0' + +pygments_style = 'trac' +templates_path = ['.'] +extlinks = { + 'issue': ('https://github.com/oemof/oemof.network/issues/%s', '#'), + 'pr': ('https://github.com/oemof/oemof.network/pull/%s', 'PR #'), +} +# on_rtd is whether we are on readthedocs.org +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if not on_rtd: # only set the theme if we're building docs locally + html_theme = 'sphinx_rtd_theme' + +html_use_smartypants = True +html_last_updated_fmt = '%b %d, %Y' +html_split_index = False +html_sidebars = { + '**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], +} +html_short_title = '%s-%s' % (project, version) + +napoleon_use_ivar = True +napoleon_use_rtype = False +napoleon_use_param = False diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 0000000..e582053 --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1 @@ +.. include:: ../CONTRIBUTING.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..40f35b5 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +======== +Contents +======== + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + reference/index + contributing + authors + changelog + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..090c19e --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,7 @@ +============ +Installation +============ + +At the command line:: + + pip install oemof.network diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 0000000..72a3355 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1 @@ +.. include:: ../README.rst diff --git a/docs/reference/index.rst b/docs/reference/index.rst new file mode 100644 index 0000000..7849421 --- /dev/null +++ b/docs/reference/index.rst @@ -0,0 +1,7 @@ +Reference +========= + +.. toctree:: + :glob: + + oemof.network* diff --git a/docs/reference/oemof.network.rst b/docs/reference/oemof.network.rst new file mode 100644 index 0000000..3ece5b8 --- /dev/null +++ b/docs/reference/oemof.network.rst @@ -0,0 +1,9 @@ +oemof.network +============= + +.. testsetup:: + + from oemof.network import * + +.. automodule:: oemof.network + :members: diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..37da9ae --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +sphinx>=1.3 +sphinx-rtd-theme diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt new file mode 100644 index 0000000..f95eb78 --- /dev/null +++ b/docs/spelling_wordlist.txt @@ -0,0 +1,11 @@ +builtin +builtins +classmethod +staticmethod +classmethods +staticmethods +args +kwargs +callstack +Changelog +Indices diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 0000000..2de17c5 --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,7 @@ +===== +Usage +===== + +To use oemof.network in a project:: + + import oemof.network diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2c0a108 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,59 @@ +[bdist_wheel] +universal = 1 + +[flake8] +max-line-length = 140 +exclude = */migrations/*[nosetests] +verbosity = 2 + +[tool:isort] +force_single_line = True +line_length = 120 +known_first_party = oemof.network +default_section = THIRDPARTY +forced_separate = test_oemof.network +not_skip = __init__.py +skip = migrations + +[matrix] +# This is the configuration for the `./bootstrap.py` script. +# It generates `.travis.yml`, `tox.ini` and `.appveyor.yml`. +# +# Syntax: [alias:] value [!variable[glob]] [&variable[glob]] +# +# alias: +# - is used to generate the tox environment +# - it's optional +# - if not present the alias will be computed from the `value` +# value: +# - a value of "-" means empty +# !variable[glob]: +# - exclude the combination of the current `value` with +# any value matching the `glob` in `variable` +# - can use as many you want +# &variable[glob]: +# - only include the combination of the current `value` +# when there's a value matching `glob` in `variable` +# - can use as many you want + +python_versions = + py27 + py35 + py36 + py37 + py38 + pypy + pypy3 + +dependencies = +# 1.4: Django==1.4.16 !python_versions[py3*] +# 1.5: Django==1.5.11 +# 1.6: Django==1.6.8 +# 1.7: Django==1.7.1 !python_versions[py26] +# Deps commented above are provided as examples. That's what you would use in a Django project. + +coverage_flags = + cover: true + nocov: false +environment_variables = + - diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..43fba47 --- /dev/null +++ b/setup.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +from __future__ import absolute_import +from __future__ import print_function + +import io +import re +from glob import glob +from os.path import basename +from os.path import dirname +from os.path import join +from os.path import splitext + +from setuptools import find_packages +from setuptools import setup + + +def read(*names, **kwargs): + with io.open( + join(dirname(__file__), *names), + encoding=kwargs.get('encoding', 'utf8') + ) as fh: + return fh.read() + + +setup( + name='oemof.network', + version='0.4.0.dev0', + license='MIT', + description='The network/graph submodules of oemof.', + long_description='%s\n%s' % ( + re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.rst')), + re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst')) + ), + author='Stephan Günther', + author_email='gnn.code@gmail.com', + url='https://github.com/oemof/oemof.network', + packages=find_packages('src'), + package_dir={'': 'src'}, + py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], + include_package_data=True, + zip_safe=False, + classifiers=[ + # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: Unix', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + # uncomment if you test on these interpreters: + # 'Programming Language :: Python :: Implementation :: IronPython', + # 'Programming Language :: Python :: Implementation :: Jython', + # 'Programming Language :: Python :: Implementation :: Stackless', + 'Topic :: Utilities', + ], + project_urls={ + 'Documentation': 'https://oemofnetwork.readthedocs.io/', + 'Changelog': 'https://oemofnetwork.readthedocs.io/en/latest/changelog.html', + 'Issue Tracker': 'https://github.com/oemof/oemof.network/issues', + }, + keywords=[ + # eg: 'keyword1', 'keyword2', 'keyword3', + ], + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', + install_requires=[ + # eg: 'aspectlib==1.1.1', 'six>=1.7', + ], + extras_require={ + # eg: + # 'rst': ['docutils>=0.11'], + # ':python_version=="2.6"': ['argparse'], + }, +) diff --git a/src/oemof.network/__init__.py b/src/oemof.network/__init__.py new file mode 100644 index 0000000..71d6943 --- /dev/null +++ b/src/oemof.network/__init__.py @@ -0,0 +1 @@ +__version__ = '0.4.0.dev0' diff --git a/tests/test_oemof.network.py b/tests/test_oemof.network.py new file mode 100644 index 0000000..7717f69 --- /dev/null +++ b/tests/test_oemof.network.py @@ -0,0 +1,6 @@ + +from oemof.network import main + + +def test_main(): + pass diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a4af85b --- /dev/null +++ b/tox.ini @@ -0,0 +1,185 @@ +[tox] +envlist = + clean, + check, + docs, + py27-cover, + py27-nocov, + py35-cover, + py35-nocov, + py36-cover, + py36-nocov, + py37-cover, + py37-nocov, + py38-cover, + py38-nocov, + pypy-cover, + pypy-nocov, + pypy3-cover, + pypy3-nocov, + report + +[testenv] +basepython = + docs: {env:TOXPYTHON:python3.6} + {bootstrap,clean,check,report,coveralls}: {env:TOXPYTHON:python3} +setenv = + PYTHONPATH={toxinidir}/tests + PYTHONUNBUFFERED=yes +passenv = + * +deps = + nose +commands = + {posargs:nosetests -v tests} + +[testenv:bootstrap] +deps = + jinja2 + matrix +skip_install = true +commands = + python ci/bootstrap.py --no-env + +[testenv:check] +deps = + docutils + check-manifest + flake8 + readme-renderer + pygments + isort +skip_install = true +commands = + python setup.py check --strict --metadata --restructuredtext + check-manifest {toxinidir} + flake8 src tests setup.py + isort --verbose --check-only --diff --recursive src tests setup.py + + +[testenv:docs] +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt +commands = + sphinx-build {posargs:-E} -b html docs dist/docs + sphinx-build -b linkcheck docs dist/docs + +[testenv:coveralls] +deps = + coveralls +skip_install = true +commands = + coveralls [] + + + +[testenv:report] +deps = coverage +skip_install = true +commands = + coverage report + coverage html + +[testenv:clean] +commands = coverage erase +skip_install = true +deps = coverage + +[testenv:py27-cover] +basepython = {env:TOXPYTHON:python2.7} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:py27-nocov] +basepython = {env:TOXPYTHON:python2.7} + +[testenv:py35-cover] +basepython = {env:TOXPYTHON:python3.5} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:py35-nocov] +basepython = {env:TOXPYTHON:python3.5} + +[testenv:py36-cover] +basepython = {env:TOXPYTHON:python3.6} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:py36-nocov] +basepython = {env:TOXPYTHON:python3.6} + +[testenv:py37-cover] +basepython = {env:TOXPYTHON:python3.7} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:py37-nocov] +basepython = {env:TOXPYTHON:python3.7} + +[testenv:py38-cover] +basepython = {env:TOXPYTHON:python3.8} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:py38-nocov] +basepython = {env:TOXPYTHON:python3.8} + +[testenv:pypy-cover] +basepython = {env:TOXPYTHON:pypy} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:pypy-nocov] +basepython = {env:TOXPYTHON:pypy} + +[testenv:pypy3-cover] +basepython = {env:TOXPYTHON:pypy3} +setenv = + {[testenv]setenv} +usedevelop = true +commands = + {posargs:nosetests --with-coverage --cover-package=oemof.network} +deps = + {[testenv]deps} + coverage + +[testenv:pypy3-nocov] +basepython = {env:TOXPYTHON:pypy3}