Skip to content

[docs] add a guide on developing with an ide#574

Open
sayakpaul wants to merge 5 commits into
mainfrom
ide-guide
Open

[docs] add a guide on developing with an ide#574
sayakpaul wants to merge 5 commits into
mainfrom
ide-guide

Conversation

@sayakpaul
Copy link
Copy Markdown
Member

No description provided.

@sayakpaul sayakpaul requested a review from danieldk May 20, 2026 12:53
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Excellent! Left some comments/questions.

Comment thread docs/source/builder/ide-setup.md Outdated
Comment thread docs/source/builder/ide-setup.md Outdated
Comment on lines +88 to +90
`use flake` exposes the devshell's environment variables but does not
run its `shellHook`, so the `.venv` used by the devshell is not created
on direnv activation. Run `kernel-builder devshell` once to create it:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should automatically create it, also in direnv:

❯ ls -ld .venv                                                                                                                                                                                                                        
ls: cannot access '.venv': No such file or directory
❯ echo "use flake" > .envrc                                                                                                                                                                                                           
direnv: error /home/daniel/git/kernels-community/relu/.envrc is blocked. Run `direnv allow` to approve its content
❯ direnv allow                                                                                                                                                                                                                        
direnv: loading ~/git/kernels-community/relu/.envrc                                                                                                                                                                                   
direnv: using flake
[...]
Creating new venv environment in path: './.venv'
❯ ls -ld .venv                                                                                                                                                                                                                        
drwxr-xr-x 5 daniel users 4096 May 20 14:13 .venv

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for catching it. Some configs messed it up and I ended up with some stale instructions.

Comment thread docs/source/builder/ide-setup.md Outdated
Comment on lines +92 to +108
```bash
$ kernel-builder devshell
$ exit
```

Then have direnv source it on every activation by appending to `.envrc`:

```bash
use flake
source .venv/bin/activate
```

Reload:

```bash
$ direnv allow
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should also not be necessary. Continuing from above:

❯ cd ..
❯ cd relu
❯ pip install catalogue # Installing some unrelated dependency.                                                                                                                                                                                  
Collecting catalogue                                                                                                                                                                                                                  
  Downloading catalogue-2.0.10-py3-none-any.whl.metadata (14 kB)                                                                                                                                                                      
Downloading catalogue-2.0.10-py3-none-any.whl (17 kB)                                                                                                                                                                                 
Installing collected packages: catalogue                                                                                                                                                                                              
Successfully installed catalogue-2.0.10
❯ pip show catalogue                                                                                                                                                                                                                  
Name: catalogue                                                                                                                                                                                                                       
Version: 2.0.10                                                                                                                                                                                                                       
Summary: Super lightweight function registries for your library                                                                                                                                                                       
Home-page: https://github.com/explosion/catalogue                                                                                                                                                                                     
Author: Explosion                                                                                                                                                                                                                     
Author-email: contact@explosion.ai                                                                                                                                                                                                    
License: MIT                                                                                                                                                                                                                          
Location: /home/daniel/git/kernels-community/relu/.venv/lib/python3.13/site-packages                                                                                                                                                  
Requires:                                                                                                                                                                                                                             
Required-by

Wonder if something is missing in the configuration on your machine, I have (zsh is my default shell):

  programs.direnv = {                                                                                                                                                                                                                 
    enable = true;                                                                                                                                                                                                                    
    enableZshIntegration = true;                                                                                                                                                                                                      
    enableFishIntegration = true;                                                                                                                                                                                                     
    nix-direnv.enable = true;                                                                                                                                                                                                         
  };

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, should be fixed now.

Comment on lines +118 to +119
$ cmake -B build-ext -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ ln -sf build-ext/compile_commands.json compile_commands.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think most IDEs do this automatically when there is a CMakeLists.txt? Not 100% sure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We recommend two extensions from the doc. None of them seems to do this automatically:

  • llvm-vs-code-extensions.vscode-clangd consumes the file but doesn't seem to produce it (clangd docs).
  • ms-vscode.cpptools reads either an explicit compileCommands path or a Configuration Provider; it doesn't generate the file either.


```bash
$ cd path/to/kernel
$ code .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's been a while since I used VS Code, but I don't think this is necessary when you use https://github.com/direnv/direnv-vscode .

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I didn't use it because the project doesn't seem like it's actively maintained (last commit was 2 years back).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC, last time I tried it in Cursor it just worked. The project is only a very small amount of code, so it probably does not need a lot of maintenance? Worth trying I think.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed.

Comment thread docs/source/builder/ide-setup.md
Co-authored-by: Daniël de Kok <me@danieldk.eu>
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