Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Search SNCF journeys from the CLI.

Project description

:train2: sncf-cli

Python Version PyPI Code Climate maintainability Build Status Coverage Status

You love SNCF. You love command line tools. sncf-cli is made for you !
An handcrafted API client and command line interface for France's national railways :sparkles:



sncf-cli requires Python 3.6+ and can be installed using pip:

pip install sncf-cli


sncf-cli is easy to use. Find below simple examples:

# RTFM bro (just kidding)
sncf-cli search --help
# Search by city name
sncf-cli search Amsterdam Paris
# Search by train station code (Amsterdam to Paris here)
sncf-cli search NLAMA FRPAR
# Pick a date and even a travel class B-)
sncf-cli search Brest Paris --date 2019/07/14 --class first 


pip install -e .[dev]
# Code formatter
black locomotive/ stubs/ tests/
# Linter
pylint --rcfile=setup.cfg locomotive/
# Type checker
env MYPYPATH=stubs/ mypy locomotive/
# Unit tests
assets/      # Images used in the README
locomotive/  # Python module (see locomotive/
tests/       # Unit tests


git tag vX.Y.Z # e.g. v0.4.0
git push --tags


  • [ ] Screenshot in README is up to date.

Design notes & future plans

Currently the Formatters are tightly coupled with the API response format. In the future we may implement an abstraction over different APIs versions.

We use attrs instead of @dataclass for Python 3.6 compatibility.


sncf-cli is released under the MIT license.
The train stations database (stations-lite.csv) is derived from stations.csv (trainline-eu/stations) released under the Open Database License (ODbL) license.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sncf-cli, version 0.6
Filename, size File type Python version Upload date Hashes
Filename, size sncf_cli-0.6-py3-none-any.whl (655.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size sncf-cli-0.6.tar.gz (823.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page