Closed BenPortner closed 1 year ago
👋 @BenPortner
It would be great if you add to the docs
of the package an example that uses the pint based parameters you're adding here.
The pipelines are failing here with py27 @cmutel , would it be safe to remove the py27 support of brightway2-parameters ? I would advice in favor (of removing py27 support) because:
The pipelines are failing here with py27 @cmutel , would it be safe to remove the py27 support of brightway2-parameters ? I would advice in favor (of removing py27 support) because:
- There would be a version bump when adding this feature, making it clear that after a certain version, we don't support py27 anymore
- all other py3x envs pass the tests
also, pint seems to be "python 3.8+" compatible, so maybe, we shouldn't even be testing against python<3.8
@tngTUDOR: Updated the docs. @cmutel: waiting for your approval to drop py27 support
@BenPortner Awesome work! Dropping 2.7 is fine.
@cmutel @tngTUDOR @michaelweinold ready to merge in my opinion. please review below changes and give me feedback.
open question:
change log:
Hey, it looks like you are done making changes for now, but could you quickly confirm?
can appveyor setup be removed as well?
Yes, Github Actions builds on all OSes and it is simpler to maintain one CI.
who will publish on pypi / conda-forge? if you give me access i can handle this.
Conda-forge will generate update PRs automatically, and the maintainers will be notified, once we release on pypi.
I can make you a collaborator on PyPI if you tell me your username or associated email.
Hey, it looks like you are done making changes for now, but could you quickly confirm?
Confirmed!
can appveyor setup be removed as well?
Yes, Github Actions builds on all OSes and it is simpler to maintain one CI.
Done.
who will publish on pypi / conda-forge? if you give me access i can handle this.
Conda-forge will generate update PRs automatically, and the maintainers will be notified, once we release on pypi.
I can make you a collaborator on PyPI if you tell me your username or associated email.
I would like to be a collaborator. This is me: https://pypi.org/user/BenPortner/
@cmutel @tngTUDOR @michaelweinold
I had to fix PintInterpreter.eval()
. The following raised an error before but works now:
from bw2parameters import PintInterpreter
i = PintInterpreter()
i("1 kg + 200 g")
# 1.2 kg
Minor changes:
utils.get_symbols
with Interpreter.get_unknown_symbols
utils.EXISTING_SYMBOLS
with Interpreter.BUILTIN_SYMBOLS
Interpreter.eval()
has new parameter known_symbols
which can be used to pass temporary symbol definitions (i.e. the symbols are not permanently added to the symtable)
This PR introduces a new class
PintParameterSet
, which can solve formulas including units.The unit parsing is handled by the external
pint
package, which is included as an optional dependency. To activate, users will have to dopip install bw2parameters[pint]
. The new class should not break any existing functionality. Tests for the new class have been included and should be skipped if pint is not installed in the environment. Calls toevaluate
return a dictionary withpint.Quantity
values.Example