Skip to main content

Sync iCalendar events to org-mode files while preserving your notes

Project description

ics-to-org

Tests PyPI version

Sync iCalendar events to org-mode files while preserving your notes.

What's New in v1.0.0

This is a major rewrite with significantly improved reliability and simplicity:

  • No more Node.js dependency - Pure Python implementation using the icalendar library
  • Cleaner org format - ICS descriptions stored in :DESCRIPTION: property, user notes go directly in the event body
  • Bulletproof merge logic - Calendar data always updates, user notes always preserved
  • Better timezone handling - Proper handling of UTC and all-day events
  • Comprehensive tests - Real .ics files and .org examples with full integration testing

Installation

Simple single-step installation:

pip install ics-to-org

Or with uv:

uv tool add ics-to-org

Usage

After installation, you can run the tool:

ics-sync --ics-url "https://outlook.office365.com/..." \
         --org-file "meetings.org" \
         --days-forward 30 \
         --days-backward 7

Or run it directly with uvx (no installation needed):

uvx --from ics-to-org ics-sync --ics-url "https://calendar.google.com/calendar/ical/..." \
                                  --org-file "calendar.org"

Command-line options:

Option Description Default
–ics-url URL of the iCalendar feed (required) -
–org-file Path to the org file to update (required) -
–days-forward Number of days forward to fetch 30
–days-backward Number of days backward to fetch 7
–debug Enable debug logging false

How It Works

The sync process:

  1. Fetches your calendar from the ICS URL
  2. Parses your existing org file to extract user notes
  3. Merges calendar updates with your preserved notes:
    • Calendar data (title, time, location, description) always gets updated
    • Your personal notes are always preserved
    • Removed events are marked as CANCELLED: but kept with your notes
    • New events are added cleanly
  4. Writes the updated org file with events sorted by date

Org File Format

Events are stored in a clean, standard org format:

* Team Meeting
:PROPERTIES:
:UID:           meeting123@company.com
:LOCATION:      Conference Room A
:DESCRIPTION:   Weekly team sync and project updates
:STATUS:        CONFIRMED
:CATEGORIES:    Work
:END:
<2025-01-15 Wed 14:00-15:00>

My personal notes for the meeting:
- Remember to bring the quarterly report
- Ask about the new project timeline
- Discuss vacation schedule

Action items:
- [ ] Finish the client proposal
- [X] Review the budget numbers

Key features of the format:

  • :DESCRIPTION: contains the calendar description (read-only)
  • :UID: provides the unique identifier for syncing
  • Event body contains your personal notes in any format (markdown, org-mode, plain text)
  • All-day events show as <2025-01-20 Mon>
  • Timed events show as <2025-01-15 Wed 14:00-15:00>

Examples

Basic sync with default settings

ics-sync --ics-url "https://calendar.google.com/calendar/ical/..." \
         --org-file "calendar.org"

Longer time range with debug output

ics-sync --ics-url "https://outlook.office365.com/owa/calendar/..." \
         --org-file "work-calendar.org" \
         --days-forward 60 \
         --days-backward 14 \
         --debug

Using with uvx (no installation required)

# Run directly from PyPI without installing
uvx --from ics-to-org ics-sync --ics-url "https://example.com/calendar.ics" \
                                  --org-file "my-calendar.org" \
                                  --days-forward 60 \
                                  --debug

Using with uv run (in a project)

uv run ics-sync --ics-url "https://example.com/calendar.ics" \
                --org-file "my-calendar.org"

Using with local .ics files

If you can't access the calendar URL directly (common with Outlook), download the .ics file and use it locally:

# Using a local file path
ics-sync --ics-url "/path/to/downloaded/calendar.ics" \
         --org-file "calendar.org"

# Or with file:// URL
ics-sync --ics-url "file:///path/to/calendar.ics" \
         --org-file "calendar.org"

Troubleshooting

Outlook/Office365 Calendar Issues

If you're having trouble accessing your Outlook calendar:

  1. Download the .ics file manually: Go to Outlook Web → Calendar → Share → Publish Calendar → Copy the ICS URL → Download it with your browser
  2. Use the downloaded file: ics-sync --ics-url "/path/to/calendar.ics" --org-file "events.org"
  3. Check calendar permissions: Make sure your calendar is set to "Public" with "Can view all details" in Outlook settings
  4. Try the debug flag: Run with --debug to see detailed error messages

Common Error Messages

  • *"Received HTML response instead of ICS data"*: The calendar URL requires authentication or is private
  • *"Authentication required"*: Calendar is not publicly accessible
  • *"Object moved to here"*: Calendar URL has redirects/authentication issues

For these issues, downloading the .ics file manually is the most reliable solution.

Testing

The project includes comprehensive tests with realistic examples:

pytest tests/ -v

Test coverage includes:

  • Unit tests for all core functions
  • Integration tests with real .ics files and .org files
  • Edge cases like timezone handling, malformed events, empty calendars
  • User note preservation across various markdown and org-mode formats
  • Complete workflows from ICS fetch through merge to org file output

Migration from v0.x

If you're upgrading from the old version:

  1. Remove the icsorg dependency: npm uninstall -g icsorg
  2. Update your scripts: Remove --author and --email parameters (no longer needed)
  3. Review your org files: The new format stores descriptions in properties instead of agenda blocks

The new format is cleaner and more reliable, but you may want to manually clean up old agenda blocks if desired.

Development

# Clone the repository
git clone https://github.com/andyreagan/ics-to-org
cd ics-to-org

# Install with uv (recommended)
uv sync

# Run tests
uv run pytest

# Build package
uv build

Contributing

Contributions are welcome! Please:

  1. Add tests for any new functionality
  2. Ensure all tests pass: uv run pytest
  3. Follow the existing code style
  4. Update documentation as needed

License

MIT License. See LICENSE file for details.

Project details


Download files

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

Source Distribution

ics_to_org-1.0.5.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ics_to_org-1.0.5-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file ics_to_org-1.0.5.tar.gz.

File metadata

  • Download URL: ics_to_org-1.0.5.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ics_to_org-1.0.5.tar.gz
Algorithm Hash digest
SHA256 45401a678b1f6645324605f8ff0dfce3971be73a7bdbade7e03a7bd87feecd20
MD5 e8d85f0bb11736b7d1f71c0e48f29963
BLAKE2b-256 337acee770fd7a0e02173b189330396a6889b704cc9af5e93d0aabc022b375f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ics_to_org-1.0.5.tar.gz:

Publisher: ci.yml on andyreagan/ics-to-org

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ics_to_org-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: ics_to_org-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ics_to_org-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 277cd22a2203f46b3a57a504ca4ae496a4ba1e7444f30e6c0da0be21b0f380f7
MD5 df2827d727d21abf72a8526ddd4fd47f
BLAKE2b-256 c2262678a92d11a13840b2f6e1eacd0fcdbefbb38f665d3489aeec0546c806d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ics_to_org-1.0.5-py3-none-any.whl:

Publisher: ci.yml on andyreagan/ics-to-org

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page