Skip to content

Commit

Permalink
🔧 MAINTAIN: Move from setuptools to flit for package build (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Apr 20, 2022
1 parent 6a412a1 commit 43bb2cc
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 156 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Build package
- name: install flit
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}
pip install flit~=3.4
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
18 changes: 3 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,20 @@ exclude: >
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.2.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/mgedmin/check-manifest
rev: "0.47"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools>=46.4.0]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.3.0
hooks:
- id: black

Expand All @@ -42,16 +35,11 @@ repos:
additional_dependencies: [flake8-bugbear==21.3.1]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v0.942
hooks:
- id: mypy
additional_dependencies: []

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt

- repo: local
hooks:
- id: css
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

python:
version: "3"
version: "3.8"
install:
- method: pip
path: .
Expand Down
30 changes: 0 additions & 30 deletions MANIFEST.in

This file was deleted.

67 changes: 65 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,70 @@
[build-system]
requires = ["setuptools>=46.4.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "sphinx_design"
dynamic = ["version"]
description = "A sphinx extension for designing beautiful, view size responsive web components."
authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}]
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Sphinx :: Extension",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Text Processing :: Markup",
"Topic :: Text Processing :: Markup :: Markdown",
"Topic :: Text Processing :: Markup :: reStructuredText",
]
keywords = ["sphinx", "extension", "material design", "web components"]
requires-python = ">=3.7"
dependencies = ["sphinx>=3,<5"]

[project.urls]
Homepage = "https://github.com/executablebooks/sphinx-design"
Documentation = "https://sphinx-design.readthedocs.io"

[project.optional-dependencies]
code_style = ["pre-commit~=2.12"]
rtd = ["myst-parser~=0.17.0"]
testing = [
"myst-parser~=0.17.0",
"pytest~=6.2",
"pytest-cov",
"pytest-regressions",
]
theme_furo = ["furo==2022.04.07"]
theme_pydata = ["pydata-sphinx-theme~=0.8.1"]
theme_rtd = ["sphinx-rtd-theme~=1.0"]
theme_sbt = ["sphinx-book-theme~=0.3.0"]

[tool.flit.sdist]
exclude = [
"docs/",
"style/",
"tests/",
]

[tool.mypy]
show_error_codes = true
warn_unused_ignores = true
warn_redundant_casts = true
no_implicit_optional = true
strict_equality = true

[[tool.mypy.overrides]]
module = ["docutils.*"]
ignore_missing_imports = true

[tool.isort]
profile = "black"
src_paths = ["sphinx_design", "tests"]
force_sort_within_sections = true
74 changes: 0 additions & 74 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

7 changes: 1 addition & 6 deletions sphinx_design/extension.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import hashlib
import importlib.resources as resources
from pathlib import Path

try:
import importlib.resources as resources
except ImportError:
# python < 3.7
import importlib_resources as resources # type: ignore[no-redef]

from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.application import Sphinx
Expand Down
9 changes: 2 additions & 7 deletions sphinx_design/icons.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
from functools import lru_cache
import importlib.resources as resources
import json
import re
from functools import lru_cache
from typing import Any, Dict, List, Optional, Sequence, Tuple

try:
import importlib.resources as resources
except ImportError:
# python < 3.7
import importlib_resources as resources # type: ignore[no-redef]

from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.application import Sphinx
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from pathlib import Path
from typing import Any, Dict, Optional

import pytest
from docutils import nodes
import pytest
from sphinx.testing.path import path as sphinx_path
from sphinx.testing.util import SphinxTestApp

Expand Down
4 changes: 0 additions & 4 deletions tests/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def test_snippets_rst(
write_assets(builder.src_path)
builder.build()
pformat = builder.get_doctree("index").pformat()
# fixed in https://github.com/executablebooks/MyST-Parser/pull/465
pformat = pformat.replace('<bullet_list bullet="-">', "<bullet_list>")
file_regression.check(
pformat,
basename=f"snippet_pre_{path.name[:-len(path.suffix)]}",
Expand Down Expand Up @@ -81,8 +79,6 @@ def test_snippets_rst_post(
write_assets(builder.src_path)
builder.build()
pformat = builder.get_doctree("index", post_transforms=True).pformat()
# fixed in https://github.com/executablebooks/MyST-Parser/pull/465
pformat = pformat.replace('<bullet_list bullet="-">', "<bullet_list>")
file_regression.check(
pformat,
basename=f"snippet_post_{path.name[:-len(path.suffix)]}",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snippets/snippet_post_icon-material-design.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<section ids="heading" names="heading">
<title>
Heading
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
A regular icon:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snippets/snippet_pre_icon-material-design.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<section ids="heading" names="heading">
<title>
Heading
<bullet_list>
<bullet_list bullet="-">
<list_item>
<paragraph>
A regular icon:
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ commands =
--re-ignore docs/_build/.* \
--port 0 --open-browser \
-n -b {posargs:html} docs/ docs/_build/{posargs:html}

[flake8]
max-line-length = 100
extend-ignore = E203

0 comments on commit 43bb2cc

Please sign in to comment.