diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index 1693966..0000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: coverage - -on: - pull_request: - push: - branches: - - main - -jobs: - codecov: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Install poetry - uses: snok/install-poetry@v1.1.6 - with: - version: 1.2.0a1 - virtualenvs-in-project: true - - uses: actions/cache@v2 - id: cache-venv - with: - path: .venv - key: ${{ hashFiles('**/poetry.lock') }}-0 - - run: poetry install --no-interaction --no-root - if: steps.cache-venv.outputs.cache-hit != 'true' - - run: poetry install --no-interaction - - run: poetry run pytest -m "not unsupported" --cov-report=xml - - uses: codecov/codecov-action@v1 - with: - file: ./coverage.xml - fail_ci_if_error: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a0f602f..082066e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,48 +13,64 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - uses: actions/cache@v2 + id: cache-venv with: - path: | - ~/.cache/pip - ~/.cache/pre-commit - key: ${{ runner.os }}-pip-2 - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- - - run: python -m pip install pre-commit - - run: pre-commit run --all-files - get-python-versions: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - id: set-matrix - run: echo "::set-output name=matrix::$(python .github/scripts/get_python_versions.py)" - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} + path: .venv + key: venv-0 + - run: | + python -m venv .venv --upgrade-deps + source .venv/bin/activate + pip install pre-commit + if: steps.cache-venv.outputs.cache-hit != 'true' + - uses: actions/cache@v2 + id: pre-commit-cache + with: + path: ~/.cache/pre-commit + key: key-0 + - run: | + source .venv/bin/activate + pre-commit run --all-files + test: - needs: [ linting, get-python-versions ] runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ${{ fromJson(needs.get-python-versions.outputs.matrix) }} + python-version: [ "3.7", "3.8", "3.9", "3.10" ] steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} - - uses: snok/install-poetry@v1.1.6 + python-version: "${{ matrix.python-version }}" + - uses: actions/cache@v2 + id: poetry-cache + with: + path: ~/.local + key: key-0 + - uses: snok/install-poetry@v1 with: - version: 1.2.0a1 - virtualenvs-in-project: true + virtualenvs-create: false + version: 1.2.0a2 - uses: actions/cache@v2 id: cache-venv with: path: .venv - key: ${{ hashFiles('**/poetry.lock') }}-3 - - run: poetry install --no-interaction --no-root + key: ${{ hashFiles('**/poetry.lock') }}-0 + - run: | + python -m venv .venv + source .venv/bin/activate + pip install -U pip + poetry install --no-interaction --no-root if: steps.cache-venv.outputs.cache-hit != 'true' - - run: poetry install --no-interaction - - run: poetry run pytest -m "not unsupported" + - name: Run tests + run: | + source .venv/bin/activate + pytest -m "not unsupported" --cov-report=xml + coverage report + - uses: codecov/codecov-action@v2 + with: + file: ./coverage.xml + fail_ci_if_error: true + if: matrix.python-version == '3.10' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d9ca91..10b4d9f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/ambv/black - rev: 21.5b2 + rev: 21.10b0 hooks: - id: black args: [ "--quiet" ] @@ -35,16 +35,17 @@ repos: 'flake8-type-checking', ] - repo: https://github.com/asottile/pyupgrade - rev: v2.19.1 + rev: v2.29.0 hooks: - id: pyupgrade args: [ "--py36-plus", "--py37-plus",'--keep-runtime-typing' ] - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.10.0 hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.910-1 hooks: - id: mypy - additional_dependencies: [ pytest ] + additional_dependencies: + - types-requests diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index 45cc5c0..b026c61 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ # Sanity HTML Renderer for Python -> Repo is currently a work in progress. Not production ready. - This package generates HTML from [Portable Text](https://github.com/portabletext/portabletext). For the most part, it mirrors [Sanity's](https://www.sanity.io/) own [block-content-to-html](https://www.npmjs.com/package/%40sanity/block-content-to-html) NPM library. @@ -214,8 +212,9 @@ Blocks can optionally define a `style` tag. These styles are supported: ## Missing features -We plan to implement a default built-in serializer for the `image` type. -In the meantime, you should be able to serialize image types by passing a custom serializer. +For anyone interested, we would be happy to see a +default built-in serializer for the `image` type added. +In the meantime, users should be able to serialize image types by passing a custom serializer. ## Contributing diff --git a/poetry.lock b/poetry.lock index 00b8fcb..15e5029 100644 --- a/poetry.lock +++ b/poetry.lock @@ -55,7 +55,7 @@ pyflakes = ">=2.3.0,<2.4.0" [[package]] name = "importlib-metadata" -version = "4.5.0" +version = "4.8.1" description = "Read metadata from Python packages" category = "dev" optional = false @@ -67,7 +67,8 @@ zipp = ">=0.5" [package.extras] docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +perf = ["ipython"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] [[package]] name = "iniconfig" @@ -87,28 +88,29 @@ python-versions = "*" [[package]] name = "packaging" -version = "20.9" +version = "21.2" description = "Core utilities for Python packages" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" [package.dependencies] -pyparsing = ">=2.0.2" +pyparsing = ">=2.0.2,<3" [[package]] name = "pluggy" -version = "0.13.1" +version = "1.0.0" description = "plugin and hook calling mechanisms for python" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" [package.dependencies] importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} [package.extras] dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] [[package]] name = "py" @@ -144,7 +146,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "pytest" -version = "6.2.4" +version = "6.2.5" description = "pytest: simple powerful testing with Python" category = "dev" optional = false @@ -157,7 +159,7 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<1.0.0a1" +pluggy = ">=0.12,<2.0" py = ">=1.8.2" toml = "*" @@ -190,7 +192,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "typing-extensions" -version = "3.10.0.0" +version = "3.10.0.2" description = "Backported and Experimental Type Hints for Python 3.5+" category = "dev" optional = false @@ -198,7 +200,7 @@ python-versions = "*" [[package]] name = "zipp" -version = "3.4.1" +version = "3.6.0" description = "Backport of pathlib-compatible object wrapper for zip files" category = "dev" optional = false @@ -206,11 +208,11 @@ python-versions = ">=3.6" [package.extras] docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] [metadata] lock-version = "1.1" -python-versions = "^3.7" +python-versions = '^3.7' content-hash = "c641d950bccb6ffac52cf3fcd3571b51f5e31d4864c03e763fe2748919bf855b" [metadata.files] @@ -285,8 +287,8 @@ flake8 = [ {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.5.0-py3-none-any.whl", hash = "sha256:833b26fb89d5de469b24a390e9df088d4e52e4ba33b01dc5e0e4f41b81a16c00"}, - {file = "importlib_metadata-4.5.0.tar.gz", hash = "sha256:b142cc1dd1342f31ff04bb7d022492b09920cb64fed867cd3ea6f80fe3ebd139"}, + {file = "importlib_metadata-4.8.1-py3-none-any.whl", hash = "sha256:b618b6d2d5ffa2f16add5697cf57a46c76a56229b0ed1c438322e4e95645bd15"}, + {file = "importlib_metadata-4.8.1.tar.gz", hash = "sha256:f284b3e11256ad1e5d03ab86bb2ccd6f5339688ff17a4d797a0fe7df326f23b1"}, ] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, @@ -297,12 +299,12 @@ mccabe = [ {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] packaging = [ - {file = "packaging-20.9-py2.py3-none-any.whl", hash = "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a"}, - {file = "packaging-20.9.tar.gz", hash = "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5"}, + {file = "packaging-21.2-py3-none-any.whl", hash = "sha256:14317396d1e8cdb122989b916fa2c7e9ca8e2be9e8060a6eff75b6b7b4d8a7e0"}, + {file = "packaging-21.2.tar.gz", hash = "sha256:096d689d78ca690e4cd8a89568ba06d07ca097e3306a4381635073ca91479966"}, ] pluggy = [ - {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, - {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, ] py = [ {file = "py-1.10.0-py2.py3-none-any.whl", hash = "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a"}, @@ -321,8 +323,8 @@ pyparsing = [ {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ - {file = "pytest-6.2.4-py3-none-any.whl", hash = "sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890"}, - {file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"}, + {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, + {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, ] pytest-cov = [ {file = "pytest-cov-2.12.1.tar.gz", hash = "sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7"}, @@ -333,11 +335,11 @@ toml = [ {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] typing-extensions = [ - {file = "typing_extensions-3.10.0.0-py2-none-any.whl", hash = "sha256:0ac0f89795dd19de6b97debb0c6af1c70987fd80a2d62d1958f7e56fcc31b497"}, - {file = "typing_extensions-3.10.0.0-py3-none-any.whl", hash = "sha256:779383f6086d90c99ae41cf0ff39aac8a7937a9283ce0a414e5dd782f4c94a84"}, - {file = "typing_extensions-3.10.0.0.tar.gz", hash = "sha256:50b6f157849174217d0656f99dc82fe932884fb250826c18350e159ec6cdf342"}, + {file = "typing_extensions-3.10.0.2-py2-none-any.whl", hash = "sha256:d8226d10bc02a29bcc81df19a26e56a9647f8b0a6d4a83924139f4a8b01f17b7"}, + {file = "typing_extensions-3.10.0.2-py3-none-any.whl", hash = "sha256:f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34"}, + {file = "typing_extensions-3.10.0.2.tar.gz", hash = "sha256:49f75d16ff11f1cd258e1b988ccff82a3ca5570217d7ad8c5f48205dd99a677e"}, ] zipp = [ - {file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"}, - {file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"}, + {file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"}, + {file = "zipp-3.6.0.tar.gz", hash = "sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832"}, ] diff --git a/pyproject.toml b/pyproject.toml index 3f3f32a..15152a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'sanity-html' -version = '0.0.7' +version = '1.0.0' description = "HTML renderer for Sanity's Portable Text format" homepage = 'https://github.com/otovo/python-sanity-html' repository = 'https://github.com/otovo/python-sanity-html' @@ -8,11 +8,11 @@ authors = ['Kristian Klette '] maintainers = ['Sondre Lillebø Gundersen '] license = 'Apache2' readme = 'README.md' -keywords = ['Sanity', 'Portable text', 'HTML', 'Parsing'] +keywords = ['sanity', 'portable', 'text', 'html', 'parsing'] include = ['CHANGELOG.md'] packages = [{ include = 'sanity_html' }] classifiers = [ - 'Development Status :: 3 - Alpha', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Environment :: Web Environment', 'Operating System :: OS Independent', @@ -26,9 +26,6 @@ classifiers = [ 'Typing :: Typed', ] -[tool.poetry.urls] -'Changelog' = 'https://github.com/otovo/python-sanity-html/blob/main/CHANGELOG.md' - [tool.poetry.dependencies] python = '^3.7'