This section provides some basic instructions on how to get started using everyapp.bootstrap. It also includes descriptions of some of the new sub-directories that you will find in your project as a result. Finally, some pointers on what to do next are provided.
everyapp.bootstrap consists of one main command-line utility, called mkbootstrap, that generates a bootstrap script and a configuration file. By default, the bootstrap script is named bootstrap.py and the configuration file is named bootstrap.cfg.
You use mkbootstrap both to generate your first bootstrap files and also to upgrade your bootstrap.py when you install newer versions of everyapp.bootstrap.
So, to get started, in your project’s root directory, run the command:
mkbootstrap
This will generate the bootstrap.py and bootstrap.cfg files.
You can then edit bootstrap.cfg as desired, though this is a completely optional step. The bootstrap.cfg file lets you customize the behaviour of bootstrap.py in several ways like:
See also
bootstrap.cfg for information on editing the bootstrap.cfg file.
Once you have bootstrap.cfg set up the way you want, you are ready to bootstrap the virtualenv environment for your project. To do that, run the command:
python bootstrap.py
This will create the virtual environment in the current directory (i.e. the root directory for your project).
Note
If you want to use a different version of Python than the default one installed on your system, just run bootstrap.py using that interpreter. Your virtual environment will then use that version of Python for everything automatically.
The final step is to activate the environment. This is something you should do every time you work on your project. To do it, run the command:
source ./bin/activate
... or, if you are on Windows, run:
Scripts\activate.bat
You are now ready to start hacking on your project using an isolated Python interpreter and only the distributions installed locally in this virtual environment.
Note
You will probably want to commit bootstrap.py and bootstrap.cfg to your project’s version control system (VCS). That way you can easily generate a consistent development environment each time you clone/check out your project from it’s VCS.
When you activate your environment, your PATH environment variable is altered so that you will run your local version of Python and related commands by default. Also, your shell or command line prompt is altered to remind you that you are in your activated virtual environment.
There is one additional command that is useful from time to time. If you want to deactivate your virtual environment and return to your normal shell or command line, run this command:
deactivate
See also
mkbootstrap, bootstrap.py and bootstrap.cfg for more specific details on each of the three files mentioned above.
See also
The virtualenv documentation for more information on virtualenv environments.
Once you have bootstrapped your virtual environment, you will find several new sub-directories in your project’s root directory. They are briefly described below:
Note
Do not commit these directories to your VCS. In fact, you should probably mark them to be ignored. They will all get re-generated every time you run bootstrap.py.
Now that you have your project’s development environment set up, you are free continue developing your project as desired. Just make sure to remember these few points:
Happy hacking![1]
Footnotes
[1] | This expression is most famously used by Richard M. Stallman. |