Skip to content

Commit 7de05a5

Browse files
authored
update docs for v3.0 (#45)
* use logical indexing * add release robot and use logical indexing * cherry pick dulwich 0.16.3 * prepare for v3.0rc1 * remove CHANGES * change README.md to rst * add README to setup * add version and release to documentation index Signed-off-by: Mark Mikofski <[email protected]> * remove version, add dulwich to reqs
1 parent 57778cc commit 7de05a5

File tree

10 files changed

+107
-170
lines changed

10 files changed

+107
-170
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ benchmark_*/
2727

2828
# virtualenv
2929
venv/
30+
.coverage

AUTHORS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Authors
22
=======
3-
* Nicolas Zweibaum <[email protected]>
4-
* Mark Mikofski <[email protected]>
53
* Bennet Emil Meyers <[email protected]>
6-
4+
* Mark Mikofski <[email protected]>
5+
* Nicolas Zweibaum <[email protected]>

CHANGES.md

Lines changed: 0 additions & 126 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

README.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PVMismatch
2+
==========
3+
4+
An explicit Python PV system IV & PV curve trace calculator which can
5+
also calculate mismatch.
6+
7+
|Build Status|
8+
9+
Installation
10+
------------
11+
12+
PVMismatch is on `PyPI <https://pypi.python.org/pypi/pvmismatch>`__. Install it
13+
with `pip <https://pip.pypa.io/en/stable/>`__:
14+
15+
::
16+
17+
$ pip install pvmismatch
18+
19+
Requirements
20+
------------
21+
22+
PVMismatch requires NumPy, SciPy and matplotlib. These packages are available
23+
from PyPI, `Christoph Gohlke <http://www.lfd.uci.edu/~gohlke/pythonlibs/>`__
24+
and Anaconda. You must install them prior to using PVMismatch.
25+
26+
Usage
27+
-----
28+
29+
Please see the `documenation <http://sunpower.github.io/PVMismatch/>`__ for
30+
tutorials and API. Bugs and feature requests can be reported on
31+
`GitHub <https://github.com/SunPower/PVMismatch/issues>`__. The change
32+
history is also on `GitHub <https://github.com/SunPower/releases/>`__.
33+
34+
.. |Build Status| image:: https://travis-ci.org/SunPower/PVMismatch.svg?branch=master
35+
:target: https://travis-ci.org/SunPower/PVMismatch

pvmismatch/__init__.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@
2424
:mod:`pvmismatch.pv_tk`.
2525
"""
2626

27+
import os
28+
import importlib
29+
30+
# try to import Dulwich or create dummies
31+
try:
32+
from dulwich.contrib.release_robot import get_current_version
33+
from dulwich.repo import NotGitRepository
34+
except ImportError:
35+
NotGitRepository = NotImplementedError
36+
37+
def get_current_version():
38+
return NotGitRepository
39+
2740
# import pvmismatch_lib modules so to match old API
2841
import pvmismatch.pvmismatch_lib.pvconstants as pvconstants
2942
import pvmismatch.pvmismatch_lib.pvcell as pvcell
@@ -39,7 +52,32 @@
3952
PVstring = pvstring.PVstring
4053
PVsystem = pvsystem.PVsystem
4154

42-
__author__ = 'mmikofski'
43-
__version__ = '3.0'
55+
# Dulwich Release Robot
56+
BASEDIR = os.path.dirname(__file__) # this directory
57+
VER_FILE = 'version' # name of file to store version
58+
# use release robot to try to get current Git tag
59+
try:
60+
GIT_TAG = get_current_version()
61+
except NotGitRepository:
62+
GIT_TAG = None
63+
# check version file
64+
try:
65+
version = importlib.import_module('%s.%s' % (__name__, VER_FILE))
66+
except ImportError:
67+
VERSION = None
68+
else:
69+
VERSION = version.VERSION
70+
# update version file if it differs from Git tag
71+
if GIT_TAG is not None and VERSION != GIT_TAG:
72+
with open(os.path.join(BASEDIR, VER_FILE + '.py'), 'w') as vf:
73+
vf.write('VERSION = "%s"\n' % GIT_TAG)
74+
else:
75+
GIT_TAG = VERSION # if Git tag is none use version file
76+
VERSION = GIT_TAG # version
77+
78+
__author__ = 'Mark Mikofski'
79+
__email__ = u'[email protected]'
80+
__url__ = u'https://github.com/SunPower/PVMismatch'
81+
__version__ = VERSION
4482
__release__ = 'Kenya Ketchup'
4583
__all__ = ['pvconstants', 'pvcell', 'pvmodule', 'pvstring', 'pvsystem']

pvmismatch/docs/index.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
Welcome to PVMismatch's documentation!
77
======================================
88

9+
Version: |version| (|release|)
10+
11+
12+
Announcements
13+
-------------
14+
Thanks to Bennet Meyers you should see huge memory and speed improvements since
15+
new cell, module and string objects are only created when they are needed to
16+
differentiate cells by irradiance or temperature. However this can lead to
17+
unexpected behavior when changing other cell properties without first making a
18+
copy of the original cell.
19+
20+
921
Contents:
22+
---------
1023

1124
.. toctree::
1225
:maxdepth: 2

pvmismatch/pvmismatch_lib/pvmodule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def setSuns(self, Ee, cells=None):
275275
Ee = np.array(Ee)
276276
unique_ee = np.unique(Ee)
277277
for a_Ee in unique_ee:
278-
cells_subset = cells[np.where(Ee == a_Ee)]
278+
cells_subset = cells[Ee == a_Ee]
279279
cells_to_update = [self.pvcells[i] for i in cells_subset]
280280
old_pvcells = dict.fromkeys(cells_to_update)
281281
for cell_id, pvcell in zip(cells_subset, cells_to_update):
@@ -345,7 +345,7 @@ def setTemps(self, Tc, cells=None):
345345
Tc = np.array(Tc)
346346
unique_tc = np.unique(Tc)
347347
for a_Tc in unique_tc:
348-
cells_subset = cells[np.where(Tc == a_Tc)]
348+
cells_subset = cells[Tc == a_Tc]
349349
cells_to_update = [self.pvcells[i] for i in cells_subset]
350350
old_pvcells = dict.fromkeys(cells_to_update)
351351
for cell_id, pvcell in zip(cells_subset, cells_to_update):

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ nose
22
numpy
33
scipy
44
matplotlib
5+
sphinx
6+
dulwich

setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@
44
from setuptools import setup
55
except ImportError:
66
from distutils.core import setup
7-
from pvmismatch import __version__, __name__
7+
from pvmismatch import __version__, __name__, __email__, __url__
8+
import os
89

10+
README = 'README.rst'
11+
try:
12+
with open(os.path.join(os.path.dirname(__file__), README), 'r') as readme:
13+
README = readme.read()
14+
except IOError:
15+
pass
916

1017
setup(name=__name__,
1118
version=__version__,
1219
description='PV Mismatch Calculator',
20+
long_description=README,
1321
author=__author__,
14-
author_email='[email protected]',
15-
url='https://github.com/SunPower/PVMismatch',
22+
author_email=__email__,
23+
url=__url__,
24+
license='BSD 3-clause',
1625
packages=['pvmismatch', 'pvmismatch.pvmismatch_lib',
1726
'pvmismatch.pvmismatch_tk'],
1827
requires=['numpy (>=1.8)', 'matplotlib (>=1.3)', 'scipy (>=0.12.0)'],

0 commit comments

Comments
 (0)