Fantastical Module Reference

New in version 0.0.9.

Control Fantastical using JXA-like syntax.

Classes:

XAFantasticalApplication(properties)

A class for managing and interacting with Fantastical.app.

XAFantasticalCalendar(properties)

A class in Fantastical.app.

XAFantasticalCalendarEvent(properties)

XAFantasticalCalendarItem(properties)

An insertion point between two objects in Fantastical.app.

XAFantasticalCalendarItemList(properties[, ...])

A wrapper around lists of Fantastical calendar items that employs fast enumeration techniques.

XAFantasticalCalendarList(properties[, filter])

A wrapper around lists of Fantastical calendars that employs fast enumeration techniques.

XAFantasticalDocument(properties)

A document in Fantastical.app.

XAFantasticalDocumentList(properties[, filter])

A wrapper around lists of Fantastical documents that employs fast enumeration techniques.

XAFantasticalSelectedCalendarItem(properties)

XAFantasticalSelectedCalendarItemList(properties)

A wrapper around lists of Fantastical selected calendar items that employs fast enumeration techniques.

XAFantasticalTaskItem(properties)

XAFantasticalWindow(properties)

A window of Fantastical.app.

class PyXA.apps.Fantastical.XAFantasticalApplication(properties)[source]

Bases: XASBApplication

A class for managing and interacting with Fantastical.app.

New in version 0.0.9.

Methods:

calendars([filter])

Returns a list of calendars, as PyXA objects, matching the given filter.

documents([filter])

Returns a list of documents, as PyXA objects, matching the given filter.

parse_sentence(sentence[, notes, calendar, ...])

Parses the given sentences and creates a corresponding calendar item based on the parsing result.

selected_calendar_items([filter])

Returns a list of selected calendar items, as PyXA objects, matching the given filter.

show_calendar_view([date])

Shows the (large) calendar view, optionally showing a specific date.

show_mini_view([date])

Shows the mini calendar view, optionally showing a specific date.

Attributes:

frontmost

Whether Fantastical is the active application.

name

The name of the application.

version

The version of Fantastical.app.

calendars(filter: dict | None = None) XAFantasticalCalendarList[source]

Returns a list of calendars, as PyXA objects, matching the given filter.

New in version 0.0.9.

documents(filter: dict | None = None) XAFantasticalDocumentList[source]

Returns a list of documents, as PyXA objects, matching the given filter.

New in version 0.0.9.

property frontmost: bool

Whether Fantastical is the active application.

property name: str

The name of the application.

parse_sentence(sentence: str, notes: str = '', calendar: str | XAFantasticalCalendar | None = None, add_immediately: bool = True, add_attendees: bool = False)[source]

Parses the given sentences and creates a corresponding calendar item based on the parsing result.

Parameters:
  • sentence (str) – The sentence to parse

  • notes (str, optional) – Notes to attach to the calendar item, defaults to “”

  • calendar (Union[str, XAFantasticalCalendar, None], optional) – The calendar to add the item to, defaults to None

  • add_immediately (bool, optional) – Whether to add the item without displaying an event editing dialog, defaults to True

  • add_attendees (bool, optional) – Whether to invite attendees parsed from the sentence, defaults to False

Example 1:

Add simple events to calendars

>>> # Create an event on the default calendar
>>> import PyXA
>>> app = PyXA.Application("Fantastical")
>>> app.parse_sentence("Event 1")
>>>
>>> # Create an event on a calendar specified by a calendar object
>>> cal = app.calendars().by_title("PyXA Development")
>>> app.parse_sentence("Event 2", calendar = cal)
>>>
>>> # Create an event on a calendar specified by a string
>>> app.parse_sentence("Event 3", calendar = "Testing")
Example 2:

Use Fantastical’s query parsing to adjust calendar item settings

