r/github • u/USA_Ball • Dec 02 '23
Why is github saying i've used 99% python. I've used some, but thats an absurd amount, and i definitely haven't written 1000x more than everything else
47
u/HoytAvila Dec 02 '23
Most likely you pushed a python virtual environment. Since you did that i wouldn’t be surprised if you also pushed .env file or other secrets. Check your repos just incase
8
u/USA_Ball Dec 02 '23
yeah, i see that. What's so bad about virtual environments? This offending repo was just a fun hobby project.
18
u/holistic-engine Dec 02 '23 edited Dec 04 '23
Nothing bad about them, but it’s good practice not to push a venv to a repo.
You want people to manage dependencies on their own, if they are going to use your repo
Edit: Some tips & tricks for people reading. I always have two files when I am done working and ready to start pushing my repo.
Make sure that my requirements.txt file is correct and isn’t missing any dependencies, contains wrong dependency version
Make sure that my setup.py file doesn’t contain any errors, typos missing dependencies etc
git add those two files.
5
u/USA_Ball Dec 02 '23
It's actually in my .gitignore, but i added my gitignore after the initial commit. I'll just delete it from my github and it should be good.
2
u/QyuriLa Dec 03 '23 edited Dec 03 '23
BTW, technically any file you commit will remain in your repository forever, because Git keeps track of all your commits and their contents, which means that your repo probably now has dozens of MBs of redundant files for nothing. The next time you accidentally commit something you shouldn't have, I highly recommend
revertingresetting and getting rid of the associated commits.Edit: My bad, don't do
git revertas it just makes another commit and doesn't solve the problem.1
1
u/Coherent_Paradox Dec 03 '23
Rebase and force push will clean in though. You can even use drop in interactive rebase to explicitly remove commits: https://stackoverflow.com/a/59331839
1
u/eo5g Dec 03 '23
Let’s be careful with our words here— revert as in “git revert” won’t fix it either.
1
5
u/piano1029 Dec 02 '23
Delete it from the Github web UI and then squash the gitignore commit down on the ones below it
71
3
u/alienvenom Dec 02 '23
Da fuq is “Nix”?
4
u/USA_Ball Dec 02 '23
My school requires us to use a platform called replit. Replit uses this obscure package manager called nix, i suspect for two reasons: 1) it installs packages per project, rather than for the whole machine such as apt(and i think snap does the same, i dont use it though), and 2) it doesnt require sudo. So when i use git push at school, the little nix dependency thing always pops up.
1
u/littleprof123 Dec 04 '23
More likely because the environment it describes is generally fully reproducible
1
1
u/itsjordanmuller Dec 03 '23 edited Dec 03 '23
Be sure to read through the docs for that README Stats Card generator. It has lots of customization options including the ability to filter out languages, and set the percentage calculations to be based on file size, number of files, or a mix of both. You might want to play around with adjusting this ratio until it looks/feels "right" to you!
Also, the percentage could remain high even after adding certain stuff to .gitignore because the files that did get committed before adding the exception would still be in the repository.
Here's the relevant section of the README.md:
Language stats algorithm
We use the following algorithm to calculate the languages percentages on the language card:
ranking_index = (byte_count ^ size_weight) * (repo_count ^ count_weight)By default, only the byte count is used for determining the languages percentages shown on the language card (i.e. size_weight=1 and count_weight=0). You can, however, use the &size_weight= and &count_weight= options to weight the language usage calculation. The values must be positive real numbers.
More details about the algorithm can be found here
1
u/Divaksh Dec 03 '23
It is because you have not told API what you want in the badge and what not. Use the following line &hide=python in the URL and you will be able to hide python from the stats.
1
u/avgupta456 Dec 03 '23
Try out GitHub Trends for more accurate lines of code stats (githubtrends.io)
1
u/Looksky_US Dec 04 '23
Stats seem off? Check your repo’s.gitattributes to make sure it’s excluding files that shouldn’t count (like 3rd-party libs & generated code). Also, worth a look at file sizes & types in your repo to ID any big files/libs messing with your stats.
1
u/Scrungo__Beepis Dec 04 '23
This is a petpeeve of mine with ipynb files, jupyter inserts a ton of Metadata and images and videos right into the ipynb file, which is really nice for distributing experimental results but it makes github go nuts and think that my project is 90% jupyter even though there's like 2 or 3 small notebooks that happen to contain videos.
1
-5
u/LordPorra1291 Dec 02 '23
This is not a GitHub thing
4
u/USA_Ball Dec 02 '23
afaik githubusercontent(the site that contains this thing) is directly associated with github. raw.githubusercontent.com is used all the time, for example. Am i misunderstanding something?
1
u/LordPorra1291 Dec 03 '23
Afaik these stats are developed by a third party and not GitHub, so I don't understand why you are complaining to GitHub about some code written by someone else.
If this is a GitHub thing, I never saw it.
0
181
u/SexyMuon Dec 02 '23
You probably have a repository in which you have Python libraries and other bulk generated in the environment. Make sure to use .gitignore and you should be good.