Skip to content

Commit d9db1e8

Browse files
committed
Update documentation and remove deprecated files for vCon version 0.7.0
- Updated index.html to redirect to the latest documentation and added a user-friendly message. - Removed obsolete vcon.html, dialog.html, and party.html files as part of the transition to the new documentation structure. - Introduced version_management.rst to document changes in version handling, including the optional nature of the version field and removal of strict version enforcement. - Updated conf.py to reflect the new version number (0.7.0) and adjusted index.rst to include the new version management section. - Modified tests to accommodate changes in the vCon class, ensuring compatibility with the new optional versioning system.
1 parent 44fe213 commit d9db1e8

File tree

9 files changed

+192
-4496
lines changed

9 files changed

+192
-4496
lines changed

docs/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<meta http-equiv="refresh" content="0; url=./vcon.html"/>
5+
<meta http-equiv="refresh" content="0; url=./build/html/index.html"/>
6+
<title>vCon Documentation - Redirecting...</title>
67
</head>
8+
<body>
9+
<p>Redirecting to the latest documentation...</p>
10+
<p>If you are not redirected automatically, <a href="./build/html/index.html">click here</a>.</p>
11+
</body>
712
</html>

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
copyright = "2024, Thomas McCarthy-Howe"
1616
author = "Thomas McCarthy-Howe"
1717

18-
version = "0.3.9"
19-
release = "0.3.9"
18+
version = "0.7.0"
19+
release = "0.7.0"
2020

2121
# -- General configuration ---------------------------------------------------
2222
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ vcon is a Python library for working with vCon (Video Conference) containers, wh
1515
installation
1616
usage
1717
new_required_fields
18+
version_management
1819
api/modules
1920

2021
Installation

