diff --git a/.gitignore b/.gitignore index 46e25ec..788ef56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,163 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] +*$py.class # C extensions *.so -# Packages -*.egg -*.egg-info -dist -build -.eggs -eggs -parts -bin -var -sdist -develop-eggs +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ .installed.cfg -lib -lib64 +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec # Installer logs pip-log.txt +pip-delete-this-directory.txt # Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ .coverage -.tox -.venv +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ # Translations *.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +.idea/ # Complexity output/*.html diff --git a/cookiecutter.json b/cookiecutter.json index 3dd12c3..f07e52f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -4,5 +4,10 @@ "project_name": "sphinxcontrib-{{ cookiecutter.package_name}}", "short_description": "A short description of the extension", "author_name": "Your name", - "author_email": "Your email" + "author_email": "Your email", + "home_page": "http://www.sphinx-doc.org/", + "version": "0.0.1", + "_copy_without_render": [ + "*.yaml" + ] } diff --git a/{{cookiecutter.project_name}}/.github/workflows/ci.yaml b/{{cookiecutter.project_name}}/.github/workflows/ci.yaml new file mode 100644 index 0000000..caef34e --- /dev/null +++ b/{{cookiecutter.project_name}}/.github/workflows/ci.yaml @@ -0,0 +1,54 @@ +name: Python CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + #---------------------------------------------- + # ----- install & configure poetry ----- + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: 1.6.1 + virtualenvs-create: true + virtualenvs-in-project: true + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root -E develop + + - name: Run tests with pytest + run: poetry run pytest + + - name: Run type checks with mypy + run: poetry run mypy sphinxcontrib + + - name: Run style checks + run: | + poetry run isort --check-only --diff sphinxcontrib tests + poetry run yapf --diff sphinxcontrib tests + poetry run flake8 sphinxcontrib tests diff --git a/{{cookiecutter.project_name}}/.pre-commit-config.yaml b/{{cookiecutter.project_name}}/.pre-commit-config.yaml new file mode 100644 index 0000000..a22f307 --- /dev/null +++ b/{{cookiecutter.project_name}}/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 # Use the latest version from the pre-commit-hooks repository + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/pycqa/flake8 + rev: 4.0.1 # Use the latest version of flake8 + hooks: + - id: flake8 + + - repo: https://github.com/pre-commit/mirrors-isort + rev: v5.10.1 # Use the latest version of isort + hooks: + - id: isort + + - repo: https://github.com/asottile/black + rev: 22.3.0 # Use the latest version of black + hooks: + - id: black + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.931 # Use the latest version of mypy + hooks: + - id: mypy diff --git a/{{cookiecutter.project_name}}/.travis.yml b/{{cookiecutter.project_name}}/.travis.yml deleted file mode 100644 index ed8810e..0000000 --- a/{{cookiecutter.project_name}}/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: python -sudo: false -cache: pip -python: -- 2.7 -- 3.4 -- 3.5 -- 3.6 -- pypy -install: -- pip install tox-travis -script: -- tox diff --git a/{{cookiecutter.project_name}}/README.md b/{{cookiecutter.project_name}}/README.md new file mode 100644 index 0000000..0f4059a --- /dev/null +++ b/{{cookiecutter.project_name}}/README.md @@ -0,0 +1,12 @@ +# {{ cookiecutter.project_name }} + +{{ cookiecutter.short_description}} + +## Overview + +Add a longer description here. + +## Links + +- Source: +- Bugs: diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst deleted file mode 100644 index 15f8793..0000000 --- a/{{cookiecutter.project_name}}/README.rst +++ /dev/null @@ -1,19 +0,0 @@ -{{ '=' * cookiecutter.project_name|length }} -{{ cookiecutter.project_name }} -{{ '=' * cookiecutter.project_name|length }} - -.. image:: https://travis-ci.org/{{ cookiecutter.github_org }}/{{ cookiecutter.project_name }}.svg?branch=master - :target: https://travis-ci.org/{{ cookiecutter.github_org }}/{{ cookiecutter.project_name }} - -{{ cookiecutter.short_description}} - -Overview --------- - -Add a longer description here. - -Links ------ - -- Source: https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_name }} -- Bugs: https://github.com/{{ cookiecutter.github_org }}/{{ cookiecutter.project_name }}/issues diff --git a/{{cookiecutter.project_name}}/pyproject.toml b/{{cookiecutter.project_name}}/pyproject.toml new file mode 100644 index 0000000..830fbe5 --- /dev/null +++ b/{{cookiecutter.project_name}}/pyproject.toml @@ -0,0 +1,61 @@ +[tool.poetry] +name = "{{ cookiecutter.project_name }}" +version = "{{cookiecutter.version}}" +description = "{{ cookiecutter.short_description }}" +authors = ["{{ cookiecutter.author_name }} <{{ cookiecutter.author_email }}>"] +homepage = "{{ cookiecutter.home_page }}" +license = "BSD" # Replace with your project's license, if different +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Console", + "Environment :: Web Environment", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Documentation", + "Topic :: Documentation :: Sphinx", + "Topic :: Utilities" +] + + +[tool.poetry.dependencies] +python = "^3.6" +pbr = "^5.5.1" + +pytest = {version="*", optional=true} +sphinx = {version="*", optional=true} +mypy = {version="*", optional=true} +flake8 ={version="*", optional=true} + +[tool.poetry.extras] +develop = [ + "pytest", + "sphinx", + "mypy", + "flake8" +] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.mypy] +python_version = "3.8" +show_column_numbers = true +show_error_context = true +ignore_missing_imports = true +follow_imports = "skip" +incremental = true +check_untyped_defs = true +warn_unused_ignores = true + +[tool.flake8] +show-source = true +builtins = "unicode" diff --git a/{{cookiecutter.project_name}}/requirements.txt b/{{cookiecutter.project_name}}/requirements.txt deleted file mode 100644 index 1d45dc6..0000000 --- a/{{cookiecutter.project_name}}/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pbr diff --git a/{{cookiecutter.project_name}}/setup.cfg b/{{cookiecutter.project_name}}/setup.cfg deleted file mode 100644 index 96d00f1..0000000 --- a/{{cookiecutter.project_name}}/setup.cfg +++ /dev/null @@ -1,45 +0,0 @@ -[metadata] -name = {{ cookiecutter.project_name }} -summary = {{ cookiecutter.short_description }} -description-file = - README.rst -author = {{ cookiecutter.author_name }} -author-email = {{ cookiecutter.author_email }} -home-page = http://www.sphinx-doc.org/ -classifier = - Development Status :: 3 - Alpha - Environment :: Console - Environment :: Web Environment - Framework :: Sphinx :: Extension - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Documentation - Topic :: Documentation :: Sphinx - Topic :: Utilities - -[files] -packages = - sphinxcontrib -namespace_packages = - sphinxcontrib - -[mypy] -python_version = 3.8 -show_column_numbers = True -show_error_context = True -ignore_missing_imports = True -follow_imports = skip -incremental = True -check_untyped_defs = True -warn_unused_ignores = True - -[flake8] -show-source = True -builtins = unicode diff --git a/{{cookiecutter.project_name}}/setup.py b/{{cookiecutter.project_name}}/setup.py deleted file mode 100644 index f7fce87..0000000 --- a/{{cookiecutter.project_name}}/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -import setuptools - - -setuptools.setup( - setup_requires=['pbr'], - pbr=True, -) diff --git a/{{cookiecutter.project_name}}/test-requirements.txt b/{{cookiecutter.project_name}}/test-requirements.txt deleted file mode 100644 index 55ff9de..0000000 --- a/{{cookiecutter.project_name}}/test-requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -pytest -sphinx diff --git a/{{cookiecutter.project_name}}/tox.ini b/{{cookiecutter.project_name}}/tox.ini deleted file mode 100644 index 5acb1a6..0000000 --- a/{{cookiecutter.project_name}}/tox.ini +++ /dev/null @@ -1,32 +0,0 @@ -[tox] -minversion = 2.0 -envlist = py{34,35,36,py},style - -[testenv] -deps = -r{toxinidir}/test-requirements.txt -commands= - pytest - -[testenv:mypy] -description = - Run type checks. -deps = - mypy -commands= - mypy sphinxcontrib - -[testenv:style] -description = - Run style checks. -deps = - flake8 - isort - yapf -commands = - isort -rc -c -df sphinxcontrib tests - yapf -rd sphinxcontrib tests - flake8 sphinxcontrib tests setup.py - -[travis] -python = - 3.6: py36, mypy, style