I want to reuse some code for my internal team at work. My plan is to create a package and then have people install the package using pip
straight out of our git repo. i.e. as shown here: https://pip.pypa.io/en/latest/reference/pip_install/#git
My question is, do I commit the dist folder to git? What is pip
looking for?
Or is there a better way to share / reuse code internally for a team (across many different projects)?
I used a .gitignore file from here (is that github's default Python .gitignore file?) and it ignores all the dist files:
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
but it seems wrong to exclude these from the repo when I'm trying to install from the repo.
In conclusion, you can add a whole folder to commit in Git. Make sure you are above the folder you intend to add. You can also use the git add command with a dot to add all files in a folder. And when specifying the folder name, use "" if the folder name has spaces.
The recommendation from Composer is NOT to commit your /vendor folder and have your deployment process take care of running composer install to grab all your dependancies. I'm coming round to the school of thought that having your /vendor folder in git has some pretty big advantages after reading this article:
Once you're ready to craft your commits, you'll use git add <FILENAME> to specify the files that you'd like to "stage" for commit. Without adding any files, the command git commit won't work. Git only looks to the staging area to find out what to commit.
You can also use a handy command, git add -p, to walk through the changes and separate them out, even if they're in the same file. git commit: This starts the commit process, but since it doesn't include a -m flag for the message, your default text editor will be opened for you to create the commit message.
You do not need to commit the dist
folder. pip
really just needs the repository to have a setup.py
file along with the packages and/or modules you're installing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With