Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Initial migration to the present 🏃 #25

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 145 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
54 changes: 54 additions & 0 deletions {{cookiecutter.project_name}}/.github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions {{cookiecutter.project_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the latest (none of these are). Could you bump?

hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931 # Use the latest version of mypy
hooks:
- id: mypy
13 changes: 0 additions & 13 deletions {{cookiecutter.project_name}}/.travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions {{cookiecutter.project_name}}/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# {{ 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 />
19 changes: 0 additions & 19 deletions {{cookiecutter.project_name}}/README.rst

This file was deleted.

61 changes: 61 additions & 0 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't match the CI configuration. Could you update?

"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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.8?

pbr = "^5.5.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, pbr probably isn't the best horse to back now. Could we use setuptools here?

Later actually you us poetry so this should be wholly unnecessary?


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop this. I suspect mypy is rarely used in most sphinx extensions.


[tool.flake8]
show-source = true
builtins = "unicode"
1 change: 0 additions & 1 deletion {{cookiecutter.project_name}}/requirements.txt

This file was deleted.

Loading