Skip to content

vCard 4.0 implementation#124

Open
jwiegley wants to merge 1 commit intopy-vobject:masterfrom
jwiegley:master
Open

vCard 4.0 implementation#124
jwiegley wants to merge 1 commit intopy-vobject:masterfrom
jwiegley:master

Conversation

@jwiegley
Copy link
Copy Markdown

@jwiegley jwiegley commented Jan 1, 2026

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

@jwiegley
Copy link
Copy Markdown
Author

jwiegley commented Jan 1, 2026

Note that Radicale has merged in support for these changes in Kozea/Radicale#1948, with the hope that they will arrive in a 1.0.0 release.

@da4089
Copy link
Copy Markdown

da4089 commented Jan 2, 2026

Thanks @jwiegley

@da4089
Copy link
Copy Markdown

da4089 commented Jan 5, 2026

@jwiegley, I don't think we need the first three commits here (the CNAME ones)?

Also, would you be able to convert the test cases to use pytest, like the other tests in the master branch?

@jwiegley
Copy link
Copy Markdown
Author

jwiegley commented Jan 5, 2026

I saw those changes from the other repository, but didn't realize they had carried through to my PR. I'll remove them.

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 Jan 5, 2026

@da4089 I've changed over the tests, please confirm it's in the format you expect now.

@Terrance
Copy link
Copy Markdown

Terrance commented Apr 5, 2026

Hi, just wondering where this got to? I've encountered my own personal need for some of the vCard 4.0 fields, both in Radicale (whose 4.0 support still requires this branch at present) and another project which offers CardDAV sync -- I don't want to commit to converting my address book to 4.0 and later find I need to revert that or change server!

@jwiegley
Copy link
Copy Markdown
Author

jwiegley commented Apr 5, 2026

I've been running my own Radicale server based on these changes, which has been fine, although I discovered that my address book doesn't go beyond v3.0, so I haven't been specifically using the v4.0 features.

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