Skip to content

Commit cbb4e4a

Browse files
committed
deploy: 3c487c1
1 parent 65c5301 commit cbb4e4a

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

_sources/schema-evolution.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For example, suppose we had a `msgspec.Struct` type representing a user:
2424

2525
.. code-block:: python
2626
27-
>>> import msgpsec
27+
>>> import msgspec
2828
2929
>>> from typing import Set, Optional
3030
@@ -48,7 +48,7 @@ accomplish this, we add ``phone`` as an _optional_ field (defaulting to
4848
... email: Optional[str] = None
4949
... phone : Optional[str] = None
5050
51-
Messages serialized using the new and old schemas can still be exchanged
51+
Messages serialized using both the old and new schemas can still be exchanged
5252
without error. If an old message is deserialized using the new schema, the
5353
missing fields all have default values that will be used. Likewise, if a new
5454
message is deserialized with the old schema the unknown new fields will be

api.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ <h2>Unset<a class="headerlink" href="#unset" title="Link to this heading">¶</a>
752752
in an object needs to be treated differently than one containing an explicit
753753
<code class="docutils literal notranslate"><span class="pre">None</span></code> value. In this case, you may use <code class="docutils literal notranslate"><span class="pre">UNSET</span></code> as the default value,
754754
rather than <code class="docutils literal notranslate"><span class="pre">None</span></code> when defining object schemas. This feature is supported
755-
for any <a class="reference internal" href="#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.Struct</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types.</p>
755+
for any <a class="reference internal" href="#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.Struct</span></code></a>, <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types.</p>
756756
<p class="rubric">Examples</p>
757757
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">msgspec</span> <span class="kn">import</span> <span class="n">Struct</span><span class="p">,</span> <span class="n">UnsetType</span><span class="p">,</span> <span class="n">UNSET</span><span class="p">,</span> <span class="n">json</span>
758758
<span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">Example</span><span class="p">(</span><span class="n">Struct</span><span class="p">):</span>
@@ -2083,7 +2083,7 @@ <h2>Inspect<a class="headerlink" href="#inspect" title="Link to this heading">¶
20832083
<dl class="py class">
20842084
<dt class="sig sig-object py" id="msgspec.inspect.DataclassType">
20852085
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">msgspec.inspect.</span></span><span class="sig-name descname"><span class="pre">DataclassType</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cls</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fields</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#msgspec.inspect.DataclassType" title="Link to this definition"></a></dt>
2086-
<dd><p>A type corresponding to a <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> type.</p>
2086+
<dd><p>A type corresponding to a <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> type.</p>
20872087
<dl class="field-list simple">
20882088
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
20892089
<dd class="field-odd"><ul class="simple">

changelog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ <h2>Version 0.16.0 (2023-06-12)<a class="headerlink" href="#version-0-16-0-2023-
452452
for this is converting ORM objects to <a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Struct</span></code></a> or <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> types
453453
(<a class="extlink-pr reference external" href="https://github.com/jcrist/msgspec/pull/419">PR #419</a>).</p></li>
454454
<li><p>Support passing generic <code class="docutils literal notranslate"><span class="pre">Mapping</span></code> objects as inputs to <a class="reference internal" href="api.html#msgspec.convert" title="msgspec.convert"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.convert</span></code></a>.
455-
These may be coerced to <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dict</span></code></a>/<a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Struct</span></code></a>/<a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a>/<a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types
455+
These may be coerced to <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dict</span></code></a>/<a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Struct</span></code></a>/<a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a>/<a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types
456456
(<a class="extlink-pr reference external" href="https://github.com/jcrist/msgspec/pull/427">PR #427</a>).</p></li>
457457
<li><p>Add a new <code class="docutils literal notranslate"><span class="pre">strict</span></code> keyword argument to all <code class="docutils literal notranslate"><span class="pre">decode</span></code> functions,
458458
<code class="docutils literal notranslate"><span class="pre">Decoder</span></code> classes, as well as <a class="reference internal" href="api.html#msgspec.convert" title="msgspec.convert"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.convert</span></code></a>. This defaults to <code class="docutils literal notranslate"><span class="pre">True</span></code>,

examples/edgedb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ <h2>Converting Results to Structs<a class="headerlink" href="#converting-results
509509
</div>
510510
<p>We can then convert the <code class="docutils literal notranslate"><span class="pre">edgedb.Object</span></code> results into our <code class="docutils literal notranslate"><span class="pre">Struct</span></code> types
511511
using <a class="reference internal" href="../api.html#msgspec.convert" title="msgspec.convert"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.convert</span></code></a>. Note that the same conversion process would work if
512-
<code class="docutils literal notranslate"><span class="pre">Person</span></code> or <code class="docutils literal notranslate"><span class="pre">Movie</span></code> were defined as <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types instead.</p>
512+
<code class="docutils literal notranslate"><span class="pre">Person</span></code> or <code class="docutils literal notranslate"><span class="pre">Movie</span></code> were defined as <a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a> or <a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a> types instead.</p>
513513
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">msgspec</span><span class="o">.</span><span class="n">convert</span><span class="p">(</span><span class="n">dune</span><span class="p">,</span> <span class="n">Movie</span><span class="p">,</span> <span class="n">from_attributes</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
514514
<span class="go">Movie(title=&#39;Dune&#39;, actors=[Person(name=&#39;Timothée Chalamet&#39;), Person(name=&#39;Zendaya&#39;)])</span>
515515
</pre></div>

schema-evolution.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ <h1>Schema Evolution<a class="headerlink" href="#schema-evolution" title="Link t
330330
<a class="reference internal" href="extending.html#defining-extensions"><span class="std std-ref">extensions</span></a> (MessagePack only).</p></li>
331331
</ol>
332332
<p>For example, suppose we had a <a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.Struct</span></code></a> type representing a user:</p>
333-
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">msgpsec</span>
333+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">msgspec</span>
334334

335335
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Set</span><span class="p">,</span> <span class="n">Optional</span>
336336

@@ -353,7 +353,7 @@ <h1>Schema Evolution<a class="headerlink" href="#schema-evolution" title="Link t
353353
<span class="gp">... </span> <span class="n">phone</span> <span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
354354
</pre></div>
355355
</div>
356-
<p>Messages serialized using the new and old schemas can still be exchanged
356+
<p>Messages serialized using both the old and new schemas can still be exchanged
357357
without error. If an old message is deserialized using the new schema, the
358358
missing fields all have default values that will be used. Likewise, if a new
359359
message is deserialized with the old schema the unknown new fields will be

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

supported-types.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ <h2>Generic Types<a class="headerlink" href="#generic-types" title="Link to this
14061406
<ul class="simple">
14071407
<li><p><a class="reference internal" href="api.html#msgspec.Struct" title="msgspec.Struct"><code class="xref py py-obj docutils literal notranslate"><span class="pre">msgspec.Struct</span></code></a></p></li>
14081408
<li><p><a class="reference external" href="https://docs.python.org/3/library/dataclasses.html#module-dataclasses" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">dataclasses</span></code></a></p></li>
1409-
<li><p><a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.2)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a></p></li>
1409+
<li><p><a class="reference external" href="https://www.attrs.org/en/stable/api.html#module-attrs" title="(in attrs v24.3)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">attrs</span></code></a></p></li>
14101410
<li><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.TypedDict" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">typing.TypedDict</span></code></a></p></li>
14111411
<li><p><a class="reference external" href="https://docs.python.org/3/library/typing.html#typing.NamedTuple" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">typing.NamedTuple</span></code></a></p></li>
14121412
</ul>

0 commit comments

Comments
 (0)