Skip to content

vCard 4.0 implementation#196

Closed
jwiegley wants to merge 1 commit into
skarim:masterfrom
jwiegley:master
Closed

vCard 4.0 implementation#196
jwiegley wants to merge 1 commit into
skarim:masterfrom
jwiegley:master

Conversation

@jwiegley
Copy link
Copy Markdown

New Files:

  • vobject/vcard40.py - Complete vCard 4.0 (RFC 6350) implementation
  • test_files/vcard40_simple.vcf - Basic vCard 4.0 test file
  • test_files/vcard40_full.vcf - Full vCard 4.0 with all properties
  • test_files/vcard40_group.vcf - vCard 4.0 with KIND=group and MEMBER
  • test_files/vcard40_org.vcf - vCard 4.0 for organization
  • test_files/vcard40_location.vcf - vCard 4.0 for location
  • test_files/vcard40_multilang.vcf - Multilingual vCard 4.0 with ALTID

Modified Files:

  • vobject/init.py - Added version parameter to vCard(version='3.0')
  • tests.py - Updated behavior registry test for new behaviors
  • test_files/more_tests.txt - Added dual-version doctest tests

New vCard 4.0 Properties Implemented

  • KIND - individual/group/org/location
  • GENDER - sex and gender identity
  • ANNIVERSARY - marriage date
  • LANG - language preferences with PREF
  • IMPP - instant messaging URIs
  • RELATED - relationships with TYPE
  • MEMBER - group members (only for KIND=group)
  • CLIENTPIDMAP - sync mapping
  • XML - extended XML data
  • SOURCE - vCard source URI

Usage:

import vobject

v3 = vobject.vCard()

v4 = vobject.vCard('4.0')
v4.add('fn').value = 'John Doe'
v4.add('kind').value = 'individual'
v4.add('gender').value = 'M'

parsed = vobject.readOne(vcard_string)  # Works for both 3.0 and 4.0

New Files:
- vobject/vcard40.py - Complete vCard 4.0 (RFC 6350) implementation
- test_files/vcard40_simple.vcf - Basic vCard 4.0 test file
- test_files/vcard40_full.vcf - Full vCard 4.0 with all properties
- test_files/vcard40_group.vcf - vCard 4.0 with KIND=group and MEMBER
- test_files/vcard40_org.vcf - vCard 4.0 for organization
- test_files/vcard40_location.vcf - vCard 4.0 for location
- test_files/vcard40_multilang.vcf - Multilingual vCard 4.0 with ALTID

Modified Files:
- vobject/__init__.py - Added version parameter to vCard(version='3.0')
- tests.py - Updated behavior registry test for new behaviors
- test_files/more_tests.txt - Added dual-version doctest tests

New vCard 4.0 Properties Implemented

- KIND - individual/group/org/location
- GENDER - sex and gender identity
- ANNIVERSARY - marriage date
- LANG - language preferences with PREF
- IMPP - instant messaging URIs
- RELATED - relationships with TYPE
- MEMBER - group members (only for KIND=group)
- CLIENTPIDMAP - sync mapping
- XML - extended XML data
- SOURCE - vCard source URI

Usage:

```python
import vobject

v3 = vobject.vCard()

v4 = vobject.vCard('4.0')
v4.add('fn').value = 'John Doe'
v4.add('kind').value = 'individual'
v4.add('gender').value = 'M'

parsed = vobject.readOne(vcard_string)  # Works for both 3.0 and 4.0
```
@jwiegley
Copy link
Copy Markdown
Author

jwiegley commented Dec 29, 2025

With this support, I intend to upgrade Radicale to use vCard 4.0, so that will give me a good ground for real-life testing. See: Kozea/Radicale#1948. I'm now running this version on my home lab server.

@da4089
Copy link
Copy Markdown
Collaborator

da4089 commented Dec 29, 2025

Sounds great -- I'll have a look at merging this into py-vobject/vobject

@pbiering
Copy link
Copy Markdown
Contributor

pbiering commented Jan 1, 2026

Just note that the implementation in Radicale relies on vobject version to offer vCard 4.0 support and assumes this for version >= 1.0.0

@da4089
Copy link
Copy Markdown
Collaborator

da4089 commented Jan 1, 2026

@jwiegley -- could you create a new pull request against py-vobject/vobject?

@jwiegley jwiegley closed this by deleting the head repository Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants