From d139ce46f2d94eefdbc2821e3e5f50136fe3e397 Mon Sep 17 00:00:00 2001 From: Ned Burnell Date: Wed, 21 Mar 2018 16:14:28 -0700 Subject: [PATCH] version 0.7.0 as seen on pypi (#1284) --- LICENSE | 2 +- MANIFEST | 8 +++++--- checkpy3.sh | 2 +- docs/source/citinggpkit.rst | 6 +++--- docs/source/conf.py | 6 +++--- docs/source/releasenotes.rst | 12 ++++++++++++ gpkit/__init__.py | 2 +- gpkit/nomials/map.py | 7 +++---- gpkit/nomials/math.py | 6 +++--- gpkit/small_classes.py | 1 + gpkit/solution_array.py | 6 +++--- run_tests.py.lprof | 4 ---- setup.py | 6 +++--- 13 files changed, 39 insertions(+), 29 deletions(-) delete mode 100644 run_tests.py.lprof diff --git a/LICENSE b/LICENSE index b36a0bf65..3d36bf819 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Edward Burnell and Warren Hoburg +Copyright (c) 2018 Edward Burnell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST b/MANIFEST index 2575f34ba..2045bf433 100644 --- a/MANIFEST +++ b/MANIFEST @@ -20,11 +20,10 @@ gpkit/constraints/tight.py gpkit/exceptions.py gpkit/interactive/__init__.py gpkit/interactive/chartjs.py -gpkit/interactive/linking_diagram.py +gpkit/interactive/sankey.py gpkit/interactive/plotting.py gpkit/interactive/plot_sweep.py gpkit/interactive/ractor.py -gpkit/interactive/sensitivity_map.py gpkit/interactive/widgets.py gpkit/keydict.py gpkit/modified_ctypesgen.py @@ -36,7 +35,9 @@ gpkit/nomials/math.py gpkit/nomials/map.py gpkit/nomials/substitution.py gpkit/nomials/variables.py -gpkit/pint/usd_cpi.txt +gpkit/_pint/__init__.py +gpkit/_pint/usd_cpi.txt +gpkit/globals.py gpkit/repr_conventions.py gpkit/small_classes.py gpkit/small_scripts.py @@ -60,6 +61,7 @@ gpkit/tests/t_vars.py gpkit/tests/test_repo.py gpkit/tools/__init__.py gpkit/tools/autosweep.py +gpkit/tools/docstring.py gpkit/tools/fmincon.py gpkit/tools/spdata.py gpkit/tools/tools.py diff --git a/checkpy3.sh b/checkpy3.sh index e03529b64..676ab63f7 100755 --- a/checkpy3.sh +++ b/checkpy3.sh @@ -1,5 +1,5 @@ cp gpkit/env/settings . sed -i '1s/.*/installed_solvers : mosek_cli/' gpkit/env/settings cat gpkit/env/settings -python3 -c docs/source/examples/simpleflight.py +python3 docs/source/examples/simpleflight.py mv settings gpkit/env diff --git a/docs/source/citinggpkit.rst b/docs/source/citinggpkit.rst index b61081efc..fcb0ec377 100644 --- a/docs/source/citinggpkit.rst +++ b/docs/source/citinggpkit.rst @@ -4,9 +4,9 @@ Citing GPkit If you use GPkit, please cite it with the following bibtex:: @Misc{gpkit, - author={Edward Burnell and Warren Hoburg}, + author={Edward Burnell}, title={GPkit software for geometric programming}, howpublished={\url{https://github.com/convexengineering/gpkit}}, - year={2017}, - note={Version 0.6.0} + year={2018}, + note={Version 0.7.0} } diff --git a/docs/source/conf.py b/docs/source/conf.py index 7bf1d53b1..5b4a017c0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -48,16 +48,16 @@ # General information about the project. project = u'gpkit' -copyright = u'2017 Edward Burnell and Warren Hoburg' +copyright = u'2018 Edward Burnell' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.6' +version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.6.0' +release = '0.7.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/releasenotes.rst b/docs/source/releasenotes.rst index 52a6afe87..57cc0863c 100644 --- a/docs/source/releasenotes.rst +++ b/docs/source/releasenotes.rst @@ -3,6 +3,18 @@ Release Notes This page lists the changes made in each point version of gpkit. +Version 0.7.0 +============= + * Variable's values are now used only in their first ConstraintSet; in other ConstraintSets they're free variables + * Variable values can be preserved by setting ``constant=True`` during variable declaration + * MOSEK home directory can be set by a ``MSKHOME`` environment variable at build time + * ``sol(var)`` now always returns Pint Quantities, even if the variable is dimensionless + * ``sol[...][var]``, on the other hand, now always returns floats / numpy arrays of floats + * Optional boundedness checking in docstring (see usage in `docs `_) + * Automatic boundedness checking for GPs + * `Sankey diagrams `_ + * Many other fixes + Version 0.6.0 ============= * new much faster NomialMap data structure (#682) diff --git a/gpkit/__init__.py b/gpkit/__init__.py index 2c5e8a754..9876a713f 100644 --- a/gpkit/__init__.py +++ b/gpkit/__init__.py @@ -1,5 +1,5 @@ "GP and SP modeling package" -__version__ = "0.6.0" +__version__ = "0.7.0" from ._pint import units, ureg, DimensionalityError from .globals import settings diff --git a/gpkit/nomials/map.py b/gpkit/nomials/map.py index 9bab9c749..0d44edfda 100644 --- a/gpkit/nomials/map.py +++ b/gpkit/nomials/map.py @@ -1,14 +1,13 @@ "Implements the NomialMap class" from collections import defaultdict import numpy as np -from .. import units as ureg_at_init from ..exceptions import DimensionalityError from ..small_classes import HashVector, Quantity, Strings from ..small_scripts import mag from ..varkey import VarKey from .substitution import parse_subs -DIMLESS_QUANTITY = Quantity(1, "dimensionless") if ureg_at_init else 1 +DIMLESS_QUANTITY = Quantity(1, "dimensionless") class NomialMap(HashVector): @@ -179,8 +178,8 @@ def mmap(self, orig): """ m_from_ms = defaultdict(dict) pmap = [{} for _ in self] - origexps = orig.keys() - selfexps = self.keys() + origexps = list(orig.keys()) + selfexps = list(self.keys()) for orig_exp, self_exp in self.expmap.items(): total_c = self.get(self_exp, None) if total_c: diff --git a/gpkit/nomials/math.py b/gpkit/nomials/math.py index 90b47451d..1140809db 100644 --- a/gpkit/nomials/math.py +++ b/gpkit/nomials/math.py @@ -329,8 +329,8 @@ def __eq__(self, other): if isinstance(other, MONS): try: # if both are monomials, return a constraint return MonomialEquality(self, "=", other) - except ValueError, e: # units mismatch or infeasible constraint - print "Infeasible monomial equality:", e + except ValueError as e: # units mismatch or infeasible constraint + print("Infeasible monomial equality: %s" % e) return False return super(Monomial, self).__eq__(other) @@ -491,7 +491,7 @@ def sens_from_dual(self, la, nu, result): return self._was_sig_now_posy_senss(nu, result) presub, = self.unsubbed if hasattr(self, "pmap"): - nu_ = np.zeros(len(presub.cs)) + nu_ = np.zeros(len(presub.hmap)) for i, mmap in enumerate(self.pmap): for idx, percentage in mmap.items(): nu_[idx] += percentage*nu[i] diff --git a/gpkit/small_classes.py b/gpkit/small_classes.py index cb32828bb..4fcc30e9c 100644 --- a/gpkit/small_classes.py +++ b/gpkit/small_classes.py @@ -2,6 +2,7 @@ from operator import xor import numpy as np from . import ureg +from functools import reduce # pylint: disable=redefined-builtin try: isinstance("", basestring) diff --git a/gpkit/solution_array.py b/gpkit/solution_array.py index d4168aad5..bf76d5bac 100644 --- a/gpkit/solution_array.py +++ b/gpkit/solution_array.py @@ -6,7 +6,7 @@ from .small_scripts import mag, isnan from .repr_conventions import unitstr -DIMENSIONLESS = Quantity(1, "dimensionless") +DIMLESS_QUANTITY = Quantity(1, "dimensionless") def senss_table(data, showvars=(), title="Sensitivities", **kwargs): @@ -111,13 +111,13 @@ def subinto(self, posy): # if uniting on get ever becomes a speed hit, cache the results if isinstance(got, dict): for key, value in got.items(): - got[key] = value*(key.units or DIMENSIONLESS) + got[key] = value*(key.units or DIMLESS_QUANTITY) else: if hasattr(posy, "units"): units = posy.units else: units = list(self["variables"].keymap[posy])[0].units - got = got*(units or DIMENSIONLESS) + got = got*(units or DIMLESS_QUANTITY) return got elif not hasattr(posy, "sub"): raise ValueError("no variable '%s' found in the solution" % posy) diff --git a/run_tests.py.lprof b/run_tests.py.lprof deleted file mode 100644 index 75717c1e4..000000000 --- a/run_tests.py.lprof +++ /dev/null @@ -1,4 +0,0 @@ -c_line_profiler -LineStats -q)q}q(UunitqG>Utimingsq}qU3/home/tao/projects/ce/gpkit/gpkit/constraints/gp.pyqMwUgenAq]q (MMzMB q -MMMq MKHKwq MKMq MKM$qMKMjqMKM qMKMSqMKMG qMKMqMKMeqMMzMqMMzMZqMM2MVqMM M qMM{MIAqMMMUmqMMM.qMMMqMMu MEqMM MjqMM MqMMzM=$q MM2Mq!MM Mq"MKKfq#MMzMxq$MMnM^q%MMPMq&MM\ Mq'MK Kq(MK Kq)MK M;q*MK Kq+MMS Mq,MKKBq-MMzMq.esub. \ No newline at end of file diff --git a/setup.py b/setup.py index 2ae472dcc..afabea7d5 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ LICENSE = """The MIT License (MIT) -Copyright (c) 2017 Edward Burnell and Warren Hoburg +Copyright (c) 2018 Edward Burnell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -49,11 +49,11 @@ name="gpkit", description="Package for defining and manipulating geometric " "programming models.", - author="Edward Burnell and Warren Hoburg", + author="Edward Burnell", author_email="gpkit@mit.edu", url="https://www.github.com/convexengineering/gpkit", install_requires=["numpy >= 1.12.1", "pint >= 0.7", "scipy"], - version="0.6.0.0", + version="0.7.0.0", packages=["gpkit", "gpkit.tools", "gpkit.interactive", "gpkit.constraints", "gpkit.nomials", "gpkit.tests", "gpkit._mosek", "gpkit._pint"], package_data={"gpkit": ["env/*"],