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.1

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.1
File Size Uploaded Provenance Actions
travelpurpose-2.4.1.tar.gz 61.2 kB Without provenance Details for travelpurpose-2.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 131.7 kB

Release files / travelpurpose-2.4.1.tar.gz

Download URL travelpurpose-2.4.1.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3f6a0f7cf177768d81389a3bd7d060f667acacdb945afb9a754d85e999b6ca8d
BLAKE2b-256 checksum
How to use checksums
1d0a4b25be7f5702717665a69c1ba7bb9f312fa0dc1daf9ddf08539a30f2e826
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

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

Download URL travelpurpose-2.4.1-py3-none-any.whl
Size 70.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a2edac0b5acffb8d4202fe54e96002b8c025ae8b4e4e2ab9b9788fa06b4309
BLAKE2b-256 checksum
How to use checksums
346facc324cea9dab61d37feb58f47d1410698ce60e698866a25d92a64376133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for travelpurpose 2.4.1

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