A software manager for easy development and distribution of Python code.
The main features that Travel adds to Python are:
- Support for large-scale, multi-package projects (with common packages)
- Reproducibility (clear, transparent dependency management)
- Robust development-lifecycle, from prototyping to distribution
- Possibility to have different scoped Virtual Environment (e.g. for development, for testing, for notebooks...) with additional requirements
- Link multiple and different versions of Python to different projects
Travel is inspired by what Maven is for Java and uses Pip and Virtual Environments.
Python is great at many things, particularly for scripting. But it is powerful enough to create complex software too. Still, when doing so, it lacks some robustness and quickness.
Instead:
-
Travel lets you forget about repetitive setup of Python projects, with creation of Virtual Environments, issues with imports, PYTHONPATH, folder structures. It does all of this for you.
-
Travel ensures that when you run a Python script, all its requirements are installed. Along with reproducibility, this makes room for easy collaboration between developers.
-
Also, while with standard tools it's hard to have multiple packages, one requiring another, with Travel this is a matter of few YAML files. You can split your project in several packages instead of having tons of requirements, code replication and/or single package-monoliths.
-
Travel manages multiple versions of Python, so that you can work on several projects with different versions. You can install them and then link them to the specific projects you want.
All in all, Travel lets you design proper structure and modularity for your code. No worries about imports and low-level stuff.
You can find an example of Travel project here.
With Python >= 3.7 < 3.10, simply run
pip install travel
From now on, you can use travel
from command line.
Travel supports several packages ("Bags") in a single project, nested in other folders ("Bags containing Bags"). You can create a project using Travel Plans.
You can also create a new Bag after the first plan using travel add
, to add a new Travel Plan.
For a quick understanding, see below.
To see how to create your first Travel project, see the section above.
Once you have defined your structure of Bags (submodules of your project), for instance like in the example or like this
complexproject/
common/
package/
bag.yml
microservices/
first/
package/
bag.yml
second/
package/
bag.yml
bag.yml
bag.yml
you can run
travel setup
in the main folder, where the first bag.yml
file is located.
This will:
- Understand the dependencies
- Create the Virtual Environments
- Install the requirements
- Install the packages themselves in development mode (so that you can
import
them in their Virtual Environments)
You can also create a distribution package with travel pack [commands]
, which is the equivalent of python setup.py [commands]
, for instance:
travel pack sdist
in the folder of the Bag you want to pack. This will create the distribution in the ./build/package/dist
folder.
In any moment, you can run
travel clean
to destroy the Virtual Environments and other build objects.
By default, Travel will create virtual envs with the same Python you have installed travel with.
However, you can specify a different version either with:
TRAVEL_PYTHON_PATH
environment variable, pointing to the Python exe- Travel Configuration
Once you have installed your different Python versions with your preferred method and into your preferred location, Travel just needs to know where you have installed them.
travel config add python <version> <path>
e.g.
travel config add python 3.7.4 C:\Users\name\python37\python.exe
This will save the path in a .travel/config.yml
inside your home directory, e.g. C:\Users\name\.travel\config.yml
.
You can specify a different config location with a TRAVEL_CONFIG_PATH
environment variable.
This will let Travel know which Python to use when you specify
python: <version>
in your project root bag.yml
.