Skip to content

Commit

Permalink
Initialize skeletop plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Jun 7, 2021
0 parents commit a6c7c18
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
include:
- {name: PyPy 3.6, python: pypy-3.6, os: ubuntu}
- {name: PyPy 3.7, python: pypy-3.7, os: ubuntu}
- {name: Python 3.6, python: 3.6, os: ubuntu}
- {name: Python 3.7, python: 3.7, os: ubuntu}
- {name: Python 3.8, python: 3.8, os: ubuntu}
- {name: Python 3.9, python: 3.9, os: ubuntu}
- {name: Python 3.10, python: 3.10.0-beta - 3.10, os: ubuntu}
- {name: Windows py37, python: 3.7, os: windows}
- {name: MacOS py37, python: 3.7, os: macos}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install libxml2
if: startsWith(matrix.python, 'pypy') || startsWith(matrix.python, '3.10')
run: |
sudo apt-get install libxml2-dev libxslt-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox codecov
- name: Test
run: |
tox -e py -- --cov=./xsdata_attrs --cov-branch --doctest-glob="docs/*.rst"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
pre-commit:
name: Pre-commit Hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
110 changes: 110 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
#target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# idea
.idea/

# vscode
.vscode/
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
exclude: tests/fixtures

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.19.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.5.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/ambv/black
rev: 21.5b2
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies: [
flake8-bugbear,
flake8-annotations,
flake8-comprehensions,
]
args: ["--suppress-none-returning"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements
- repo: https://github.com/myint/docformatter
rev: v1.4
hooks:
- id: docformatter
args: ["--in-place", "--pre-summary-newline"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
hooks:
- id: mypy
additional_dependencies: [tokenize-rt]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: setup-cfg-fmt
args: ["--max-py-version=3.10"]
- repo: https://github.com/PyCQA/doc8
rev: 0.9.0a1
hooks:
- id: doc8
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Christodoulos Tsoulloftas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include LICENSE README.rst LICENSE tox.ini
recursive-include tests *
recursive-include xsdata_attrs *

exclude .pre-commit-config.yaml

global-exclude .DS_Store *.pyc
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`xsData <https://pypi.org/project/xsdata/>`_ Attrs plugin
============================================================
62 changes: 62 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[metadata]
name = xsdata_attrs
version = 21.4
description = xsdata attrs plugin
long_description = file: README.rst
long_description_content_type = text/x-rst
url = https://github.com/tefra/xsdata-attrs
author = Christodoulos Tsoulloftas
author_email = "[email protected]",
license = MIT
license_file = LICENSE
classifiers =
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Code Generators
Topic :: Text Processing :: Markup :: XML
keywords = xsd,wsdl,schema,xml,attrs,generator,cli
project_urls =
Source=https://github.com/tefra/xsdata-attrs

[options]
packages = xsdata_attrs
install_requires =
xsdata
python_requires = >=3.6
include_package_data = True

[options.entry_points]
xsdata.plugins.cli =
xsdata_attrs = xsdata_attrs.hook

[options.extras_require]
cli =
xsdata[cli]
test =
codecov
pre-commit
pytest
pytest-cov
tox

[flake8]
exclude = tests/*
max-line-length = 88
ignore = W503,ANN101,ANN102,E203

[doc8]
max-line-length = 88

[tool:pytest]
addopts = --color=yes
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from setuptools import setup

setup()
Empty file added tests/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tox]
envlist = py36,py37,py38,py39,py310,pypy3
skip_missing_interpreters = true

[testenv]
extras = test,cli
commands = pytest {posargs}
Empty file added xsdata_attrs/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions xsdata_attrs/generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from xsdata.formats.dataclass.generator import DataclassGenerator


class AttrsGenerator(DataclassGenerator):
"""attrs generator."""

pass
5 changes: 5 additions & 0 deletions xsdata_attrs/hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from xsdata.codegen.writer import CodeWriter

from xsdata_attrs.generator import AttrsGenerator

CodeWriter.register_generator("attrs", AttrsGenerator)
Empty file added xsdata_attrs/py.typed
Empty file.

0 comments on commit a6c7c18

Please sign in to comment.