-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Added tutorial for writing C module #1026
Conversation
If you tell me which is the essential information, I'll happily include it - the fact is, besides the sources I've listed, I didn't find better source (besides the source code). So, please add your comments, links and resources, and I'll incorporate them - or use this to bootstrap your edits :) |
I think that we are folding a couple of usecases and I feel that there are valid reasons why we should treat them as distinct.
In the fist case the developer is quite free to do whatever is needed. If the implementation works in their application, great. Here a simple guide might be useful. The second is quite different in that the bar is higher, as any flaws or inefficiencies will impact a large number of developers and we have some support responsibility; also to minimise an future support issues, it also makes sense that we try to standardise on a consistent programming style, etc.. |
I've always had the first case in mind (a developer writing his own private extension). At first, I didn't even include the link in the navigation - however, the mkdocs will not generate the documentation if the page is not included in the mkdocs.yml. So I was forced to do that. But even for this use case, a documentation is extremely important - experts often can't imagine the difficulties newcomers face. And this tutorial, even though not all-encompassing, shows how to write a C module, which sections of the PIL to read and how to use that C extension from a lua module. It is a step in the right direction will get the ball rolling and should be made available. I'm happy to improve it further, incorporate comments etc. So, a question: if I update the text and make it very clear that this is for 'private extensions' (and we find a better, less official way of including this text somewhere in docs) will that be 'good enough'? |
@romanchyla @DesperateProgrammer @pjsg, I've been thinking about this and I have a suggestion. You may have read my Unofficial FAQ. This getting a bit long and rambling and needs updating, but it is also currently aimed at the Lua applications programmer, rather than a programmer who wishes to develop a C module. As Roman proposes we could really use a set of articles which provide a deeper level of detail than the current FAQ for this second category. My own view is that the current Github PR / 3rd party approval mechanism is great for controlled publishing of new content, but it is inflexible and a pain for working collaboration on new draft content. My suggestion is that we use a shared wiki to work on a working copy of this module developer FAQ, and from time to time snap an agreed version into this repo. Does anyone think that this is a workable idea? |
I think the wiki needs a dedicated person who would take care of keeping it organized, it is actually a hard work [it might depend on the wiki, but still...and the mkdocs]. There is too many projects out there with good intentions and terrible [outdated] wikis.... A workable solution that has both features (ie flexibility and control) could be a separate git repo and 'git submodule'. Before you raise your voice in protest, hear me out: git submodule is similar to symbolic link in linux (or SVN reference), the repository can point to a specific commit in another repository. Master can point to a specific commit. And from time to time, the link would be changed to a different commit [that is what Terry calls the 'snap' of the wiki] That is less work for everyone. From the perspective of nodemcu-firmware nothing would change (git fetch, mkdocs serve). The latest version of the wiki would be browsable [by virtue of it being a Github repo]. And from the perspective of committers to the docu-wiki, it has all the nice features of version control (but follows faster PR policy). But I think somebody would have to play with the mkdocs - it doesn't allow for generation of nested sections. And so it forces one to make weird hoops. [I can do that, if there was a consensus] |
I was thinking of the wiki as a temporary collaboration tool, but a lightweight git repo will be workable. Setting up mkdocs in my dev VM was trivial: a couple of bash lines and an extra NAT mapping. The master repo for project docs is this repo. We have no guarantee that if you, say, host the submodule that you don't subsequently delete it. So 👎 to using submodules for this usecase; IMO, the working version should be regarded as an ephemeral shared repo with the working contributors to the document having direct commit access, and even that is a tedious overhead IMO. To be clear I am talking about a rapid drafting cycle with the aim of establishing consensus versions to snap into this repo by the normal project PR practice. |
I tried to say that it should be nodemcu repository (ie: nodemcu/nodemcu-wiki) - then you have all the guarantees/control - and can give merge permissions to users who would not be able to commit into the master nodemcu afaik, the github wiki is very good tool for edits - the power is in the simplicity [people don't have to make PR's, they can edit directly - yet their edits can be reviewed/reverted/vetted] try to reconsider it in the light of this new information, but sure if there is somebody who wants to go ahead and maintain the wiki (and the markdown, plus resulting mkdocs generated content), I'll contribute with edits :) add: mkdocs - convincing it to generate nested navigation is not so trivial (but I gave it only few minutes, I could be wrong) |
@marcelstoer Marcel, comments? |
So, finally...my 2 cents.
Shall we close this PR and @romanchyla creates a now one when everything has been sorted out or shall it stay open (my preference) until the changes are committed to the existing branch and force pushed? |
I also vote for closing this PR, but my only perturbation would be to include this content in the Extension Developer FAQ. |
@romanchyla @DesperateProgrammer @pjsg @TerryE I just created https://github.com/nodemcu/nodemcu-firmware/wiki/%5BDRAFT%5D-How-to-write-a-C-module as temporary collaboration space until we're happy to PR this. |
Following discussion in #1017, I'd like to submit the tutorial on how to write a C module for Lua. I was not sure where to place it in the navigation tree (and didn't want to make big changes)
ie: i didn't find how to do this:
mkdocs allows (only?) this variant, which is ugly