>>> # Automatically set the time of a task to 8am, show event editing dialog
>>> app.parse_sentence("Wake up at 8am", add_immediately = False)
>>>
>>> # Create a todo
>>> app.parse_sentence("todo today Learn PyXA")
>>>
>>> # Create an event at a location, with an alert, repeating weekly
>>> app.parse_sentence("Meet with Example Person at 10am at 1 Infinite Loop, Cupertino, CA with alert 30 minutes before repeat weekly")
>>>
>>> # Create an event spanning a week
>>> app.parse_sentence("PyXA stuff August 22 to August 29")

New in version 0.0.9.

selected_calendar_items(filter: dict | None = None) XAFantasticalSelectedCalendarItemList[source]

Returns a list of selected calendar items, as PyXA objects, matching the given filter.

New in version 0.0.9.

show_calendar_view(date: str | datetime | None = None)[source]

Shows the (large) calendar view, optionally showing a specific date.

Parameters:

date (Union[str, datetime, None], optional) – The date to display, defaults to None

New in version 0.0.9.

show_mini_view(date: str | datetime | None = None)[source]

Shows the mini calendar view, optionally showing a specific date.

Parameters:

date (Union[str, datetime, None], optional) – The date to display, defaults to None

New in version 0.0.9.

property version: str

The version of Fantastical.app.

class PyXA.apps.Fantastical.XAFantasticalCalendar(properties)[source]

Bases: XAObject

A class in Fantastical.app.

New in version 0.0.9.

Attributes:

id

The unique identifier for the calendar.

title

The calendar's title.

property id: str

The unique identifier for the calendar.

property title: str

The calendar’s title.

class PyXA.apps.Fantastical.XAFantasticalCalendarEvent(properties)[source]

Bases: XAFantasticalCalendarItem

Attributes:

location

The event location.

property location: str

The event location.

class PyXA.apps.Fantastical.XAFantasticalCalendarItem(properties)[source]

Bases: XAObject

An insertion point between two objects in Fantastical.app.

New in version 0.0.9.

Attributes:

end_date

The end date of the event.

id

The unique identifier for the item.

is_all_day

True if the item spans an entire day.

is_recurring

True if the item is a recurring item.

notes

The notes for the event.

show_url

The show URL for the event.

start_date

The start date of the event.

title

The event title.

url

The related URL for the event.

Methods:

save()

property end_date: datetime

The end date of the event.

property id: str

The unique identifier for the item.

property is_all_day: bool

True if the item spans an entire day.

property is_recurring: bool

True if the item is a recurring item.

property notes: str

The notes for the event.

save()[source]
property show_url: XAURL

The show URL for the event.

property start_date: datetime

The start date of the event.

property title: str

The event title.

property url: XAURL

The related URL for the event.

class PyXA.apps.Fantastical.XAFantasticalCalendarItemList(properties: dict, filter: dict | None = None, obj_class=None)[source]

Bases: XAList

A wrapper around lists of Fantastical calendar items that employs fast enumeration techniques.

All properties of calendar items can be called as methods on the wrapped list, returning a list containing each calendar item’s value for the property.

New in version 0.0.9.

Methods:

by_end_date(end_date)

by_id(id)

by_is_all_day(is_all_day)

by_is_recurring(is_recurring)

by_notes(notes)

by_show_url(show_url)

by_start_date(start_date)

by_title(title)

by_url(url)

end_date()

id()

is_all_day()

is_recurring()

notes()

show_url()

start_date()

title()

url()

by_end_date(end_date: datetime) XAFantasticalCalendarItem[source]
by_id(id: str) XAFantasticalCalendarItem[source]
by_is_all_day(is_all_day: bool) XAFantasticalCalendarItem[source]
by_is_recurring(is_recurring: bool) XAFantasticalCalendarItem[source]
by_notes(notes: str) XAFantasticalCalendarItem[source]
by_show_url(show_url: XAURL) XAFantasticalCalendarItem[source]
by_start_date(start_date: datetime) XAFantasticalCalendarItem[source]
by_title(title: str) XAFantasticalCalendarItem[source]
by_url(url: XAURL) XAFantasticalCalendarItem[source]
end_date() list[datetime][source]
id() list[str][source]
is_all_day() list[bool][source]
is_recurring() list[bool][source]
notes() list[str][source]
show_url() list[XAURL][source]
start_date() list[datetime][source]
title() list[str][source]
url() list[XAURL][source]
class PyXA.apps.Fantastical.XAFantasticalCalendarList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of Fantastical calendars that employs fast enumeration techniques.

