Skip to content

Commit

Permalink
Merge branch 'main' into truthiness
Browse files Browse the repository at this point in the history
  • Loading branch information
stchris authored Jul 1, 2022
2 parents 8e23f0d + 17a6175 commit 236a5df
Show file tree
Hide file tree
Showing 21 changed files with 963 additions and 135 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
exclude = .git,__pycache__,docs/conf.py,old,build,dist,.tox
ignore = E501
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: stchris
liberapay: stchris
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: build

on: push

jobs:
test:
name: Test Python ${{ matrix.python-version }} (${{ matrix.os }})
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: make setup

- name: Lint
run: make lint

- name: Run tests
run: make test

release:
name: Release
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install requirements
run: python -m pip install wheel

- name: Build a distribution
run: python setup.py sdist bdist_wheel

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Christian Stefanescu <[email protected]>
Florian Idelberger <[email protected]>
Apalala <[email protected]>
Reverb Chu <[email protected]>
Henrikki Tenkanen <[email protected]>
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ Unreleased
- dropped support for Python 2.6, 3.3
- fixed support for Python 3.6 ([#57](https://github.com/stchris/untangle/pull/57))
- formatted code with black
- support Element truthiness on Python 3
- support Element truthiness on Python 3 ([#68](https://github.com/stchris/untangle/pull/68/))
- `main` is now the default branch
- switch to Github Actions
- switch to poetry and pytest
- dropped support for Python 3.4-3.6 and pypy


1.1.1
- addded generic SAX feature toggle ([#26](https://github.com/stchris/untangle/pull/26))
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
compile:
python -m compileall -q untangle.py tests/tests.py

setup:
python -m pip install poetry
poetry install

lint:
poetry run flake8 .
poetry run black --check .

test:
tox
poetry run pytest -v

# needs python-stdeb
package_deb:
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
untangle
========

[![Build Status](https://secure.travis-ci.org/stchris/untangle.png?branch=master)](http://travis-ci.org/stchris/untangle)
[![Build Status](https://github.com/stchris/untangle/actions/workflows/build.yml/badge.svg)](https://github.com/stchris/untangle/actions)
[![PyPi version](https://img.shields.io/pypi/v/untangle.svg)](https://pypi.python.org/pypi/untangle)
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>

Expand All @@ -12,18 +12,26 @@ untangle
* Children can be accessed with ``parent.child``, attributes with ``element['attribute']``.
* You can call the ``parse()`` method with a filename, an URL or an XML string.
* Substitutes ``-``, ``.`` and ``:`` with ``_`` ``<foobar><foo-bar/></foobar>`` can be accessed with ``foobar.foo_bar``, ``<foo.bar.baz/>`` can be accessed with ``foo_bar_baz`` and ``<foo:bar><foo:baz/></foo:bar>`` can be accessed with ``foo_bar.foo_baz``
* Works with Python 2.7 and 3.4, 3.5, 3.6, 3.7, 3.8 and pypy
* Works with Python 3.7 - 3.10

Installation
------------

With pip:
```
pip install untangle
```

With conda:
```
conda install -c conda-forge untangle
```

Conda feedstock maintained by @htenkanen. Issues and questions about conda-forge packaging / installation can be done [here](https://github.com/conda-forge/untangle-feedstock/issues).

Usage
-----
(See and run <a href="https://github.com/stchris/untangle/blob/master/examples.py">examples.py</a> or this blog post: [Read XML painlessly](http://pythonadventures.wordpress.com/2011/10/30/read-xml-painlessly/) for more info)
(See and run <a href="https://github.com/stchris/untangle/blob/main/examples.py">examples.py</a> or this blog post: [Read XML painlessly](http://pythonadventures.wordpress.com/2011/10/30/read-xml-painlessly/) for more info)

```python
import untangle
Expand Down
14 changes: 7 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
master_doc = "index"

# General information about the project.
project = u"untangle"
copyright = u"2012, Christian Stefanescu"
project = "untangle"
copyright = "2012, Christian Stefanescu"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -185,8 +185,8 @@
(
"index",
"untangle.tex",
u"untangle Documentation",
u"Christian Stefanescu",
"untangle Documentation",
"Christian Stefanescu",
"manual",
),
]
Expand Down Expand Up @@ -217,7 +217,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
("index", "untangle", u"untangle Documentation", [u"Christian Stefanescu"], 1)
("index", "untangle", "untangle Documentation", ["Christian Stefanescu"], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -233,8 +233,8 @@
(
"index",
"untangle",
u"untangle Documentation",
u"Christian Stefanescu",
"untangle Documentation",
"Christian Stefanescu",
"untangle",
"One line description of project.",
"Miscellaneous",
Expand Down
12 changes: 7 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ untangle: Convert XML to Python objects
=======================================

`untangle <https://stchris.github.com/untangle/>`_ is a tiny Python library which converts an XML
document to a Python object. It is available under the `MIT license <https://github.com/stchris/untangle/blob/master/LICENSE/>`_.
document to a Python object. It is available under the `MIT license <https://github.com/stchris/untangle/blob/main/LICENSE/>`_.

.. contents::

Expand Down Expand Up @@ -45,16 +45,18 @@ and assuming it's available in a variable called `xml`, we could use untangle li

For text/data inbetween tags, this is described as cdata. After specifying the relevant element as explained above, the data/cdata can be accessed by adding ".cdata" (without the quotes) to the end of your dictionary call.

For more examples, have a look at (and launch) `examples.py <https://github.com/stchris/untangle/blob/master/examples.py/>`_.
For more examples, have a look at (and launch) `examples.py <https://github.com/stchris/untangle/blob/main/examples.py/>`_.

Installation
------------

It is recommended to use pip, which will always download the latest stable release: ::
::

pip install untangle

untangle works with Python versions 2.6, 2.7, 3.3, 3.4, 3.5, 3.6 and pypy
Alternatively, you can install untangle with conda from conda-forge: ::

conda install -c conda-forge untangle

Motivation
----------
Expand Down Expand Up @@ -95,7 +97,7 @@ This will toggle the SAX handler feature described `here <https://docs.python.or
Changelog
---------

see https://github.com/stchris/untangle/blob/master/CHANGELOG.md
see https://github.com/stchris/untangle/blob/main/CHANGELOG.md


Indices and tables
Expand Down
Loading

0 comments on commit 236a5df

Please sign in to comment.