diff --git a/.gitignore b/.gitignore index 1521c8b..6b47007 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -dist +/build +/dist +/*.egg-info +/stack_data/version.py +*.pyc +*.pyo +__pycache__ diff --git a/.travis.yml b/.travis.yml index 482e509..9c41082 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,18 @@ env: - STACK_DATA_SLOW_TESTS=1 - COVERALLS_PARALLEL=true +before_install: + - pip install --upgrade coveralls setuptools>=44 setuptools_scm>=3.4.3 pep517 + install: - - pip install coveralls - - pip install .[tests] + - python3 -m pep517.build -b . + - ls -l + - export WHLNAME=./dist/stack_data-0.CI-py3-none-any.whl + - mv ./dist/*.whl $WHLNAME + - pip install --upgrade "$WHLNAME[tests]" script: - - coverage run --include='stack_data/*' -m pytest + - coverage run --branch --include='stack_data/*' -m pytest --junitxml=./rspec.xml - coverage report -m after_success: diff --git a/make_release.sh b/make_release.sh new file mode 100755 index 0000000..66a64cd --- /dev/null +++ b/make_release.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -eux; + +if [ -z "${1+x}" ]; then + set +x + echo Provide a version argument + echo "${0} .."; + exit 1; +else + if [[ ${1} =~ ^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?$ ]]; then + :; + else + echo "Not a valid release tag."; + exit 1; + fi; +fi; + +export TAG="v${1}"; +git tag "${TAG}"; +git push origin master "${TAG}"; +rm -rf ./build ./dist; +python3 -m pep517.build -b .; +twine upload ./dist/*.whl; diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8288d78 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] +requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +write_to = "stack_data/version.py" +write_to_template = "__version__ = '{version}'\n" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..ede00ad --- /dev/null +++ b/setup.cfg @@ -0,0 +1,28 @@ +[metadata] +name = stack_data +author = Alex Hall +author_email = alex.mojaki@gmail.com +license = MIT +description = Extract data from python stack frames and tracebacks for informative displays +url = http://github.com/alexmojaki/stack_data +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Intended Audience :: Developers + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Topic :: Software Development :: Debuggers + +[options] +packages = stack_data +install_requires = executing; asttokens; pure_eval +setup_requires = setuptools>=44; wheel; setuptools_scm[toml]>=3.4.3 +include_package_data = True +tests_require = pytest; typeguard; pygments + +[options.extras_require] +tests = pytest; typeguard; pygments; pep517; littleutils diff --git a/setup.py b/setup.py index 4310ddd..7f1a176 100644 --- a/setup.py +++ b/setup.py @@ -1,63 +1,4 @@ -import os -import re -from io import open - from setuptools import setup -package = 'stack_data' -dirname = os.path.dirname(__file__) - - -def file_to_string(*path): - with open(os.path.join(dirname, *path), encoding='utf8') as f: - return f.read() - - -# __version__ is defined inside the package, but we can't import -# it because it imports dependencies which may not be installed yet, -# so we extract it manually -contents = file_to_string(package, '__init__.py') -__version__ = re.search(r"__version__ = '([.\d]+)'", contents).group(1) - -install_requires = [ - 'executing', - 'asttokens', - 'pure_eval', -] - - -tests_require = [ - 'pytest', - 'typeguard', - 'pygments', - 'littleutils', -] - -setup( - name=package, - version=__version__, - description="Extract data from python stack frames and tracebacks for informative displays", - # long_description=file_to_string('README.md'), - # long_description_content_type='text/markdown', - url='http://github.com/alexmojaki/' + package, - author='Alex Hall', - author_email='alex.mojaki@gmail.com', - license='MIT', - include_package_data=True, - packages=[package], - install_requires=install_requires, - tests_require=tests_require, - extras_require={ - 'tests': tests_require, - }, - classifiers=[ - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Topic :: Software Development :: Debuggers', - ], -) +if __name__ == "__main__": + setup() diff --git a/stack_data/__init__.py b/stack_data/__init__.py index 4aa21f2..e9bc429 100644 --- a/stack_data/__init__.py +++ b/stack_data/__init__.py @@ -1,4 +1,9 @@ -__version__ = '0.0.6' - -from .core import Source, FrameInfo, markers_from_ranges, Options, LINE_GAP, Line, Variable, RangeInLine, RepeatedFrames, MarkerInLine, style_with_executing_node +from .core import Source, FrameInfo, markers_from_ranges, Options, LINE_GAP, Line, Variable, RangeInLine, \ + RepeatedFrames, MarkerInLine, style_with_executing_node from .formatting import Formatter + +try: + from .version import __version__ +except ImportError: + # version.py is auto-generated with the git tag when building + __version__ = "???"