开发者

Pip, Virtualenv & Git project setup and bootstrapping

开发者 https://www.devze.com 2023-01-20 18:37 出处:网络
Assuming you have a project setup like this: -WebApp |_ requirements.txt |_ bootstrap.py (virtualenv bootstrap script)

Assuming you have a project setup like this:

-WebApp
   |_ requirements.txt
   |_ bootstrap.py (virtualenv bootstrap script)
   |_ src
       |_ setup.py
       |_ develop-app
             |_ somecode.py
             |_ morecode.py

The bootstrap.py is created with virtualenv:

https://virtualenv.pypa.io/en/latest/reference.html#creating-your-own-bootstrap-scripts

Now, the entire WebApp dir is a git repo (obviously excluding the virtualenv). The purpose is to create a portable virtualenv/git environment. The problem is if you put the develop-app in your requirements.txt as develop, it will install it under /src in your virtualenv dir, and symlink that into your virtual-env si开发者_运维知识库te-packages. What you end up with is two copies of your source code—one that's tracked by git and the one in the Virtualenv that you use but is not tracked by git.

How would you ensure that changes made in the directory tracked by git (develop-app) automatically gets updated within your virtualenv?


How about not adding your develop app to the requirements.txt list.. and just run the code from your git repro? The point of requirements is to specify which requirements your development app has right? It is rather strange to me to make it require itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号