Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oemof/oemof-tabular
Browse files Browse the repository at this point in the history
  • Loading branch information
simnh committed Dec 18, 2018
2 parents 3acdd99 + f751e77 commit 7e737c0
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 53 deletions.
105 changes: 62 additions & 43 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,82 +6,101 @@
from os.path import basename, dirname, join, splitext
import io
import re
import sys

from setuptools import find_packages, setup


def read(*names, **kwargs):
with io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
encoding=kwargs.get("encoding", "utf8"),
) as fh:
return fh.read()


setup(
name='oemof.tabular',
version='0.0.1dev',
license='BSD 3-Clause License',
description='Load oemof energy systems from tabular data sources.',
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'))
name="oemof.tabular",
version="0.0.1dev",
license="BSD 3-Clause License",
description="Load oemof energy systems from tabular data sources.",
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, Simon Hilpert, Martin Söthe, Cord Kaldemeyer',
author_email='gnn.code@gmail.com',
url='https://github.com/oemof/oemof-tabular',
packages=['oemof'] + ['oemof.' + p for p in find_packages('src/oemof')],
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
author="Stephan Günther, Simon Hilpert, Martin Söthe, Cord Kaldemeyer",
author_email="gnn.code@gmail.com",
url="https://github.com/oemof/oemof-tabular",
packages=["oemof"] + ["oemof." + p for p in find_packages("src/oemof")],
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 :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Unix',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
# uncomment if you test on these interpreters:
# 'Programming Language :: Python :: Implementation :: IronPython',
# 'Programming Language :: Python :: Implementation :: Jython',
# 'Programming Language :: Python :: Implementation :: Stackless',
'Topic :: Utilities',
"Topic :: Utilities",
],
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
],
install_requires=[
'datapackage',
'geojson',
'oemof==0.2.4.dev0',
'pandas>=0.22',
'paramiko',
'pyproj',
'pyshp',
'scipy',
'shapely',
'tsam',
"datapackage",
"geojson",
"oemof==0.2.4.dev0",
"pandas>=0.22",
"paramiko",
"pyproj==1.9.5.1.dev0"
if sys.version_info.major >= 3 and sys.version_info.minor >= 7
else "pyproj",
"pyshp",
"scipy",
"shapely",
"tsam",
],
extras_require={
# eg:
# 'rst': ['docutils>=0.11'],
# ':python_version=="2.6"': ['argparse'],
},
dependency_links=[
('git+https://git@github.com/oemof/oemof.git'
'@features/move-datapackage-reader-into-standalone-package'
'#egg=oemof-0.2.4.dev0')],
dependency_links=(
[
(
"git+https://git@github.com/gnn/pyproj.git"
"@69a26ce46634749f602518a375849999cb5e41e0"
"#egg=pyproj-1.9.5.1.dev0"
)
]
if sys.version_info.major >= 3 and sys.version_info.minor >= 7
else []
)
+ [
(
"git+https://git@github.com/oemof/oemof.git"
"@features/move-datapackage-reader-into-standalone-package"
"#egg=oemof-0.2.4.dev0"
)
],
)
7 changes: 7 additions & 0 deletions src/oemof/tabular/datapackage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from oemof.energy_system import EnergySystem

from .reading import deserialize_energy_system

from oemof.tabular.datapackage import building, processing, aggregation

EnergySystem.from_datapackage = classmethod(deserialize_energy_system)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
import datapackage as dp
import pandas as pd

from oemof.energy_system import EnergySystem
from oemof.network import Bus, Component

from .tools import HSN, raisestatement, remap
from ..tools import HSN, raisestatement, remap

DEFAULT = object()
FLOW_TYPE = object()
Expand Down Expand Up @@ -363,7 +362,3 @@ def find(n, d):

else:
raise ValueError("Timeindices in resources differ!")


EnergySystem.from_datapackage = classmethod(deserialize_energy_system)

1 change: 0 additions & 1 deletion src/oemof/tabular/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

import types
from oemof.tabular.tools.datapackage import building, processing, aggregation

class HSN(types.SimpleNamespace):
""" A hashable variant of `types.Simplenamespace`.
Expand Down
Empty file.
8 changes: 5 additions & 3 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

from oemof.energy_system import EnergySystem as ES

from oemof.tabular.datapackage import deserialize_energy_system
from oemof.tabular.facades import TYPEMAP
# The import below is only used to monkey patch `EnergySystem`.
# Hence the `noqa` because otherwise, style checkers would complain about an
# unused import.
import oemof.tabular.datapackage # noqa: F401


def test_example_datapackage_readability():
Expand All @@ -15,8 +18,7 @@ def test_example_datapackage_readability():
'oemof.tabular', 'examples/datapackages'):

systems.append(
deserialize_energy_system(
ES,
ES.from_datapackage(
pkg.resource_filename(
'oemof.tabular',
'examples/datapackages/{}/datapackage.json'.format(example)),
Expand Down

0 comments on commit 7e737c0

Please sign in to comment.