All properties of calendars can be called as methods on the wrapped list, returning a list containing each calendar’s value for the property.

New in version 0.0.9.

Methods:

by_id(id)

by_title(title)

id()

title()

by_id(id: str) XAFantasticalCalendar[source]
by_title(title: str) XAFantasticalCalendar[source]
id() list[str][source]
title() list[str][source]
class PyXA.apps.Fantastical.XAFantasticalDocument(properties)[source]

Bases: XAObject, XACloseable, XADeletable, XAPrintable, XAClipboardCodable

A document in Fantastical.app.

New in version 0.0.9.

Attributes:

file

The document's path.

modified

Whether the document has been modified since it was last saved.

name

Methods:

get_clipboard_representation()

Gets a clipboard-codable representation of the document.

print([print_properties, show_dialog])

Prints the object.

property file: XAPath

The document’s path.

get_clipboard_representation() list[NSURL | str][source]

Gets a clipboard-codable representation of the document.

When the clipboard content is set to a Fantastical document, the document’s URL and source code are added to the clipboard.

Returns:

The document’s path and text content

Return type:

list[Union[AppKit.NSURL, str]]

New in version 0.0.9.

property modified: bool

Whether the document has been modified since it was last saved.

property name: str
print(print_properties: dict | None = None, show_dialog: bool = True) XAPrintable[source]

Prints the object.

Child classes of XAPrintable should override this method as necessary.

Parameters:
  • show_dialog (bool, optional) – Whether to show the print dialog, defaults to True

  • print_properties (Union[dict, None], optional) – Properties to set for printing, defaults to None

Returns:

A reference to the PyXA object that called this method.

Return type:

XACanPrintPath

New in version 0.0.9.

class PyXA.apps.Fantastical.XAFantasticalDocumentList(properties: dict, filter: dict | None = None)[source]

Bases: XAList

A wrapper around lists of Fantastical documents that employs fast enumeration techniques.

All properties of documents can be called as methods on the wrapped list, returning a list containing each document’s value for the property.

New in version 0.0.9.

Methods:

by_file(file)

by_modified(modified)

by_name(name)

file()

modified()

name()

by_file(file: XAPath) XAFantasticalDocument[source]
by_modified(modified: bool) XAFantasticalDocument[source]
by_name(name: str) XAFantasticalDocument[source]
file() list[XAPath][source]
modified() list[bool][source]
name() list[str][source]
class PyXA.apps.Fantastical.XAFantasticalSelectedCalendarItem(properties)[source]

Bases: XAFantasticalCalendarItem

class PyXA.apps.Fantastical.XAFantasticalSelectedCalendarItemList(properties: dict, filter: dict | None = None)[source]

Bases: XAFantasticalCalendarItemList

A wrapper around lists of Fantastical selected calendar items that employs fast enumeration techniques.

All properties of selected calendar items can be called as methods on the wrapped list, returning a list containing each items’s value for the property.

New in version 0.0.9.

class PyXA.apps.Fantastical.XAFantasticalTaskItem(properties)[source]

Bases: XAFantasticalCalendarItem

Attributes:

priority

The event priority; higher number means lower priority.

property priority: int

The event priority; higher number means lower priority.

class PyXA.apps.Fantastical.XAFantasticalWindow(properties)[source]

Bases: XASBWindow, XAPrintable, XACloseable

A window of Fantastical.app.

Attributes:

document

The document currently displayed in the window.

property document: XAFantasticalDocument

The document currently displayed in the window.