Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ingredients #272

Merged
merged 141 commits into from
May 31, 2023
Merged

Ingredients #272

merged 141 commits into from
May 31, 2023

Conversation

ccomb
Copy link
Collaborator

@ccomb ccomb commented Apr 20, 2023

  • Brightway Explorer and Ingredient Editor in Jupyter notebooks
  • Use the code instead of the name in complex ingredients
  • Improved the dockerfile and makefile
  • rewrote import and export

Copy link
Member

@n1k0 n1k0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started reviewing the code until I realize this is WAY too much Python for me… so I focused on testing the ingredient form.

Got a FileNotFoundError when I pressed the Publish button:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File /opt/conda/lib/python3.10/site-packages/ipywidgets/widgets/widget_output.py:103, in Output.capture.<locals>.capture_decorator.<locals>.inner(*args, **kwargs)
    101     self.clear_output(*clear_args, **clear_kwargs)
    102 with self:
--> 103     return func(*args, **kwargs)

File ~/ecobalyse/data/notebooks/ingredients.py:347, in commit_ingredients(_)
    344 @out.capture()
    345 def commit_ingredients(_):
    346     shutil.copy(INGREDIENTS_TEMP, INGREDIENTS_BASE)
--> 347     subprocess.run(f"git add {INGREDIENTS_BASE}")
    348     subprocess.run("git commit -m 'new ingredients'")
    349     subprocess.run("git push origin ingredients'")

File /opt/conda/lib/python3.10/subprocess.py:503, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    500     kwargs['stdout'] = PIPE
    501     kwargs['stderr'] = PIPE
--> 503 with Popen(*popenargs, **kwargs) as process:
    504     try:
    505         stdout, stderr = process.communicate(input, timeout=timeout)

File /opt/conda/lib/python3.10/subprocess.py:971, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize)
    967         if self.text_mode:
    968             self.stderr = io.TextIOWrapper(self.stderr,
    969                     encoding=encoding, errors=errors)
--> 971     self._execute_child(args, executable, preexec_fn, close_fds,
    972                         pass_fds, cwd, env,
    973                         startupinfo, creationflags, shell,
    974                         p2cread, p2cwrite,
    975                         c2pread, c2pwrite,
    976                         errread, errwrite,
    977                         restore_signals,
    978                         gid, gids, uid, umask,
    979                         start_new_session)
    980 except:
    981     # Cleanup if the child failed starting.
    982     for f in filter(None, (self.stdin, self.stdout, self.stderr)):

File /opt/conda/lib/python3.10/subprocess.py:1847, in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session)
   1845     if errno_num != 0:
   1846         err_msg = os.strerror(errno_num)
-> 1847     raise child_exception_type(errno_num, err_msg, err_filename)
   1848 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: 'git add /home/jovyan/ecobalyse/data/food/export_agb/ingredients_base.json'

data/food/import_agb/importing_databases.py Outdated Show resolved Hide resolved
data/notebooks/ingredients.py Outdated Show resolved Hide resolved
@n1k0
Copy link
Member

n1k0 commented May 25, 2023

I tested again the documented setup adn the export commands, using the appropriate ZIP files, and it works just fine. Fort the records I'm having several minor differences in the impacts generated in ../public/data/food/processes/builder.json, which may simply be rounding precision errors (I'm using an apple m2).

Great work, for me this patch is — apart from remaining questions about the public availability of aforementioned ZIP files — in a landable state 👍

@n1k0 n1k0 self-requested a review May 25, 2023 14:48
@n1k0
Copy link
Member

n1k0 commented May 25, 2023

Just a warning, I'm getting an error on the Web client about unknown trigrams:

image

We should make sure we've updated impacts.json and that it's published appropriately.

@n1k0
Copy link
Member

n1k0 commented May 25, 2023

@ccomb I took the liberty to push a .gitignore at the root of /data in 45b6f92 so we don't version ZIP files by mistake :)

@ccomb ccomb merged commit e2b5f6b into master May 31, 2023
6 checks passed
@ccomb ccomb deleted the ingredients branch May 31, 2023 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants