Skip to content

Simple Hook: Add License#66

Merged
jhidding merged 6 commits into
entangled:mainfrom
oscar-bender-stone:addlicense
Jul 5, 2025
Merged

Simple Hook: Add License#66
jhidding merged 6 commits into
entangled:mainfrom
oscar-bender-stone:addlicense

Conversation

@oscar-bender-stone

@oscar-bender-stone oscar-bender-stone commented Jul 5, 2025

Copy link
Copy Markdown

Firstly, thank you for your program! I have been looking for an org-mode alternative for some time, and with Entangled, I like having the freedom to use any text editor! I am using it in a medium-sized project (likely to be 5k-10k LoC), which could be a good example to show.

Secondly, I am submitting this patch to add a new hook for licenses. Very similar to shebangs, most licenses (particularly SPDX) generally go at the top of a source file. I added the hook addlicense for this purpose.

  • The new file, hooks/addlicense.py, is nearly identical to the shebang hook.
  • I added a new test with a C file, tests/test_addlicense.py, and it passes.
  • Minor fix: I noticed there isn't a poetry section in pyproject.toml, but poetry is called in the Makefile. I changed the latter to use hatch, but I'm not sure which is the default for this project.
  • Feel free to change the name - I was going to do license, but then remembered it's a builtin constant.

@jhidding

jhidding commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

Thank you for this contribution! I see you changed the Makefile to work with hatch instead of poetry. Actually, I've recently switched to uv for package management; I just hadn't updated the Makefile yet.

@oscar-bender-stone

Copy link
Copy Markdown
Author

Thank you for this contribution!

Of course! I have some other ideas as well. I would like to make an LSP or extension to entangled that checks whether generated comments were removed. I imagine this would be helpful on a codebase where people switch between the Markdown and generated source files.

I see you changed the Makefile to work with hatch instead of poetry. Actually, I've recently switched to uv for package management; I just hadn't updated the Makefile yet.

I added a quick fix for the Makefile. Should a note be added to the README, or will poetry still be supported (for user installation)?

@jhidding

jhidding commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

No user installation works with anything pip compatible (pep-621?). It's just development that sort of requires uv. If poetry is still mentioned in the README that should be fixed. (I'm a bit of a scatter brain)

@jhidding

jhidding commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

Thanks also for the .editorconfig. I'm amazed I didn't add it myself yet. It's not entirely the settings I'd like, but that I can fix once merged.

Comment thread README.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's rename the hook to spdx_license; I don't like arbitrary verbs in variable names

@jhidding jhidding merged commit 8fe6249 into entangled:main Jul 5, 2025
8 checks passed
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.

2 participants