Skip to content

Commit

Permalink
docs: Convert to mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Mar 10, 2024
1 parent ad740c4 commit 4fe5718
Show file tree
Hide file tree
Showing 26 changed files with 337 additions and 418 deletions.
18 changes: 13 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
version: 2

build:
image: latest
os: "ubuntu-22.04"
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml

python:
version: 3.8
pip_install: true
extra_requirements:
- docs,cli
install:
- method: pip
path: .
extra_requirements:
- docs,cli
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 23.8 (2023-08-12)

- Removed python 3.6 and 3.7 support
- Added official support for 3.11 and 3.12
- Set xsdata minimum version v23.5

## 21.11 (2021-11-02)

- Fixed dataclass.unsafe_hash mapping to attrs.hash property
[#7](https://github.com/tefra/xsdata-attrs/issues/7)

## 21.8 (2021-08-03)

-
- Initial Release
17 changes: 0 additions & 17 deletions CHANGES.rst

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE README.rst CHANGES.rst tox.ini
include LICENSE README.md CHANGES.md
recursive-include docs *
recursive-include tests *
recursive-include xsdata_attrs *
Expand Down
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[![image](https://github.com/tefra/xsdata-attrs/raw/main/docs/logo.svg)](https://xsdata-attrs.readthedocs.io/)

# xsdata powered by attrs!

[![image](https://github.com/tefra/xsdata-attrs/workflows/tests/badge.svg)](https://github.com/tefra/xsdata-attrs/actions)
[![image](https://readthedocs.org/projects/xsdata-attrs/badge)](https://xsdata-attrs.readthedocs.io/)
[![image](https://codecov.io/gh/tefra/xsdata-attrs/branch/main/graph/badge.svg)](https://codecov.io/gh/tefra/xsdata-attrs)
[![image](https://img.shields.io/github/languages/top/tefra/xsdata-attrs.svg)](https://xsdata-attrs.readthedocs.io/)
[![image](https://www.codefactor.io/repository/github/tefra/xsdata-attrs/badge)](https://www.codefactor.io/repository/github/tefra/xsdata-attrs)
[![image](https://img.shields.io/pypi/pyversions/xsdata-attrs.svg)](https://pypi.org/pypi/xsdata-attrs/)
[![image](https://img.shields.io/pypi/v/xsdata-attrs.svg)](https://pypi.org/pypi/xsdata-attrs/)

---

xsData is a complete data binding library for python allowing developers to access and
use XML and JSON documents as simple objects rather than using DOM.

Now powered by attrs!

```console
$ xsdata http://rss.cnn.com/rss/edition.rss --output attrs
Parsing document edition.rss
Analyzer input: 9 main and 0 inner classes
Analyzer output: 9 main and 0 inner classes
Generating package: init
Generating package: generated.rss
```

```python
@attr.s
class Rss:
class Meta:
name = "rss"

version: Optional[float] = attr.ib(
default=None,
metadata={
"type": "Attribute",
}
)
channel: Optional[Channel] = attr.ib(
default=None,
metadata={
"type": "Element",
}
)
```

```console

>>> from xsdata_attrs.bindings import XmlParser
>>> from urllib.request import urlopen
>>> from generated.rss import Rss
>>>
>>> parser = XmlParser()
>>> with urlopen("http://rss.cnn.com/rss/edition.rss") as rq:
... result = parser.parse(rq, Rss)
...
>>> result.channel.item[2].title
'Vatican indicts 10 people, including a Cardinal, over an international financial scandal'
>>> result.channel.item[2].pub_date
'Sat, 03 Jul 2021 16:37:14 GMT'
>>> result.channel.item[2].link
'https://www.cnn.com/2021/07/03/europe/vatican-financial-scandal-intl/index.html'

```

## Changelog: 24.3 (2024-03-10)

---

- Updated
110 changes: 0 additions & 110 deletions README.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/.gitignore

This file was deleted.

23 changes: 0 additions & 23 deletions docs/Makefile

This file was deleted.

41 changes: 41 additions & 0 deletions docs/bindings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Data Bindings

All the xsdata
[data bindings](https://xsdata.readthedocs.io/en/latest/data_binding/basics/) are
available. There is an extra requirement to specify the class type of the data models to
the [XmlContext][xsdata.formats.dataclass.context.XmlContext] that among other stuff
also acts as a compatibility layer between dataclasses and attrs models.

## Specify ClassType

```python
>>> from xsdata.formats.dataclass.parsers import XmlParser
>>> from xsdata.formats.dataclass.parsers import JsonParser
>>> from xsdata.formats.dataclass.serializers import XmlSerializer
>>> from xsdata.formats.dataclass.serializers import JsonSerializer
>>> from xsdata.formats.dataclass.context import XmlContext
...
>>> context = XmlContext(class_type="attrs") # Specify class type attrs
>>> xml_parser = XmlParser(context=context)
>>> xml_serializer = XmlSerializer(context=context)
>>> json_parser = JsonParser(context=context)
>>> json_serializer = JsonSerializer(context=context)
```

## Binding Shortcuts

For convenience this plugin comes with subclasses for all the xsdata binding modules
with the attrs context auto initialized.

```python
>>> from xsdata_attrs.bindings import XmlContext
>>> from xsdata_attrs.bindings import XmlParser
>>> from xsdata_attrs.bindings import XmlSerializer
>>> from xsdata_attrs.bindings import JsonParser
>>> from xsdata_attrs.bindings import JsonSerializer
>>> from xsdata_attrs.bindings import UserXmlParser
>>> from xsdata_attrs.bindings import TreeParser
>>> from xsdata_attrs.bindings import PycodeSerializer
>>> from xsdata_attrs.bindings import DictDecoder
>>> from xsdata_attrs.bindings import DictEncoder
```
44 changes: 0 additions & 44 deletions docs/bindings.rst

This file was deleted.

3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

--8<-- "CHANGES.md"
4 changes: 0 additions & 4 deletions docs/changelog.rst

This file was deleted.

Loading

0 comments on commit 4fe5718

Please sign in to comment.