Skip to content

Commit 23a6d9a

Browse files
authored
Merge pull request #102 from python-odin/release/1.6.0
Release/1.6.0
2 parents a5da896 + 01d4d3d commit 23a6d9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1514
-363
lines changed

.github/workflows/python-package.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches: [ development, feature/*, bugfix/*, release/* ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@master
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip poetry
27+
poetry install -E toml -E yaml -E arrow -E msgpack --no-root
28+
29+
- name: Test with pytest
30+
run: |
31+
poetry run pytest --junit-xml=reports/xunit-result-${{ matrix.python-version }}.xml --cov-report=xml:reports/coverage-${{ matrix.python-version }}.xml tests
32+
33+
- name: Analyze with SonarCloud
34+
uses: sonarsource/sonarcloud-github-action@master
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/release.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Match release tags on master branch
2+
name: Release
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
name: Build release package
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: actions/setup-python@master
18+
name: Setup Python 3.8
19+
with:
20+
python-version: 3.8
21+
22+
- name: Install dependencies
23+
run: python -m pip install -U poetry
24+
25+
- name: Build Package
26+
id: build_package
27+
run: |
28+
rm -rf dist
29+
poetry build
30+
cd dist
31+
echo "::set-output name=source::$(ls *.tar.gz)"
32+
echo "::set-output name=wheel::$(ls *.whl)"
33+
echo "::set-output name=version::$(poetry version -s)"
34+
35+
- name: Create a Release
36+
id: create_release
37+
uses: actions/create-release@v1
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
tag_name: ${{ steps.build_package.outputs.version }}
42+
release_name: Release ${{ steps.build_package.outputs.version }}
43+
prerelease: false
44+
45+
- name: Attach Release Wheel
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
asset_path: ./dist/${{ steps.build_package.outputs.wheel }}
52+
asset_name: ${{ steps.build_package.outputs.wheel }}
53+
asset_content_type: application/x-pywheel+zip
54+
55+
- name: Attach Release Source
56+
uses: actions/upload-release-asset@v1
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
upload_url: ${{ steps.create_release.outputs.upload_url }}
61+
asset_path: ./dist/${{ steps.build_package.outputs.source }}
62+
asset_name: ${{ steps.build_package.outputs.source }}
63+
asset_content_type: application/x-tar+gzip
64+
65+
- name: Upload to PyPI
66+
id: upload_to_pypi
67+
run: poetry publish

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ sudo: required
33
dist: xenial
44
python:
55
- "2.7"
6-
- "3.5"
76
- "3.6"
87
- "3.7"
8+
- "3.8"
9+
- "3.9"
910
- "pypy2.7-6.0"
1011
- "pypy3.5-6.0"
1112

HISTORY

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
1.6.0
2+
=====
3+
4+
- Remove encoding option for msgpack (this has been removed from msgpack itself)
5+
- Correct some typing inconsistencies (EnumField was the most obvious fix)
6+
- Package is now managed by poetry
7+
- Migrate to GitHub Actions
8+
- Static analysis and Coverage reporting now handled by SonarCloud.
9+
- Toml Codec
10+
111
1.5.2
212
=====
313
- Relax overly tight dependency specification. Removed pyup.io it is not suitable for packages.

README.rst

+42-29
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,46 @@ that make up the resources and mapping between objects (either a resource, or ot
88

99
Odin also comes with built in serialisation tools for importing and exporting data from resources.
1010

11-
.. image:: https://img.shields.io/pypi/l/odin.svg?style=flat
12-
:target: https://pypi.python.org/pypi/odin/
13-
:alt: License
11+
+---------+-------------------------------------------------------------------------------------------------------------+
12+
| Docs/ | .. image:: https://readthedocs.org/projects/odin/badge/?version=latest |
13+
| Help | :target: https://odin.readthedocs.org/ |
14+
| | :alt: ReadTheDocs |
15+
| | .. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat |
16+
| | :target: https://gitter.im/timsavage/odin |
17+
| | :alt: Gitter.im |
18+
+---------+-------------------------------------------------------------------------------------------------------------+
19+
| Build | .. image:: https://github.com/python-odin/odin/actions/workflows/python-package.yml/badge.svg |
20+
| | :target: https://github.com/python-odin/odin/actions/workflows/python-package.yml |
21+
| | :alt: Python package |
22+
| | .. image:: https://api.dependabot.com/badges/status?host=github&repo=python-odin/odin |
23+
| | :target: https://dependabot.com |
24+
| | :alt: Dependabot Status |
25+
+---------+-------------------------------------------------------------------------------------------------------------+
26+
| Quality | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=sqale_rating |
27+
| | :target: https://sonarcloud.io/dashboard?id=python-odin/odin |
28+
| | :alt: Maintainability |
29+
| | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=security_rating |
30+
| | :target: https://sonarcloud.io/project/security_hotspots |
31+
| | :alt: Security |
32+
| | .. image:: https://sonarcloud.io/api/project_badges/measure?project=python-odin_odin&metric=coverage |
33+
| | :target: https://sonarcloud.io/code?id=python-odin_odin |
34+
| | :alt: Test Coverage |
35+
| | .. image:: https://img.shields.io/badge/code%20style-black-000000.svg |
36+
| | :target: https://github.com/ambv/black |
37+
| | :alt: Once you go Black... |
38+
+---------+-------------------------------------------------------------------------------------------------------------+
39+
| Package | .. image:: https://img.shields.io/pypi/v/odin |
40+
| | :target: https://pypi.io/pypi/odin/ |
41+
| | :alt: Latest Version |
42+
| | .. image:: https://img.shields.io/pypi/pyversions/odin |
43+
| | :target: https://pypi.io/pypi/odin/ |
44+
| | .. image:: https://img.shields.io/pypi/l/odin |
45+
| | :target: https://pypi.io/pypi/odin/ |
46+
| | .. image:: https://img.shields.io/pypi/wheel/odin |
47+
| | :alt: PyPI - Wheel |
48+
| | :target: https://pypi.io/pypi/odin/ |
49+
+---------+-------------------------------------------------------------------------------------------------------------+
1450

15-
.. image:: https://img.shields.io/pypi/v/odin.svg?style=flat
16-
:target: https://pypi.python.org/pypi/odin/
17-
18-
.. image:: https://img.shields.io/travis/python-odin/odin/master.svg?style=flat
19-
:target: https://travis-ci.org/python-odin/odin
20-
:alt: Travis CI Status
21-
22-
.. image:: https://codecov.io/gh/python-odin/odin/branch/master/graph/badge.svg
23-
:target: https://codecov.io/gh/python-odin/odin
24-
:alt: Code cov
25-
26-
.. image:: https://landscape.io/github/python-odin/odin/master/landscape.svg?style=flat
27-
:target: https://landscape.io/github/python-odin/odin/master
28-
:alt: Code Health
29-
30-
.. image:: https://img.shields.io/requires/github/timsavage/odin.svg?style=flat
31-
:target: https://requires.io/github/timsavage/odin/requirements/?branch=master
32-
:alt: Requirements Status
33-
34-
.. image:: https://img.shields.io/badge/gitterim-timsavage.odin-brightgreen.svg?style=flat
35-
:target: https://gitter.im/timsavage/odin
36-
:alt: Gitter.im
3751

3852
Highlights
3953
**********
@@ -42,8 +56,7 @@ Highlights
4256
* Fields for building composite resources
4357
* Field and Resource level validation
4458
* Easy extension to support custom fields
45-
* Python 2.7 :sup:`1`, Python 2.7+, Python 3.5+ and PyPy :sup:`1` supported
46-
* Integration with Django (see `baldr <https://github.com/python-odin/baldr>`_)
59+
* Python 2.7 :sup:`1`, Python 2.7+, Python 3.6+ and PyPy :sup:`1` supported
4760
* Support for documenting resources with `Sphinx <http://sphinx-doc.org/>`_
4861
* Minimal dependencies (base functionality only requires *six*)
4962

@@ -52,7 +65,7 @@ Highlights
5265
Use cases
5366
*********
5467
* Design, document and validate complex (and simple!) data structures
55-
* Convert structures to and from different formats such as JSON, YAML, MsgPack or CSV
68+
* Convert structures to and from different formats such as JSON, YAML, MsgPack, CSV, TOML
5669
* Validate API inputs
5770
* Define message formats for communications protocols, like an RPC
5871
* Map API requests to ORM objects
@@ -73,7 +86,6 @@ Upcoming features
7386
* XML Codec (export completed)
7487
* Complete documentation coverage
7588
* Improvements for CSV Codec (writing, reading multi resource CSV's)
76-
* RESTful interface with support for Flask and Django
7789
* Integration with other libraries (ie `Django <https://www.djangoproject.com/>`_ Models/Forms)
7890
* Integration with SQLAlchemy
7991

@@ -88,6 +100,7 @@ Requires
88100
* simplejson - Odin will use simplejson if it is available or fallback to the builtin json library
89101
* msgpack-python - To enable use of the msgpack codec
90102
* pyyaml - To enable use of the YAML codec
103+
* toml - To enable use of the TOML codec
91104

92105
**Contrib**
93106

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Working with resources
1919
Resources are the basic building block of Odin.
2020

2121
* Resources: :doc:`ref/resources/fields` | :doc:`ref/resources/options`
22-
* Loading and Saving: :doc:`ref/codecs/json_codec` | :doc:`ref/codecs/yaml_codec` | :doc:`ref/codecs/csv_codec` | :doc:`ref/codecs/msgpack_codec`
22+
* Loading and Saving: :doc:`ref/codecs/json_codec` | :doc:`ref/codecs/toml_codec` | :doc:`ref/codecs/yaml_codec` | :doc:`ref/codecs/csv_codec` | :doc:`ref/codecs/msgpack_codec`
2323
* Mapping: :doc:`ref/mapping/classes`
2424
* Adapters: :doc:`ref/adapters`
2525
* Documenting: :doc:`ref/contrib/sphinx/index`

docs/ref/codecs/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ JSON data Odin provides the same ``load``, ``loads`` style interface.
1212

1313
csv_codec
1414
json_codec
15-
yaml_codec
1615
msgpack_codec
16+
toml_codec
17+
yaml_codec
1718
xml_codec

docs/ref/codecs/toml_codec.rst

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
##########
2+
TOML Codec
3+
##########
4+
5+
Codec for serialising and de-serialising TOML data. Supports both array and objects for mapping into resources or
6+
collections of resources.
7+
8+
The TOML codec uses the :py:mod:`toml` module.
9+
10+
.. automodule:: odin.codecs.toml_codec
11+
12+
Methods
13+
=======
14+
15+
.. autofunction:: load
16+
17+
.. autofunction:: loads
18+
19+
.. autofunction:: dump
20+
21+
.. autofunction:: dumps
22+
23+
24+
Customising Encoding
25+
====================
26+
27+
Serialisation of Odin resources is handled by a customised :py:class:`toml.Encoder`. Additional data types can be
28+
appended to the :py:const:`odin.codecs.toml_codec.TOML_TYPES` dictionary.
29+
30+
Example usage
31+
=============
32+
33+
Loading a resource from a file::
34+
35+
from odin.codecs import toml_codec
36+
37+
with open('my_resource.toml') as f:
38+
resource = toml_codec.load(f)
39+

odin/__version__.py

-1
This file was deleted.

0 commit comments

Comments
 (0)