From 2bcf97a14092cf2a6eea3650bc1b3e7c61972ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 17 Jul 2020 19:32:38 +0300 Subject: [PATCH] Update skel. --- .cookiecutterrc | 14 +++++++--- .editorconfig | 3 +++ .pre-commit-config.yaml | 20 +++++++++++++++ .readthedocs.yml | 10 ++++++++ CONTRIBUTING.rst | 2 +- README.rst | 11 ++++---- ci/bootstrap.py | 2 +- ci/requirements.txt | 1 + ci/templates/.appveyor.yml | 19 +++----------- ci/templates/.travis.yml | 9 ++++--- docs/conf.py | 11 +++----- pyproject.toml | 6 ++++- setup.cfg | 6 +++-- setup.py | 17 +++++++------ tox.ini | 52 ++++++++++++++++---------------------- 15 files changed, 105 insertions(+), 78 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 .readthedocs.yml mode change 100644 => 100755 setup.py diff --git a/.cookiecutterrc b/.cookiecutterrc index cd17391..00841a9 100644 --- a/.cookiecutterrc +++ b/.cookiecutterrc @@ -4,6 +4,7 @@ cookiecutter: _extensions: - jinja2_time.TimeExtension _template: /home/ionel/open-source/cookiecutter-pylibrary + allow_tests_inside_package: no appveyor: yes c_extension_function: '-' c_extension_module: '-' @@ -26,10 +27,14 @@ cookiecutter: license: BSD 2-Clause License linter: flake8 package_name: lazy_object_proxy + pre_commit: yes project_name: lazy-object-proxy project_short_description: A fast and thorough lazy object proxy. - release_date: '2019-05-10' - repo_hosting: github + pypi_badge: yes + pypi_disable_upload: no + release_date: '2020-06-05' + repo_hosting: github.com + repo_hosting_domain: github.com repo_name: python-lazy-object-proxy repo_username: ionelmc requiresio: yes @@ -37,6 +42,7 @@ cookiecutter: setup_py_uses_setuptools_scm: yes setup_py_uses_test_runner: no sphinx_docs: yes + sphinx_docs_hosting: https://python-lazy-object-proxy.readthedocs.io/ sphinx_doctest: no sphinx_theme: sphinx-py3doc-enhanced-theme test_matrix_configurator: no @@ -44,7 +50,7 @@ cookiecutter: test_runner: pytest travis: yes travis_osx: yes - version: 1.4.1 + version: 1.5.0 website: https://blog.ionelmc.ro year_from: '2014' - year_to: '2019' + year_to: '2020' diff --git a/.editorconfig b/.editorconfig index 6eb7567..a9c7977 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,6 @@ charset = utf-8 [*.{bat,cmd,ps1}] end_of_line = crlf + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8de50ba --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +# To install the git pre-commit hook run: +# pre-commit install +# To update the pre-commit hooks run: +# pre-commit install-hooks +exclude: '^(.tox|ci/templates|.bumpversion.cfg)(/|$)' +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: master + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: debug-statements + - repo: https://github.com/timothycrosley/isort + rev: master + hooks: + - id: isort + - repo: https://gitlab.com/pycqa/flake8 + rev: master + hooks: + - id: flake8 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..59ff5c0 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,10 @@ +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +version: 2 +sphinx: + configuration: docs/conf.py +formats: all +python: + install: + - requirements: docs/requirements.txt + - method: pip + path: . diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 5473aa1..442a323 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -41,7 +41,7 @@ To set up `python-lazy-object-proxy` for local development: (look for the "Fork" button). 2. Clone your fork locally:: - git clone git@github.com:ionelmc/python-lazy-object-proxy.git + git clone git@github.com:YOURGITHUBNAME/python-lazy-object-proxy.git 3. Create a branch for local development:: diff --git a/README.rst b/README.rst index 95c3d38..1a68d49 100644 --- a/README.rst +++ b/README.rst @@ -35,7 +35,7 @@ Overview :alt: Coverage Status :target: https://coveralls.io/r/ionelmc/python-lazy-object-proxy -.. |codecov| image:: https://codecov.io/github/ionelmc/python-lazy-object-proxy/coverage.svg?branch=master +.. |codecov| image:: https://codecov.io/gh/ionelmc/python-lazy-object-proxy/branch/master/graphs/badge.svg?branch=master :alt: Coverage Status :target: https://codecov.io/github/ionelmc/python-lazy-object-proxy @@ -43,10 +43,6 @@ Overview :alt: PyPI Package latest release :target: https://pypi.org/project/lazy-object-proxy -.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-lazy-object-proxy/v1.5.0.svg - :alt: Commits since latest release - :target: https://github.com/ionelmc/python-lazy-object-proxy/compare/v1.5.0...master - .. |wheel| image:: https://img.shields.io/pypi/wheel/lazy-object-proxy.svg :alt: PyPI Wheel :target: https://pypi.org/project/lazy-object-proxy @@ -59,6 +55,11 @@ Overview :alt: Supported implementations :target: https://pypi.org/project/lazy-object-proxy +.. |commits-since| image:: https://img.shields.io/github/commits-since/ionelmc/python-lazy-object-proxy/v1.5.0.svg + :alt: Commits since latest release + :target: https://github.com/ionelmc/python-lazy-object-proxy/compare/v1.5.0...master + + .. end-badges diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 7e10e83..6f3cf58 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -47,6 +47,7 @@ def exec_in_env(): print("+ exec", python_executable, __file__, "--no-env") os.execv(python_executable, [python_executable, __file__, "--no-env"]) + def main(): import jinja2 @@ -87,4 +88,3 @@ def main(): else: print("Unexpected arguments {0}".format(args), file=sys.stderr) sys.exit(1) - diff --git a/ci/requirements.txt b/ci/requirements.txt index 1c8d385..b2a21e5 100644 --- a/ci/requirements.txt +++ b/ci/requirements.txt @@ -1,3 +1,4 @@ virtualenv>=16.6.0 pip>=19.1.1 setuptools>=18.0.1 +six>=1.12.0 diff --git a/ci/templates/.appveyor.yml b/ci/templates/.appveyor.yml index 6347b5d..69d2c19 100644 --- a/ci/templates/.appveyor.yml +++ b/ci/templates/.appveyor.yml @@ -13,8 +13,7 @@ environment: PYTHON_ARCH: '32' {% for env in tox_environments %} {% if env.startswith(('py2', 'py3')) %} - - TOXENV: {{ env }}{% if env.endswith('-cover') %},codecov,coveralls{% endif %} - + - TOXENV: {{ env }}{% if env.endswith('-cover') %},codecov,coveralls{% endif %}{{ "" }} TOXPYTHON: C:\Python{{ env[2:4] }}\python.exe PYTHON_HOME: C:\Python{{ env[2:4] }} PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' @@ -22,8 +21,7 @@ environment: {% if 'nocov' in env %} WHEEL_PATH: .tox/dist {% endif %} - - TOXENV: {{ env }}{% if env.endswith('-cover') %},codecov,coveralls{% endif %} - + - TOXENV: {{ env }}{% if env.endswith('-cover') %},codecov,coveralls{% endif %}{{ "" }} TOXPYTHON: C:\Python{{ env[2:4] }}-x64\python.exe PYTHON_HOME: C:\Python{{ env[2:4] }}-x64 PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' @@ -31,23 +29,14 @@ environment: {% if 'nocov' in env %} WHEEL_PATH: .tox/dist {% endif %} -{% if env.startswith(('py2', 'py34')) %} - WINDOWS_SDK_VERSION: v7.{{ '1' if env.startswith('py3') else '0' }} +{% if env.startswith('py2') %} + WINDOWS_SDK_VERSION: v7.0 {% endif %} {% endif %}{% endfor %} init: - ps: echo $env:TOXENV - ps: ls C:\Python* install: - - ps: | - Set-PSDebug -Trace 1 - if ($Env:TOXENV.StartsWith("py38")) { - if ($Env:PYTHON_ARCH -eq "64") { - iex "choco install python3 --version=3.8 --no-progress --params /InstallDir:$Env:PYTHON_HOME" - } else { - iex "choco install python3 --version=3.8 --no-progress --params /InstallDir:$Env:PYTHON_HOME --x86" - } - } - '%PYTHON_HOME%\python -mpip install --progress-bar=off twine tox-wheel -rci/requirements.txt' - '%PYTHON_HOME%\Scripts\virtualenv --version' - '%PYTHON_HOME%\Scripts\easy_install --version' diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml index 167c961..1b1adbc 100644 --- a/ci/templates/.travis.yml +++ b/ci/templates/.travis.yml @@ -3,7 +3,9 @@ dist: xenial cache: false env: global: + - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - SEGFAULT_SIGNALS=all + - LANG=en_US.UTF-8 - TWINE_USERNAME=ionel matrix: include: @@ -14,8 +16,9 @@ matrix: env: - TOXENV=docs {%- for env in tox_environments %}{{ '' }} -{%- if 'py37' in env or 'py27' in env %}{{ '' }} +{%- if 'py38' in env or 'py27' in env %}{{ '' }} - os: osx + osx_image: xcode11 language: generic env: - TOXENV={{ env }} @@ -89,8 +92,8 @@ script: fi ) after_failure: - - travis_wait 15 more .tox/log/* | cat - - travis_wait 15 more .tox/*/log/* | cat + - more .tox/log/* | cat + - more .tox/*/log/* | cat notifications: email: on_success: never diff --git a/docs/conf.py b/docs/conf.py index bb85e6e..3b8e352 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import os import traceback +import sphinx_py3doc_enhanced_theme + extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', @@ -15,15 +16,10 @@ 'sphinx.ext.todo', 'sphinx.ext.viewcode', ] -if os.getenv('SPELLCHECK'): - extensions += 'sphinxcontrib.spelling', - spelling_show_suggestions = True - spelling_lang = 'en_US' - source_suffix = '.rst' master_doc = 'index' project = 'lazy-object-proxy' -year = '2014-2019' +year = '2014-2020' author = 'Ionel Cristian Mărieș' copyright = '{0}, {1}'.format(year, author) try: @@ -39,7 +35,6 @@ 'issue': ('https://github.com/ionelmc/python-lazy-object-proxy/issues/%s', '#'), 'pr': ('https://github.com/ionelmc/python-lazy-object-proxy/pull/%s', 'PR #'), } -import sphinx_py3doc_enhanced_theme html_theme = "sphinx_py3doc_enhanced_theme" html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()] html_theme_options = { diff --git a/pyproject.toml b/pyproject.toml index 0e3b770..23cf6d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,6 @@ [build-system] -requires = ["setuptools>=30.3.0", "wheel", "setuptools_scm>=3.3.1"] +requires = [ + "setuptools>=30.3.0", + "wheel", + "setuptools_scm>=3.3.1", +] diff --git a/setup.cfg b/setup.cfg index 4868ee5..cb7322c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,7 +4,7 @@ setup_requires = [flake8] max-line-length = 140 -exclude = */migrations/* +exclude = .tox,.eggs,ci/templates [tool:pytest] # If a pytest section is found in one of the possible config files @@ -36,6 +36,8 @@ addopts = --doctest-modules --doctest-glob=\*.rst --tb=short +testpaths = + tests [tool:isort] force_single_line = True @@ -44,4 +46,4 @@ known_first_party = lazy_object_proxy default_section = THIRDPARTY forced_separate = test_lazy_object_proxy not_skip = __init__.py -skip = migrations +skip = .tox,.eggs,ci/templates diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 178a6d9..a314612 --- a/setup.py +++ b/setup.py @@ -31,12 +31,13 @@ def read(*names, **kwargs): # Enable code coverage for C code: we can't use CFLAGS=-coverage in tox.ini, since that may mess with compiling # dependencies (e.g. numpy). Therefore we set SETUPPY_CFLAGS=-coverage in tox.ini and copy it to CFLAGS here (after # deps have been safely installed). -if 'TOXENV' in os.environ and os.environ.get('SETUPPY_GCOV') == 'enabled' and platform.system() == 'Linux': - CFLAGS = ['-fprofile-arcs', '-ftest-coverage'] - LFLAGS = ['-lgcov'] +if 'TOX_ENV_NAME' in os.environ and os.environ.get('SETUP_PY_EXT_COVERAGE') == 'yes' and platform.system() == 'Linux': + CFLAGS = os.environ['CFLAGS'] = '-fprofile-arcs -ftest-coverage' + LFLAGS = os.environ['LFLAGS'] = '-lgcov' else: - CFLAGS = [] - LFLAGS = [] + CFLAGS = '' + LFLAGS = '' + class optional_build_ext(build_ext): @@ -115,7 +116,7 @@ def _unavailable(self, e): keywords=[ # eg: 'keyword1', 'keyword2', 'keyword3', ], - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', install_requires=[ # eg: 'aspectlib==1.1.1', 'six>=1.7', ], @@ -129,8 +130,8 @@ def _unavailable(self, e): Extension( splitext(relpath(path, 'src').replace(os.sep, '.'))[0], sources=[path], - extra_compile_args=CFLAGS, - extra_link_args=LFLAGS, + extra_compile_args=CFLAGS.split(), + extra_link_args=LFLAGS.split(), include_dirs=[dirname(path)] ) for root, _, _ in os.walk('src') diff --git a/tox.ini b/tox.ini index c58cfe0..8599ce4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,13 @@ +[testenv:bootstrap] +deps = + jinja2 + matrix + tox +skip_install = true +commands = + python ci/bootstrap.py --no-env +passenv = + * ; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist [tox] @@ -14,16 +24,15 @@ basepython = pypy: {env:TOXPYTHON:pypy} pypy3: {env:TOXPYTHON:pypy3} py27: {env:TOXPYTHON:python2.7} - py34: {env:TOXPYTHON:python3.4} py35: {env:TOXPYTHON:python3.5} - {py36,docs,spell}: {env:TOXPYTHON:python3.6} + py36: {env:TOXPYTHON:python3.6} py37: {env:TOXPYTHON:python3.7} py38: {env:TOXPYTHON:python3.8} - {bootstrap,clean,check,report,codecov,coveralls,extension-coveralls}: {env:TOXPYTHON:python3} + {bootstrap,clean,check,report,docs,codecov,coveralls,extension-coveralls}: {env:TOXPYTHON:python3} setenv = PYTHONPATH={toxinidir}/tests PYTHONUNBUFFERED=yes - cover: SETUPPY_GCOV=enabled + cover: SETUP_PY_EXT_COVERAGE=yes passenv = * usedevelop = @@ -44,14 +53,6 @@ commands = nocov: {posargs:pytest -vv --ignore=src} cover: {posargs:pytest --cov --cov-report=term-missing -vv} -[testenv:bootstrap] -deps = - jinja2 - matrix -skip_install = true -commands = - python ci/bootstrap.py - [testenv:check] deps = docutils @@ -59,29 +60,19 @@ deps = readme-renderer pygments isort + setuptools-scm skip_install = true commands = python setup.py check --strict --metadata --restructuredtext - flake8 src tests setup.py - isort --verbose --check-only --diff --recursive src tests setup.py - -[testenv:spell] -setenv = - SPELLCHECK=1 -commands = - sphinx-build -b spelling docs dist/docs -skip_install = true -deps = - -r{toxinidir}/docs/requirements.txt - sphinxcontrib-spelling - pyenchant + flake8 + isort --verbose --check-only --diff --recursive [testenv:docs] -deps = - -r{toxinidir}/docs/requirements.txt usedevelop = true install_command = python -m pip install --no-use-pep517 {opts} {packages} +deps = + -r{toxinidir}/docs/requirements.txt commands = sphinx-build {posargs:-E} -b html docs dist/docs sphinx-build -b linkcheck docs dist/docs @@ -107,9 +98,9 @@ skip_install = true commands = codecov --gcov-root=. [] - [testenv:report] -deps = coverage +deps = + coverage skip_install = true commands = coverage report @@ -118,4 +109,5 @@ commands = [testenv:clean] commands = coverage erase skip_install = true -deps = coverage +deps = + coverage