https://github.com/travel-tools/travel
A software manager for easy development and distribution of Python code
https://github.com/travel-tools/travel
development package package-manager pip python venv virtualenv
Last synced: 3 months ago
JSON representation
A software manager for easy development and distribution of Python code
- Host: GitHub
- URL: https://github.com/travel-tools/travel
- Owner: travel-tools
- License: apache-2.0
- Created: 2021-07-31T20:47:02.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-13T20:48:46.000Z (almost 3 years ago)
- Last Synced: 2026-03-15T02:49:53.164Z (3 months ago)
- Topics: development, package, package-manager, pip, python, venv, virtualenv
- Language: Python
- Homepage:
- Size: 321 KB
- Stars: 14
- Watchers: 2
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Travel
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](https://maven.apache.org/)** is for Java and uses [Pip](https://github.com/pypa/pip) and [Virtual Environments](https://docs.python.org/3/library/venv.html).
## Why Travel
**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.
## Example of Travel Project
You can find an example of Travel project [here](https://github.com/travel-tools/travel/tree/master/src/travel/tests/data/complexproject).
## Installation
With Python >= 3.7 < 3.10, simply run
```
pip install travel
```
From now on, you can use `travel` from command line.
## Create a new project or add a new Bag
Travel supports several packages ("Bags") in a single project, nested in other folders ("Bags containing Bags"). You can create a project using [Travel Plans](https://github.com/travel-tools/cookiecutter-travelplan).
You can also create a new Bag after the first plan using `travel add`, to add a new [Travel Plan](https://github.com/travel-tools/cookiecutter-travelplan).
For a quick understanding, see below.
## Basic Usage
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](https://github.com/travel-tools/travel/tree/master/src/travel/tests/data/complexproject) 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.
## Configure Multiple Versions of Python
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
### Multiple Python versions with 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
```
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:
```
in your project root `bag.yml`.