pytxc
Quick start
Installation
Use pip to install pytxc.
python -m pip install pytxc
Usage
The Timetable class is used to parse and interact with
TransXChange files.
from pathlib import Path
from pytxc import Timetable
>> filepath = "path/to/transxchange/file.xml"
>> timetable = Timetable.from_file_path(Path(filepath))
>> timetable.header
Header(
creation_date_time=datetime.datetime(2020, 11, 22, 11, 0),
modification_date_time=datetime.datetime(2021, 12, 17, 11, 8, 35),
file_name="file.xml",
modification="revise",
schema_version="2.4",
revision_number=159,
)
The StopPoints in a TransXChange can be accessed through the stop_points
attribute.
>> timetable.stop_points[0]
AnnotatedStopPointRef(
stop_point_ref=StopPointRef(text="077072002S"),
common_name="High Street Stand S",
)
Similarly, RouteSections can be accessed using the route_sections attribute.
>> timetable.route_sections[0]
RouteSection(id='RS1')
The naming conventions used for the Python objects will more or less match those
of TransXChange for example, the first JourneyPattern of a StandardService is
usually found in a Service of the Services block.
Using pytxc it can be accessed as follows,
>> timetable.services[0].standard_services[0].journey_patterns[0]
JourneyPattern(
id="JP1",
CreationDateTime="2020-11-22T11:00:00",
ModificationDateTime="2021-12-17T11:08:35",
Modification="revise",
RevisionNumber="159",
)
When interacting with references, pytxc provides a resolve method to find
the original element in the TransXChange file. For example if a JourneyPattern
contains a RouteRef then calling resolve on the route_ref object will
return the original Route object.
>> jp = timetable.services[0].standard_services[0].journey_patterns[0]
>> jp.route_ref.resolve()
Route(private_code='35st-40', description='Stockton - Wolviston Court')
Metadata
Release files for pytxc 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytxc-0.1.6.tar.gz | 9.1 kB | Without provenance | Details for pytxc-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytxc-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for pytxc-0.1.6-py3-none-any.whl |
Total release size: 19.9 kB
Release files / pytxc-0.1.6.tar.gz
| Download URL | pytxc-0.1.6.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
372f33db0eec45e9676145976bc2c95757855b8ed4193c503a0cde9071eb1ffe
|
|
BLAKE2b-256 checksum How to use checksums |
8f31f59982bff7e2a29641a7f79c0465005b533e7b302d050414e297156f8d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1022-azure
|
Release files / pytxc-0.1.6-py3-none-any.whl
| Download URL | pytxc-0.1.6-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40578b9a5be69bbd83559b6ba70362713c6db0691d5fb07a3046ba99118b2772
|
|
BLAKE2b-256 checksum How to use checksums |
aab666b9b5b2f423790f005a7afd8fc3a32817e9212af5d4ddb53648dc8a7829
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1022-azure
|
Security for pytxc 0.1.6
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.