Skip to content

Commit

Permalink
v0.3.0 (#30)
Browse files Browse the repository at this point in the history
* Remove one file.

* Version 0.3.0
  • Loading branch information
josiah-wolf-oberholtzer committed Mar 23, 2019
1 parent f2758cb commit 8e5a771
Show file tree
Hide file tree
Showing 56 changed files with 2,785 additions and 487 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
Expand Up @@ -2,7 +2,9 @@
branch = True
cover_pylib = False
source =
uqbar
uqbar/
omit =
tests/fake_package/*

[report]
exclude_lines =
Expand Down
25 changes: 13 additions & 12 deletions .travis.yml
@@ -1,31 +1,32 @@
language: python

dist: xenial
sudo: false

python:
- 3.6
# - "3.7-dev" # waiting on sphinx-autodoc-typehints GenericMeta fix
- "3.6"
- "3.7"
- "3.8-dev"

addons:
apt:
packages:
- graphviz
- graphviz

before_install:
- pip install -U pip
- pip install -U pip

install:
- pip install -e .[test]
- pip install -e .[test]

script:
- make black-check
- make flake8
- make mypy
- make pytest
- make docs
- make black-check
- make flake8
- make mypy
- make pytest
- make docs

after_success:
- coveralls
- coveralls

notifications:
email:
Expand Down
27 changes: 15 additions & 12 deletions Makefile
@@ -1,32 +1,35 @@
.PHONY: docs build

project = uqbar
errors = E123,E203,E265,E266,E501,W503
origin := $(shell git config --get remote.origin.url)
paths = uqbar/ tests/ *.py
formatPaths = ${project}/ tests/ *.py
testPaths = ${project}/ tests/

black-check:
black --py36 --diff --check ${paths}
black --py36 --diff --check ${formatPaths}

black-reformat:
black --py36 ${paths}
black --py36 ${formatPaths}

build:
python setup.py sdist

clean:
find . -name '*.pyc' | xargs rm -Rif
find . -name '*egg-info' | xargs rm -Rif
find . -name '.*_cache' | xargs rm -Rif
find . -name .coverage | xargs rm -Rif
find . -name __pycache__ | xargs rm -Rif
find . -name '*.pyc' | xargs rm
rm -Rif .*cache/
rm -Rif .tox/
rm -Rif __pycache__
rm -Rif build/
rm -Rif dist/
rm -Rif prof/
rm -Rif *.egg-info/

docs:
make -C docs/ html

flake8:
flake8 --max-line-length=90 --isolated --ignore=${errors} ${paths}
flake8 --max-line-length=90 --isolated --ignore=${errors} ${formatPaths}

gh-pages:
rm -Rf gh-pages/
Expand All @@ -42,13 +45,13 @@ gh-pages:
rm -Rf gh-pages/

isort:
isort --multi-line 1 --recursive --trailing-comma --use-parentheses -y ${paths}
isort --multi-line 1 --recursive --trailing-comma --use-parentheses -y ${formatPaths}

mypy:
mypy --ignore-missing-imports ${paths}
mypy --ignore-missing-imports ${project}/

pytest:
pytest --cov=uqbar/ --cov=tests/ --cov-report=html --cov-report=term
pytest --cov=${project}/ --cov=tests/ --cov-report=html --cov-report=term

reformat:
make isort
Expand Down
5 changes: 4 additions & 1 deletion docs/source/conf.py
Expand Up @@ -42,6 +42,7 @@
"sphinx.ext.viewcode",
"sphinx_autodoc_typehints",
"uqbar.sphinx.api",
"uqbar.sphinx.book",
'uqbar.sphinx.inheritance',
'uqbar.sphinx.style',
]
Expand Down Expand Up @@ -210,5 +211,7 @@
uqbar_api_module_documenter_class = "uqbar.apis.SummarizingModuleDocumenter"
uqbar_api_member_documenter_classes = [
"uqbar.apis.FunctionDocumenter",
"uqbar.apis.ClassDocumenter",
"uqbar.apis.SummarizingClassDocumenter",
]
uqbar_book_strict = True
uqbar_book_use_black = True
3 changes: 3 additions & 0 deletions docs/source/index.rst
@@ -1,6 +1,9 @@
Uqbar
=====

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black

Uqbar is a toolkit for building docs, graphs and more.

.. container:: svg-container
Expand Down
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

5 changes: 5 additions & 0 deletions setup.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
import pathlib
import sys
from distutils.version import LooseVersion

import setuptools

Expand Down Expand Up @@ -36,6 +38,9 @@ def read_version():
"sphinx-rtd-theme>=0.4.0",
]

if LooseVersion(sys.version.split()[0]) < LooseVersion("3.7.0"):
install_requires.append("dataclasses")

extras_require = {
"test": [
"black",
Expand Down
8 changes: 8 additions & 0 deletions tests/fake_package/enums.py
@@ -0,0 +1,8 @@
from uqbar.enums import IntEnumeration


class FakeEnum(IntEnumeration):
FOO = 0
BAR = 1
BAZ = 2
QUUX = 3
7 changes: 7 additions & 0 deletions tests/roots/test-uqbar-sphinx-book-broken/conf.py
@@ -0,0 +1,7 @@
master_doc = "index"

extensions = ["uqbar.sphinx.book"]

html_static_path = ["_static"]

uqbar_book_strict = True
15 changes: 15 additions & 0 deletions tests/roots/test-uqbar-sphinx-book-broken/index.rst
@@ -0,0 +1,15 @@
Fake Docs
=========

::

>>> for i in range(10):
... 1 / 0
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero

::
>>> print(this_name_does_not_exist)
Empty file.
38 changes: 38 additions & 0 deletions tests/roots/test-uqbar-sphinx-book/api.rst
@@ -0,0 +1,38 @@
API
===

Text::

>>> print("I am text.")

.. autoclass:: fake.GrandParent
:members:
:inherited-members:

Text::

>>> print("I am text.")

.. autoclass:: fake.Parent
:members:
:inherited-members:

Text::

>>> print("I am text.")

.. autoclass:: fake.Uncle
:members:
:inherited-members:

Text::

>>> print("I am text.")

.. autoclass:: fake.Child
:members:
:inherited-members:

Text::

>>> print("I am text.")
5 changes: 5 additions & 0 deletions tests/roots/test-uqbar-sphinx-book/conf.py
@@ -0,0 +1,5 @@
master_doc = "index"

extensions = ["sphinx.ext.autodoc", "uqbar.sphinx.book"]

html_static_path = ["_static"]
109 changes: 109 additions & 0 deletions tests/roots/test-uqbar-sphinx-book/fake.py
@@ -0,0 +1,109 @@
class GrandParent:
"""
A grand parent.
::
>>> print("I am a grand parent")
"""

def one(self):
"""
Grand parent: one.
::
>>> print("Grand parent: one.")
"""
pass

def two(self):
"""
Grand parent: two.
::
>>> print("Grand parent: two.")
"""
pass

def three(self):
"""
Grand parent: three.
::
>>> print("Grand parent: three.")
::
>>> import uqbar.graphs
>>> g = uqbar.graphs.Graph()
>>> n1 = uqbar.graphs.Node()
>>> n2 = uqbar.graphs.Node()
>>> g.extend([n1, n2])
>>> e = n1.attach(n2)
::
>>> print(format(g, "graphviz"))
::
>>> uqbar.graphs.Grapher(g)() # doctest: +SKIP
And that, my friends, is a graph.
"""
pass


class Parent(GrandParent):
"""
A parent.
::
>>> print("I am a parent")
"""

def one(self):
"""
Parent: one.
::
>>> print("Parent: one.")
"""
pass


class Uncle(GrandParent):
# I don't have a docstring or any overridden methods.
pass


class Child(Parent):
"""
A child.
::
>>> print("I am a child")
"""

def two(self):
"""
Child: two.
::
>>> print("Child: two.")
"""
pass
37 changes: 37 additions & 0 deletions tests/roots/test-uqbar-sphinx-book/index.rst
@@ -0,0 +1,37 @@
Fake Docs
=========

::

>>> print("hello, world!");
>>> print("foo bar baz!");
>>> print("i'm on my own line too!");

::

>>> import uqbar.graphs

::

>>> g = uqbar.graphs.Graph()
>>> n1 = uqbar.graphs.Node()
>>> g.append(n1)

::

>>> for i in range(3):
... n2 = uqbar.graphs.Node()
... g.append(n2)
... e = n1.attach(n2)
... uqbar.graphs.Grapher(g)()
... print(i)
... n1 = n2
...

::

>>> print(format(g, "graphviz"))

.. toctree::

api

0 comments on commit 8e5a771

Please sign in to comment.