Skip to main content

TravelPurpose

City travel purpose classification — instantly know whether a destination is primarily a BUSINESS, LEISURE, MEDICAL, RELIGIOUS, CRUISE or SECONDHOME city. Covers 417 destinations across Europe, Asia, Americas, Africa and the Middle East. Zero dependencies.

PyPI version Python 3.9+ License: MIT GitHub Sponsors

Installation

pip install travelpurpose

Quick Start

from travelpurpose import TravelPurpose

tp = TravelPurpose()

# Classify a single city
result = tp.classify("Antalya")
print(result.primary_tag)   # LEISURE
print(result.tags)          # ['LEISURE']
print(result.country)       # Turkey
print(result.region)        # Europe
print(result.is_leisure())  # True

# A business-dominant city
biz = tp.classify("Frankfurt")
print(biz.primary_tag)      # BUSINESS
print(biz.is_business())    # True

# A religious destination
mecca = tp.classify("Medina")
print(mecca.primary_tag)    # RELIGIOUS
print(mecca.is_religious()) # True

# Search by tag
leisure_cities = tp.search("LEISURE")
print(len(leisure_cities))  # 123

# Search by region
africa = tp.search_by_region("Africa")
print(len(africa))          # 61

# Dataset statistics
stats = tp.stats()
# {'total_cities': 417, 'tags': {'BUSINESS': 249, 'LEISURE': 123, ...}, ...}
print(len(tp))              # 417

Travel Purpose Tags

Tag Description Count
BUSINESS Commercial hub, corporate travel 249
LEISURE Tourism, vacation, recreation 123
SECONDHOME Expat communities, retirement, long stays 31
RELIGIOUS Pilgrim destinations, holy sites 7
MEDICAL Medical tourism, healthcare travel 3
CRUISE Cruise port destinations 2
SEAMAN Maritime crew destinations 2

Each city carries exactly one primary tag reflecting its dominant travel purpose in the dataset.

Regional Coverage

  • Europe: 163 cities
  • Asia: 92 cities
  • Americas: 65 cities
  • Africa: 61 cities
  • Middle East: 36 cities

Data Source

The classification reflects airline-industry destination taxonomy — how the aviation sector categorizes cities by the dominant reason passengers fly there. This means some classifications differ from general tourist expectations:

  • A city tagged MEDICAL has significant medical-tourism traffic in airline data (e.g. Istanbul, Ankara)
  • A city tagged SECONDHOME has high long-stay/expat passenger volume (e.g. Paris, Frankfurt, Hamburg)
  • BUSINESS covers commercial hubs where corporate travel dominates

This makes the dataset well-suited for travel tech, booking analytics, and insurance segmentation where the aviation-industry perspective is relevant.

Use Cases

  • Travel apps — filter destinations by trip purpose
  • Insurance — categorize policies by destination type
  • Booking analytics — segment data by city purpose in airline/OTA context
  • Marketing — target campaigns by travel motivation
  • GIS tools — enrich geospatial datasets with travel context

API Reference

TravelPurpose()

tp = TravelPurpose()

tp.classify(city: str) → CityResult
tp.search(tag: str) → List[CityResult]
tp.search_by_region(region: str) → List[CityResult]
tp.stats() → dict
tp.all_tags() → List[str]
len(tp)  # number of cities in dataset

CityResult

result.city          # str
result.country       # str
result.region        # str
result.tags          # List[str]  — one tag per city
result.primary_tag   # str (dominant purpose)
result.is_known      # bool (False for unrecognized cities)
result.is_business() → bool
result.is_leisure()  → bool
result.is_medical()  → bool
result.is_religious()→ bool
result.to_dict()     → dict

Support the Project

If TravelPurpose powers your app, consider sponsoring on GitHub.

License

MIT

Metadata

Release files for travelpurpose 2.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for travelpurpose 2.4.0
File Size Uploaded Provenance Actions
travelpurpose-2.4.0.tar.gz 60.8 kB Without provenance Details for travelpurpose-2.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for travelpurpose 2.4.0
File Interpreter ABI Platform Actions
travelpurpose-2.4.0-py3-none-any.whl Python 3 none any Details for travelpurpose-2.4.0-py3-none-any.whl

Total release size: 130.8 kB

Release files / travelpurpose-2.4.0.tar.gz

Download URL travelpurpose-2.4.0.tar.gz
Size 60.8 kB
Tags Source
SHA-256 checksum
How to use checksums
151a859e652678801ca9cec3c501bd140fccb51407ac544c0cfc481717db19eb
BLAKE2b-256 checksum
How to use checksums
b603eafc6b31b2bd525191799ccac5d5af5ab41a953a929035a4d2146822afd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / travelpurpose-2.4.0-py3-none-any.whl

Download URL travelpurpose-2.4.0-py3-none-any.whl
Size 70.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e047d9e9c3220bf0742643dd182d9d81368f76db640523df5e581624b9e3ca1
BLAKE2b-256 checksum
How to use checksums
e66979b6ec30abb3e2c0db7fc1a8ad3319c0d62bf65967ab7d20cd82f581032f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for travelpurpose 2.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page