Skip to content

Commit

Permalink
added patch to accomdate respond_to_missing failure when using iruby
Browse files Browse the repository at this point in the history
  • Loading branch information
b08x committed Apr 26, 2024
1 parent 5589fc6 commit 1914b1e
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nlp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ WORKDIR /home/$NB_USER

COPY nlp/Gemfile .
COPY gems/ferret-0.11.9.0.gem .
COPY nlp/respond_to_missing.patch .

RUN chown -R $NB_UID:100 /home/$NB_USER

Expand All @@ -20,7 +21,10 @@ ENV LC_ALL=C.UTF-8
ENV PATH $HOME/.local/share/gem/ruby/3.1.0/bin:$HOME/.local/bin:$PATH
ENV BUNDLE_PATH $HOME/.local/share/gem

RUN mamba install --yes 'jupyter-ai' 'huggingface_hub' 'ipython' 'ipywidgets' 'nbconvert' 'pillow' 'pydantic' 'pyvis' 'spacy' 'SQLAlchemy' 'txtai' && \
RUN mamba install --yes \
'jupyter-ai' 'huggingface_hub' 'ipython' 'ipywidgets' \
'nbconvert' 'pillow' 'pydantic' 'pyvis' 'spacy' \
'SQLAlchemy' 'txtai' 'langchain_anthropic' 'langchain_google_genai' && \
mamba clean --all -f -y && fix-permissions "${CONDA_DIR}" && fix-permissions "/home/${NB_USER}" && \
python3 -m spacy download en_core_web_trf && \
python3 -m spacy download en_core_web_lg && \
Expand All @@ -32,6 +36,9 @@ RUN gem install ferret-0.11.9.0.gem && \
bundle config build.redic --with-cxx="clang++" --with-cflags="-std=c++0x" && \
bundle install

RUN cd $HOME/.local/share/gem/ruby/3.1.0/gems/ruby-spacy-0.2.2 && \
patch -Np1 -i "/home/jovyan/respond_to_method.patch"

# To fix: qt.qpa.xcb could not connect to display
ENV QT_QPA_PLATFORM offscreen

Expand Down
49 changes: 49 additions & 0 deletions nlp/respond_to_missing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
diff --git a/lib/ruby-spacy.rb b/lib/ruby-spacy.rb
index c0a1c3b..beed1e7 100644
--- a/lib/ruby-spacy.rb
+++ b/lib/ruby-spacy.rb
@@ -340,7 +340,7 @@ module Spacy
@py_doc.send(name, *args)
end

- def respond_to_missing?(sym)
+ def respond_to_missing?(name, sym)
sym ? true : super
end
end
@@ -454,7 +454,7 @@ module Spacy
@py_nlp.send(name, *args)
end

- def respond_to_missing?(sym)
+ def respond_to_missing?(name, sym)
sym ? true : super
end
end
@@ -660,7 +660,7 @@ module Spacy
@py_span.send(name, *args)
end

- def respond_to_missing?(sym)
+ def respond_to_missing?(name, sym)
sym ? true : super
end
end
@@ -826,7 +826,7 @@ module Spacy
@py_token.send(name, *args)
end

- def respond_to_missing?(sym)
+ def respond_to_missing?(name, sym)
sym ? true : super
end
end
@@ -901,7 +901,7 @@ module Spacy
@py_lexeme.send(name, *args)
end

- def respond_to_missing?(sym)
+ def respond_to_missing?(name, sym)
sym ? true : super
end
end

0 comments on commit 1914b1e

Please sign in to comment.