python - Managing PYTHONPATH for development environment -


I am developing several different Python packages with my team, let's say we have ~ / src / Pkg1 , ~ / src / pkg2 , and ~ / src / pkg3 . How can we add each of them to PYTHONPATH without managing dot-files?

We can add, say, ~ / src / site / sitecustomize.py , which is added once in PYTHONPATH , but It is "guaranteed" that the global sitecustomize.py will not be.

Virtual Ive looks like a wrong solution, because we do not want to create / install packages after every change.

You have a lot of options ...

1) Why not dotfile ?

You can centralize the management of dotfiles with a centralized repository and optionally with version control. I use a dropbox folder named dotfile , but many people use other services to manage github or dotfiles.

If you do this, you will guarantee that in order to share some dotfiles to everybody on your development team, you can define a dotfile that says .python_proys Suppose that the appropriate PATH and PYTHONPATH are exported to every developer in source in your environment

pkg1 is only a script, pkg2 is a script and one module and pk3 are only a module For example, Python_proys example:

  export path = $ path: ~ / src / pkg1: ~ / src / pkg2 export pythonpat = $ pathhen: ~ / src / pkg2: ~ / src / Pkg3  

And then, each developer has to press source anywhere in this dotfile. Everyone can prefer to manually source a docsfile before using packages. Any other source can apply to it in its .bashrc or .zshenv or whatever it may be in the dotfile.

This idea is a centralized point of coordination and to maintain only one dotfile: .python_proys dotfile.

2) Use simulations

You can define a directory in your home, such as (for module) and ~ / bin (for script) and ~ / src / , and make it available to every developer with this PATH and PYTHONPATH < / Code> Settings:

  Export Pat = $ path: ~ / bin export PYTHONPATH = $ PYTHONPATH: ~ /  Why not dot files? , where  pkg1  is only a script, using the same example on  pkg2   

/ Strong> a There is a script and there is also a module and pkg3 is only a module, so you can symlink like this:

  cd ~ / bin ln -s ../ Src / pkg1 ln -s ../src/pkg2 cd ~ / dist ln -s ../src/pkg2 ln -s ../sr C / pkg3  

Those commands are a script You can write a bootstrap script automatically or simply copy and paste the command and You can save it in a shell script. Keep it in any way and make it intermediate in the same way that I explain it first.

This way, .dotfiles will not change, only the scripts defined script.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -