Skip to content

Commit

Permalink
Merge pull request #16 from reegis/revise_deflex
Browse files Browse the repository at this point in the history
Revise deflex
  • Loading branch information
uvchik committed Jan 25, 2021
2 parents a5f409a + b1f8614 commit 5660422
Show file tree
Hide file tree
Showing 92 changed files with 11,852 additions and 2,467 deletions.
16 changes: 14 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[paths]
source = src

[run]
omit =
*snippets*
branch = true
source =
src
tests
parallel = true
omit = *snippets*

[report]
show_missing = true
precision = 2
omit = *migrations*
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,3 @@ ENV/

# IDEs
.idea/

# test results
tests/data/results_cbc/*.esys
/tests/data/my_log_file.csv
71 changes: 45 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
language: python
dist: xenial
virt: lxd
cache: false
env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
- LANG=en_US.UTF-8

matrix:
include:
- python: 3.6
- python: 3.8

# install os dependencies
addons:
apt:
packages:
- coinor-cbc
- libhdf5-serial-dev
- proj-bin
- libproj-dev
- libgeos-dev
- libspatialindex-dev
- graphviz
apt:
packages:
- coinor-cbc

# install python dependencies
matrix:
include:
- python: '3.6'
env:
- TOXENV=check
- python: '3.6'
env:
- TOXENV=docs
- env:
- TOXENV=py37-cover,codecov,coveralls
python: '3.7'
- env:
- TOXENV=py37-nocov
python: '3.7'
- env:
- TOXENV=py39-cover,codecov,coveralls
python: '3.9'
before_install:
- python --version
- uname -a
- lsb_release -a || true
install:
- pip install cython
- pip install .[plot]
- pip install coveralls pytest-cov

# command to run tests
- python -mpip install --progress-bar=off tox -rci/requirements.txt
- virtualenv --version
- easy_install --version
- pip --version
- tox --version
script:
- coverage run --rcfile=.coveragerc --source deflex -m py.test
- coverage report

after_success:
- coveralls
- tox -v
after_failure:
- cat .tox/log/*
- cat .tox/*/log/*
notifications:
email:
on_success: never
on_failure: always
5 changes: 5 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Authors
=======

* Uwe Krien - https://www.uni-bremen.de/en/res/team/dipl-ing-uwe-krien
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Changelog
=========

0.2.0b0 (2020-12-17)
--------------------

* First release on PyPI.
90 changes: 90 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/reegis/deflex/issues>`_ 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
==========================

deflex could always use more documentation, whether as part of the
official deflex 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/reegis/deflex/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 `deflex` for local development:

1. Fork `deflex <https://github.com/reegis/deflex>`_
(look for the "Fork" button).
2. Clone your fork locally::

git clone git@github.com:YOURGITHUBNAME/deflex.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 <https://tox.readthedocs.io/en/latest/install.html>`_ 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 <https://travis-ci.org/reegis/deflex/pull_requests>`_ 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*::

tox -p auto
20 changes: 4 additions & 16 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
MIT License

Copyright (c) 2019 Uwe Krien
Copyright (c) 2020, Uwe Krien

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:
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 shall be included in all
copies or substantial portions of the Software.
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.
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.
21 changes: 21 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
graft docs
graft src
graft ci
graft tests
graft examples

include AUTHORS.rst
include CHANGELOG.rst
include CONTRIBUTING.rst
include LICENSE
include README.rst
include .coveragerc
include *.yml
include VERSION
include pytest.ini

include tox.ini .travis.yml

recursive-include tests *.csv

global-exclude *.py[cod] __pycache__/*
52 changes: 45 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,49 @@ deflex - flexible multi-regional energy system model forheat, power and mobility
Installation
============

We recommend to install the already working beta version::
We will publish a stable version soon. Until then we recommend to install the already working beta version::

pip install https://github.com/reegis/deflex/archive/revise_deflex.zip


Use the latest stable (PhD) version of deflex if to run older scenarios::
Use the latest stable (PhD) version of deflex to run older scenarios::

pip install https://github.com/reegis/deflex/archive/phd.zip


Additional requirements
-----------------------

The basic installation can be used to compute scenarios (csv, xls, xlsx). For
some functions additional packages are needed.

1. To run the example with all plots you need the following packages:
* pygeos (spatial operations)
* geopandas (maps)
* descartes (plot maps with matplotlib)
* lmfit (linear fit)
* matplotlib (plotting)
* requests (download example files)

``pip install deflex[example]``

2. To use the maps of the polygons, transmission lines etc.:
* pygeos (spatial operations)
* geopandas (maps)

``pip install deflex[map]``

3. To develop deflex:
* pytest
* sphinx
* sphinx_rtd_theme
* pygeos
* geopandas
* requests

``pip install deflex[dev]``


Basic usage
===========

Expand All @@ -115,12 +149,16 @@ Use example
2. Download the
`example <https://raw.githubusercontent.com/reegis/deflex/revise_deflex/examples/examples.py>`_
to this new directory.
3. Open the example file and scroll down to the bottom.
4. Replace "/path/to/store/example/files" with the path of your new directory
(e.g. my_path = /home/user/my_example).

5. Now execute the example file. The script will download some example
3. Now execute the example file. The script will download some example
scenarios with results and show some exemplary plots.
4. A directory "deflex_examples" will be created in you home directory. Use
``print(os.path.expanduser("~"))`` to find out where your home directory is
located. If you want to change it replace the base path in the example:

.. code-block:: diff
- BASEPATH = os.path.join(os.path.expanduser("~"), "deflex_examples")
+ BASEPATH = "/your/favoured/path/"
Documentation
=============
Expand Down

0 comments on commit 5660422

Please sign in to comment.