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

Fixed inspect request using Preamble approach #21

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

anutosh491
Copy link
Collaborator

@anutosh491 anutosh491 commented Nov 27, 2023

On main

image

On branch

image

@anutosh491
Copy link
Collaborator Author

anutosh491 commented Nov 27, 2023

cc @ioanaif
Continuing our discussion from Friday. I have the following

After talking to Johan, I got to know about the following

i) The execute request and the inspect request are decoupled but then at the same time as we use shift + enter to trigger both of them, the inspect request for a client like JupyterLab would be processed through an execution request only
ii) But then what role does inspect_request_impl play ? It comes into picture when other client like a jupyter console is used .Hence we have established that we need an inspection check separately and also one through the execution request.
iii) But should we use the inspect function in the execute_request_impl body ? After discussing with Johan I realized that a better method to do this would be using preambles. This helps us overall (also when we get to magics in the near future) .

So we have the following
A cell with a behavior defined in the preamble manager which depends on a certain pattern. For example:

  1. if a cell begins with %% or %, it is a magic cell or magic line,
  2. if a cell begins with !, it is a shell command,
  3. if a cell begins with ?, it is an introspection.

@vgvassilev
Copy link
Contributor

Is there a way to add tests to this PR?

cc: @JohanMabille

@JohanMabille
Copy link
Collaborator

Yes, we could instantiate an interpreter, call the execute_request method and check the returned json.

@vgvassilev
Copy link
Contributor

@anutosh491, could you do that?

Copy link
Collaborator

@JohanMabille JohanMabille left a comment

Choose a reason for hiding this comment

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

I would add a test_interpreter.cpp file instead of test_execute_request, for:

  • granularity, we don't want one file per tested feature
  • naming: test_execute_request sounds like you test the whole path of an execute request sent from a client (including the middleware part)

src/xinspect.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
src/xinspect.hpp Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/main.cpp Show resolved Hide resolved
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM! We should add a subsequent PR tracking the testing coverage. We can take inspiration from https://github.com/compiler-research/CppInterOp/blob/d294b0790318522fd1eb0b0a2c786a4ba0347a58/.github/workflows/ci.yml#L46

@vgvassilev vgvassilev merged commit 396e6a7 into compiler-research:main Jan 8, 2024
4 checks passed
@anutosh491 anutosh491 deleted the Implement_preamble branch January 8, 2024 13:47
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.

3 participants