Closed bqpd closed 8 years ago
This looks great. @bqpd points out we might want to define dollars relative to a specific year (to deal with inflation), but this PR is already strictly better than using counts, so I'm ready to merge it.
Actually hold up -- this doesn't run -- we might need to update the gpkit install script to copy gpkit_units.txt
and gpkit_constants.txt
to the target folder?
Traceback (most recent call last):
File "cost.py", line 2, in <module>
from gpkit.shortcuts import Var, Model
File "/Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/gpkit/__init__.py", line 84, in <module>
enable_units()
File "/Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/gpkit/__init__.py", line 40, in enable_units
UNIT_REGISTRY = pint.UnitRegistry(path)
File "/Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/pint/unit.py", line 526, in __init__
self.load_definitions(filename)
File "/Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/pint/unit.py", line 768, in load_definitions
raise ValueError('While opening {0}\n{1}'.format(file, msg))
ValueError: While opening /Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/gpkit/gpkit_units.txt
[Errno 2] No such file or directory: '/Users/whoburg/anaconda/envs/gpkit/lib/python2.7/site-packages/gpkit/gpkit_units.txt'
Uh, it looks like it's finding a pip-installed version of gpkit, not the updated one with new units.
I ran python setup.py install
. It looks like the units txt files didn't get copied by the install script -- do they need to be added to MANIFEST
?
Oh, yeah, if you're installing like that they do.
(general practice has been to only update the manifest on each pypi release, and otherwise install in pip by cloning github and then running pip install -e gpkit
, which doesn't require an updated MANIFEST)
ok, that worked. let's merge this.
See https://github.com/convexopt/gpkit/pull/490