I have project written in python which i would like to upload to my github repo. In my source directory in laptop, there are other compiled python scripts (.pyc) residing as well which i would like to avoid uploading to github. The documentation avaiable on the internet shows uploading entire source directory to github repo.
Is there a way to avoid uploading certain file type, specifically *.pyc, to github repo?
Make a .gitignore file and add *.pyc to it
I recommend you put this standard .gitignore for python by github It has *.py[cod] to get rid of .pyc,.pyo and .pyd files
This is the intent of the .gitignore file
For your specific problem, you should add *.pyc to this file.
When you upload you files to github only what is in your git repo gets uploaded. pyc files should not have been added to your git repo anyways. If you did, remove them before pushing your repository.
You can use the .gitignore files to not let pyc files show up in your git status view.
Related
I just did a reset on Windows and deleted all the files, but did not wipe my drive clean. When i realized that I didn't put my Pycharm Projects folder into onedrive I started try to recover this folder with all my code in it. I found the user folder that held my Pycharm projects folder in windows.old and when i went into the project folder it had all the logs from messing around with the code and the project foler .iml file, but did not have any of the actual .py files from my coding projects. Is there anyway to recover these files. I tried to look everywhere and have done everything I can to recover these files but nothing is doing the trick
It looks like your Windows just updated to a new verion or build, that's why moved your project to a folder called windows.old, you need to copy the files that you need outside, then reinstall pycharm. It's recommended to reinstall programs.
For new projects, remember to use git repositories, www.github.com or www.gitlab.com can host private projects to avoid those problems
In Visual Studio Code, with git extensions installed, how do you add files or complete folders to the .gitignore file so the files do not show up in untracked changes. Specifically, using Python projects, how do you add the pycache folder and its contents to the .gitignore. I have tried right-clicking in the folder in explorer panel but the pop-menu has no git ignore menu option. Thanks in advance.
Edit: I know how to do it from the command line. Yes, just edit the .gitignore file. I was just asking how it can be done from within VS Code IDE using the git extension for VS Code.
So after further investigation, it is possible to add files from the pycache folder to the .gitignore file from within VS Code by using the list of untracked changed files in the 'source control' panel. You right-click a file and select add to .gitignore from the pop-up menu. You can't add folders but just the individual files.
This extension lets you add folders to .gitignore.
New to Django. I have some Python programming experience (beginner-intermediate). I was taking the Django Polls tutorial and can't resolve deployment problem in the Advanced Tutorial: How to write reusable apps: https://docs.djangoproject.com/en/1.9/intro/reusable-apps/
In the Using Your Own Package section, I have a problem when I pip install --user django-polls/dist/django-polls-0.1.tar.gz. I get this response:
"Requirement 'django-polls/dist/django-polls-0.1.tar.gz' looks like a filename, but the file does not exist."
I'm using a Windows 10 computer and I noticed that the package extension is .zip not .tar.gz
I did pip install --user django-polls/dist/django-polls-0.1.zip (changed the extension to .zip) but had the same response:
"Requirement 'django-polls/dist/django-polls-0.1.zip' looks like a filename, but the file does not exist."
I am doing the pip install from the dist directory. In trying to figure out the source of the problem, I have some suspects:
When I saved the README.rst file in Spyder I selected the web pages (.css .htm .html) option but changed the extension to .rst. In file explore under type, it says RST File, so I thought I did this correctly. Otherwise I'm not sure what program to use to create an .rst file.
I couldn't figure out what program creates a .in file type. My MANIFEST.in file is a text document.
Why was a .zip file created for the package instead of a .tar.gz file?
My LICENSE file is an .html doc. Does that matter?
Should I have created a virtual environment? Does python manage.py startapp polls from the first part of the tutorial create a virtual environment.
I cut and pasted all of the code from the tutorial, so unless the tutorial has a typo I think the code is probably not the problem. I also have Anaconda installed if that makes a difference.
This is my first deployment so please dumb-down the explanations if possible. Thank you.
You have to go up one directory to perform the install, if you are in the project directory you want to install it in to.
So try this:
../django-polls/dist/django-polls-0.1.tar.gz
If you are using a virtual environment, you can drop the --user flag.
We are using perforce for our version control. So when i go to build a package
python setup.py sdist
it creates a versioned folder with everything in it and then tries to delete it and fails because it contains a bunch of read-only files. It also fails when trying to write to setup.cfg when that isn't checked out.
What is the proper way to do this from a perforce repo or any package that may have read-only files? Do i have to check out everything first and revert unchanged?
Thanks
I'm having a problem with my .gitignore, since it seems to be ignoring the file extensions in there. Every time I change any file I end up with hundreds of other files. I've looked at previous posts on here to deal with the problem, and I copied what I have in my .gitignore from a git repository: https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore
but that doesn't seem to be working. I've restarted Eclipse, refreshed my git repo and nothing is happening.
Any advice?
It seems those files have been added to the git repository already.
Are those "not staged files" or "untracked files"? In case of former, you remove files from repository using following commend.
git rm --cached