Skip to main content

Python MergeCal

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://mergecal.readthedocs.io

Source Code: https://github.com/mergecal/python-mergecal


A Python library to merge iCalendar feeds.

Installation

Install this via pip (or your favorite package manager):

pip install mergecal

Usage

Python API

You can use MergeCal in your Python code as follows:

>>> from mergecal import merge_calendars
>>> from icalendar import Calendar

# Load your calendars
# CALENDARS = pathlib.Path("to/your/calendar/directory")
>>> calendar1 = Calendar.from_ical((CALENDARS / "one_event.ics").read_bytes())
>>> calendar2 = Calendar.from_ical((CALENDARS / "another_event.ics").read_bytes())

# Merge the calendars
>>> merged_calendar : Calendar = merge_calendars([calendar1, calendar2])

# Write the merged calendar to a file
>>> (CALENDARS / "merged_calendar.ics").write_bytes(merged_calendar.to_ical())
933

# The merged calendar will contain all the events of both calendars
>>> [str(event["SUMMARY"]) for event in calendar1.walk("VEVENT")]
['Event 1']
>>> [str(event["SUMMARY"]) for event in calendar2.walk("VEVENT")]
['Event 2']
>>> [str(event["SUMMARY"]) for event in merged_calendar.walk("VEVENT")]
['Event 1', 'Event 2']

Command Line Interface (CLI)

MergeCal also provides a command-line interface for easy merging of calendar files:

# Basic usage
mergecal calendar1.ics calendar2.ics -o merged_calendar.ics

# Specifying custom PRODID
mergecal calendar1.ics calendar2.ics -o merged_calendar.ics --prodid "-//My Organization//MergeCal 1.0//EN"

For more options and information, use the help command:

mergecal --help

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

Metadata

Release files for mergecal 0.5.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 mergecal 0.5.0
File Size Uploaded
mergecal-0.5.0.tar.gz 22.0 kB Details

Built distribution (wheel)

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

Total release size: 39.9 kB

Release files / mergecal-0.5.0.tar.gz

Download URL mergecal-0.5.0.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1c56ef350f3e83b1fd9ecde7347d2e252cabd7285f8963de8633b8c8abcbf0e9
BLAKE2b-256 checksum
How to use checksums
a83d654746ad5346daa5e5fce62f7cf8284ec1c3426e3e0b023940ba7ff2e6c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2025.

Transparency log

Release files / mergecal-0.5.0-py3-none-any.whl

Download URL mergecal-0.5.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d026144bb9331bedc706a047dea4566145f9c3355b4315e39ad92b5dc3381a87
BLAKE2b-256 checksum
How to use checksums
91785c80c46350c38faec60ad53be625d6e221bb9b03fdd14f92f89317be7780
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.14

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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