I am trying to understand a Python code available on GitHub. The project is kind of large, when I understand the code available in one file and try to understand the code in another file, I forget some of the previous concepts (that I have understood in the previous files).
Is there any way I could add comments or a little description of each line while understanding the code in GitHub project? I know I can download the code and add comments using some IDE or Notepad etc. But it would be difficult for me while training, as I have to clone the project for training.
I suggest you fork the code, and add comments to the code itself, on your copy of the repository. You can edit the files inside GitHub, no need to download the code.
I'm sorry but you cannot do that. You cannot just edit someone's code like that, you could first fork the project and then add your comments. That would be a good way to work on the code with your personal comments. Or you could just download the code to add comments.
Related
guys I need to analysis python by golang with antlr4,I found Python3LexerBase.go is missing,Does anyone have it?danke
That file is not provided in the Github repo of grammars. You'll need to implement that class yourself. You can look at the other implementations that are provided of the Python3LexerBase class (C#, Java and Python are provided, if memory serves me well).
Also see: https://github.com/antlr/grammars-v4/issues/2288
Please note that the Github repo of grammars is not an official maintained repository of the authors/maintainers of ANTLR. It is a large amount of (not too well tested) contributions of other people. Do not expect all files to be there, and be cautious when using them in anything other than a small side/pet project you're working on.
hope you can help me with this one.. A simple example will do.. I have a Mule project in a github repo and I need to update the pom.xml automatically.. I know could "mimic" what we humans do with python3 by cloning the repo down, update the file and push the changes back to github.. (using the "os" module) but In this case I cannot clone the repo..(the storage is not reliable) I see that there are several github modules for python I cant get it to work (lack of knowledge I guess).. If anyone can show me simply how to update a line in the file (replace a string for example) .. that would be a great starting point for me.
sample scenario:
file: https://github.com/USERNAME/PROJECT_NAME/blob/master/pom.xml
I need to update line <artifactId>template</artifactId> (in this case, line 6) with the line <artifactId>actual_project_name</artifactId>
Thanks!
I was able to "crack it" ... (just needed time and try/error)
I shared a simple script to do basic tasks using the pyGithub module, included partially update a file. Hopefully this will help anyone on the same situation and will be a nice starting point. cheers!!
REPO LINK: https://github.com/santiagomoneta/pygithub-example
Cheers!
I am following the documentation on the hugging face website, in there they say that to fine-tune GPT-2 I should use the script
run_lm_finetuning.py for fine-tuning, and the script run_generation.py
for inference.
However, both scripts don't actually exist on GitHub anymore.
Does anybody know whether the documentation is outdated? or where to find those two scripts?
Thanks
It looks like they've been moved around a couple times and the docs are indeed out of date, the current version can be found in run_language_modeling.py here https://github.com/huggingface/transformers/tree/master/examples/language-modeling
Links have been moved around again, you can find everything related to language modeling here.
All needed information including location of the old script is in the README
I'm new to development and trying to upload small projects that I've worked on to my GitHub profile. These projects are not dependent on each other.
My issue is that some of them are small single-file projects. Sort of like mini challenges that I've solved. So I'm thinking of grouping them together under one repo called "Python programming", for example.
Is this a good practice?
If yes, how should I go about it in Git, and
how can I still have a README file showing up for each mini project.
If no, what would you recommend doing?
GitHub will render a README file for every folder you visit, so when using just a single repository, one solution would be to still create one sub folder for each “subproject” that as such can have its own README file.
But before going that route, you should think about if those small projects actually belong together. That’s ultimately what should decide whether you want to put them all in the same repository or whether you want to split it up into several repositories.
Some things to consider for that decision:
If the projects do not depend on another, do they still relate to another? For example, are those projects part of a bigger programming challenge like Project Euler and you’re just collecting all your solutions? Then a single repository might make more sense.
What is the chance for individual projects to grow into bigger things? Many things start very small but can eventually grow into real things that justify their own repository. At that point, you might even get others to contribute.
Does it make sense for those individual files to share a history? Are the files even going to be edited once they are “done”? I.e. is this just a collection of finished things, or are they actually ongoing experiments?
Ultimately, it comes down to your personal choice. But GitHub, as the repository hoster, should not be driving your decision. You should create Git repositories locally as it makes sense to you. If that means you just have a single one, that’s fine. If that means you create lots of them, that’s also fine.
Unfortunately, the GitHub UI is not really made for small one-off projects. The repository list is just to unorganized for that. If you decide to use small projects, I advise you to add some prefix for categorization within your GitHub profile, so you know what this is about.
A good alternative for one-off projects, especially when it’s just a single (or a few) files are Gists. Gists are born as a way to share code snippets but under the hood, every Gist is actually a full Git repository. Of course, Gists do not offer the tools normal repositories on GitHub have (e.g. issues, pull requests, wikis). But for what you describe, you probably need neither of those. Then, Gists are a fine way to share simple things without adding full repositories to your profile. And you can still clone them (the remote URL is git#gist.github.com:/<gist-id>.git) and have a full history and support for multiple files if you need those.
Commonly, you'll see that the top level of the repo contains the README file, maybe a setup.py and some other extraneous information, and perhaps a tests folder. Then there will be a folder that shares a name with the repo. Inside of that folder is the code that's intended to be core content of the module/package/script.
It's also not unusual to see different organization, particularly with very small projects of single-file scripts.
For the specific case you mention, do whatever you like. What you propose sounds totally reasonable to me. I would not want to have a separate repo for all the challenges I solve!
I usually use a gist for trivial items I don't necessarily want to make a repo for, including coding challenges. So I would offer that as an alternative. Do whatever suits you best.
I just documented loads of my code and learnt how to use sphinx to generate the documentation. I want to include that into my GitHub project page but I do not know how to. Does anyone know existing tutorial or simple step to do so?
github will serve static content for you using their github pages feature. Essentially, you create a branch called gh-pages, into which you commit your static pages. The pages are then served at you.github.com/yourproject.
See the instructions at http://pages.github.com/.
You will likely run into an issue using Sphinx on github, because Sphinx uses directories with leading underscores. You can fix this by adding a file called .nojekyll in the the directory with the generated sphinx html.
John Paulett's answer is obviously correct and likely sufficient for most users already (+1).
Alternatively you might want to check out Ben Welsh's thorough tutorial Sphinx documentation on GitHub, which provides step by step instructions as well as a convenient Fabric based script/task tying those together to get you started to Quickly publish documentation alongside your code [...] via a single command.
github-tools has a feature doing exactly what you are asking for:
paver gh_pages_create gh_pages_build
Refer to the excellent documentation (of course using itself) for how to set it up for your project.