docs/source/version_management.rst

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
Version Management Changes
2+
==========================
3+
4+
This document describes the changes to version management in the vCon library, including the removal of mandatory version enforcement and the optional nature of the version field.
5+
6+
Overview
7+
--------
8+
9+
Starting with version 0.7.0, the vCon library has simplified version management by making the version field optional and removing automatic version enforcement. This aligns with the latest vCon specification changes and provides more flexibility for users.
10+
11+
Key Changes
12+
-----------
13+
14+
### Version Field is Now Optional
15+
16+
The ``vcon`` field in vCon objects is no longer required:
17+
18+
- New vCon objects created with ``Vcon.build_new()`` do not include a version field by default
19+
- Existing vCon objects with version fields continue to work unchanged
20+
- The version field can be manually added if needed
21+
22+
### Removed Version Management Parameters
23+
24+
The following parameters have been removed from all Vcon methods:
25+
26+
- ``strict_version`` parameter removed from:
27+
- ``Vcon.__init__()``
28+
- ``Vcon.build_from_json()``
29+
- ``Vcon.build_new()``
30+
- ``Vcon.load()``
31+
- ``Vcon.load_from_file()``
32+
- ``Vcon.load_from_url()``
33+
34+
### Updated Method Signatures
35+
36+
All method signatures have been updated to remove version management:
37+
38+
.. code-block:: python
39+
40+
# Old signatures (no longer supported)
41+
Vcon(vcon_dict=None, strict_version=True)
42+
Vcon.build_new(created_at=None, strict_version=True)
43+
Vcon.build_from_json(json_str, strict_version=True)
44+
Vcon.load(source, strict_version=True)
45+
46+
# New signatures
47+
Vcon(vcon_dict=None, property_handling="default")
48+
Vcon.build_new(created_at=None, property_handling="default")
49+
Vcon.build_from_json(json_str, property_handling="default")
50+
Vcon.load(source, property_handling="default")
51+
52+
Migration Guide
53+
---------------
54+
55+
### For Existing Code
56+
57+
If you were using the ``strict_version`` parameter, simply remove it:
58+
59+
.. code-block:: python
60+
61+
# Old code (will cause errors)
62+
vcon = Vcon.load("file.json", strict_version=True)
63+
vcon = Vcon.build_from_json(json_str, strict_version=True)
64+
vcon = Vcon(data, strict_version=True)
65+
66+
# New code (remove strict_version parameter)
67+
vcon = Vcon.load("file.json")
68+
vcon = Vcon.build_from_json(json_str)
69+
vcon = Vcon(data)
70+
71+
### For Version Field Handling
72+
73+
The version field is now optional. You can choose to:
74+
75+
1. **Ignore version fields** (recommended for new code):
76+
- Simply don't set or check version fields
77+
- The library will work without them
78+
79+
2. **Manually manage version fields** (if needed):
80+
- Add version fields manually when creating vCon objects
81+
- Check version fields in your application logic
82+
83+
.. code-block:: python
84+
85+
# Option 1: Ignore version fields (recommended)
86+
vcon = Vcon.build_new()
87+
# vcon.vcon will be None
88+
89+
# Option 2: Manually add version field if needed
90+
vcon = Vcon.build_new()
91+
vcon.vcon_dict["vcon"] = "0.3.0"
92+
# vcon.vcon will be "0.3.0"
93+
94+
### Backward Compatibility
95+
96+
All changes are backward compatible:
97+
98+
- Existing vCon objects with version fields continue to work
99+
- The ``vcon`` property returns the version field if present, or ``None`` if not
100+
- No breaking changes to existing functionality
101+
102+
Examples
103+
--------
104+
105+
### Creating Versionless vCons
106+
107+
.. code-block:: python
108+
109+
from vcon import Vcon
110+
111+
# Create a new vCon without version field
112+
vcon = Vcon.build_new()
113+
print(vcon.vcon) # None
114+
115+
# Add version field manually if needed
116+
vcon.vcon_dict["vcon"] = "0.3.0"
117+
print(vcon.vcon) # "0.3.0"
118+
119+
### Working with Existing vCons
120+
121+
.. code-block:: python
122+
123+
# Load existing vCon (with or without version field)
124+
vcon = Vcon.load("existing.vcon.json")
125+
126+
# Check if version field exists
127+
if vcon.vcon:
128+
print(f"Version: {vcon.vcon}")
129+
else:
130+
print("No version field")
131+
132+
### Validation Changes
133+
134+
The validation logic has been updated to reflect the optional nature of the version field:
135+
136+
.. code-block:: python
137+
138+
# Validation no longer requires version field
139+
is_valid, errors = vcon.is_valid()
140+
141+
# Only uuid and created_at are required fields
142+
# Version field is optional and not validated
143+
144+
Benefits
145+
--------
146+
147+
The simplified version management provides several benefits:
148+
149+
1. **Reduced Complexity**: No need to manage version parameters
150+
2. **More Flexibility**: Version fields are optional and can be added as needed
151+
3. **Better Interoperability**: Works with vCon objects from different sources
152+
4. **Simplified API**: Cleaner method signatures without version management
153+
5. **Future-Proof**: Aligns with evolving vCon specification
154+
155+
Troubleshooting
156+
--------------
157+
158+
### Common Issues
159+
160+
1. **"strict_version" parameter errors**:
161+
- Remove the ``strict_version`` parameter from all method calls
162+
- Update method signatures to use ``property_handling`` instead
163+
164+
2. **Version field not found**:
165+
- Check if the vCon object has a version field: ``vcon.vcon is not None``
166+
- Add version field manually if needed: ``vcon.vcon_dict["vcon"] = "0.3.0"``
167+
168+
3. **Validation errors**:
169+
- Ensure required fields (uuid, created_at) are present
170+
- Version field is no longer required for validation
171+
172+
### Getting Help
173+
174+
If you encounter issues with the version management changes:
175+
176+
1. Check the migration guide above
177+
2. Review the changelog for detailed changes
178+
3. Test with the updated method signatures
179+
4. Ensure backward compatibility with existing vCon objects

docs/vcon.html

Lines changed: 0 additions & 2103 deletions
This file was deleted.

docs/vcon/dialog.html

Lines changed: 0 additions & 1708 deletions
This file was deleted.

docs/vcon/party.html

Lines changed: 0 additions & 677 deletions
This file was deleted.

src/vcon/vcon.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,8 @@ def uuid(self) -> str:
12171217
return self.vcon_dict["uuid"]
12181218

12191219
@property
1220-
def vcon(self) -> str:
1221-
return self.vcon_dict["vcon"]
1220+
def vcon(self) -> Optional[str]:
1221+
return self.vcon_dict.get("vcon")
12221222

12231223
@property
12241224
def subject(self) -> Optional[str]:

tests/test_vcon.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_build_from_json() -> None:
159159
def test_build_new() -> None:
160160
vcon = Vcon.build_new()
161161
assert vcon.uuid is not None
162-
assert vcon.vcon == "0.3.0"
162+
assert vcon.vcon is None # vcon field is now optional and not set by default
163163
assert vcon.created_at is not None
164164

165165

@@ -570,9 +570,8 @@ def test_is_valid_with_missing_required_fields():
570570
vcon.vcon_dict = {} # Empty vCon
571571
is_valid, errors = vcon.is_valid()
572572
assert not is_valid
573-
assert len(errors) == 3 # uuid, vcon, created_at
573+
assert len(errors) == 2 # uuid, created_at (vcon field is now optional)
574574
assert "Missing required field: uuid" in errors
575-
assert "Missing required field: vcon" in errors
576575
assert "Missing required field: created_at" in errors
577576

578577

0 commit comments

Comments
 (0)