Skip to content

Commit 549c297

Browse files
author
Sylvain MARIE
committed
Added __version__ package-level attribute.
Removed pypandoc dependency Got rid of pytest-cov Fixed pytest-html version
1 parent aa79d18 commit 549c297

4 files changed

Lines changed: 41 additions & 31 deletions

File tree

ci_tools/requirements-pip.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# --- to execute setup.py whatever the goal
22
setuptools_scm
33
pytest-runner
4-
pandoc
5-
pypandoc
64

75
# --- to install
86
pyyaml$PYYAML_VERSION
@@ -12,8 +10,8 @@ pytest #$PYTEST_VERSION
1210
pytest-logging # ==2015.11.4
1311

1412
# --- to generate the reports (see scripts in ci_tools, called by .travis)
15-
pytest-cov==2.6.0 # after 2.6.1 it requires pytest 3.6
16-
pytest-html #$PYTEST_HTML_VERSION
13+
# pytest-cov==2.6.0 # after 2.6.1 it requires pytest 3.6
14+
pytest-html==1.9.0 # otherwise requires pytest 5
1715
xunitparser
1816

1917
# --- to generate the doc (see .travis)

ci_tools/run_tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ trap "cleanup" INT TERM EXIT
2222
echo -e "\n\n****** Running tests ******\n\n"
2323
if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then
2424
# full
25-
python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./yamlable -v yamlable/tests/
25+
coverage run --source yamlable -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -s -v yamlable/tests/
26+
# buggy
27+
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./yamlable -v yamlable/tests/
2628
else
2729
# faster - skip coverage and html report
2830
python -m pytest --junitxml=reports/junit/junit.xml -v yamlable/tests/

setup.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# *************** Dependencies *********
1414
INSTALL_REQUIRES = ['pyyaml']
1515
DEPENDENCY_LINKS = []
16-
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'pypandoc', 'pandoc']
17-
TESTS_REQUIRE = ['pytest', 'pytest-logging', 'pytest-cov']
16+
SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm']
17+
TESTS_REQUIRE = ['pytest', 'pytest-logging']
1818
EXTRAS_REQUIRE = {}
1919

2020
# simple check
@@ -36,17 +36,9 @@
3636
DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url
3737

3838
KEYWORDS = 'yaml file parsing parse load dump read write object oo oriented codec format plugin pyYaml'
39-
# --Get the long description from the README file
40-
# with open(path.join(here, 'README.md'), encoding='utf-8') as f:
41-
# LONG_DESCRIPTION = f.read()
42-
try:
43-
import pypandoc
44-
LONG_DESCRIPTION = pypandoc.convert(path.join(here, 'docs', 'long_description.md'), 'rst').replace('\r', '')
45-
except(ImportError):
46-
from warnings import warn
47-
warn('WARNING pypandoc could not be imported - we recommend that you install it in order to package the '
48-
'documentation correctly')
49-
LONG_DESCRIPTION = open('README.md').read()
39+
40+
with open(path.join(here, 'docs', 'long_description.md')) as f:
41+
LONG_DESCRIPTION = f.read()
5042

5143
# ************* VERSION **************
5244
# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4.
@@ -59,6 +51,7 @@
5951
name=DISTNAME,
6052
description=DESCRIPTION,
6153
long_description=LONG_DESCRIPTION,
54+
long_description_content_type='text/markdown',
6255

6356
# Versions should comply with PEP440. For a discussion on single-sourcing
6457
# the version across setup.py and the project code, see
@@ -119,7 +112,7 @@
119112
dependency_links=DEPENDENCY_LINKS,
120113

121114
# we're using git
122-
use_scm_version=True, # this provides the version + adds the date if local non-commited changes.
115+
use_scm_version={'write_to': '%s/_version.py' % DISTNAME}, # this provides the version + adds the date if local non-commited changes.
123116
# use_scm_version={'local_scheme':'dirty-tag'}, # this provides the version + adds '+dirty' if local non-commited changes.
124117
setup_requires=SETUP_REQUIRES,
125118

yamlable/__init__.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1+
from yamlable.base import AbstractYamlObject, NONE_IGNORE_CHECKS, read_yaml_node_as_dict
2+
from yamlable.main import YamlCodec, register_yamlable_codec, yaml_info_decorate, yaml_info, YamlAble, \
3+
AbstractYamlAble, YAMLABLE_PREFIX
4+
from yamlable.yaml_objects import YamlObject2, ABCYAMLMeta, YAMLObjectMetaclassStrict
5+
6+
try:
7+
# -- Distribution mode --
8+
# import from _version.py generated by setuptools_scm during release
9+
from ._version import version as __version__
10+
except ImportError:
11+
# -- Source mode --
12+
# use setuptools_scm to get the current version from src using git
13+
from setuptools_scm import get_version as _gv
14+
from os import path as _path
15+
__version__ = _gv(_path.join(_path.dirname(__file__), _path.pardir))
16+
17+
__all__ = [
18+
'__version__',
19+
# submodules
20+
'base', 'main', 'yaml_objects',
21+
# symbols
22+
'AbstractYamlObject', 'NONE_IGNORE_CHECKS', 'read_yaml_node_as_dict',
23+
'YamlCodec', 'register_yamlable_codec', 'yaml_info_decorate', 'yaml_info', 'YamlAble', 'AbstractYamlAble',
24+
'YAMLABLE_PREFIX',
25+
'YamlObject2', 'ABCYAMLMeta', 'YAMLObjectMetaclassStrict'
26+
]
27+
128
try: # python 3.5+
229
from yamlable.base import Y
30+
__all__.append('Y')
331
except ImportError:
432
pass
5-
from yamlable.base import AbstractYamlObject, NONE_IGNORE_CHECKS, read_yaml_node_as_dict
633

734
try: # python 3.5+
835
from yamlable.main import YA
36+
__all__.append('YA')
937
except ImportError:
1038
pass
11-
from yamlable.main import YamlCodec, register_yamlable_codec, yaml_info_decorate, yaml_info, YamlAble, \
12-
AbstractYamlAble, YAMLABLE_PREFIX
13-
14-
from yamlable.yaml_objects import YamlObject2, ABCYAMLMeta, YAMLObjectMetaclassStrict
15-
16-
__all__ = ['base', 'main', 'yaml_objects',
17-
'AbstractYamlObject', 'NONE_IGNORE_CHECKS', 'Y', 'read_yaml_node_as_dict',
18-
'YamlCodec', 'register_yamlable_codec', 'yaml_info_decorate', 'yaml_info', 'YamlAble', 'YA',
19-
'AbstractYamlAble',
20-
'YAMLABLE_PREFIX', 'YamlObject2', 'ABCYAMLMeta', 'YAMLObjectMetaclassStrict'
21-
]

0 commit comments

Comments
 (0)