Skip to content
Merged

Docs #23

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
52 changes: 45 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Validations

on:
push:
Expand All @@ -9,8 +9,7 @@ on:
- "*"

jobs:
build:

tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -28,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build tox tox-gh-actions twine
python -m pip install tox tox-gh-actions

- name: Test with tox
run: tox
Expand All @@ -38,7 +37,46 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Build wheel
build_package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Build wheel and sdist
run: |
python -m build --wheel --sdist
twine check dist/*
python -m build --sdist --wheel --outdir dist/

- name: Check packages
run: twine check dist/*

docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions

- name: Build doc
run: tox -e docs
2 changes: 1 addition & 1 deletion .github/workflows/upload-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to https://test.pypi.org/
name: Publish package

on:
push:
Expand Down
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-20.04
tools:
python: "3"

sphinx:
builder: dirhtml
configuration: docs/conf.py

python:
install:
- requirements: requirements-doc.txt
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Change `README.rst` to `README.md`.
- Replace `setup.py` with `pyproject.toml`.
- Renamed `chunks.py` to `raw_io_chunk.py`.
- Changed Sphinx doc to use Markdown with the [Myst parser](https://myst-parser.readthedocs.io/en/latest/).

### Fixed

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ with open("test_file", "rb") as file_handle:

Amazing, right?

## Why?

While writing a parser I found this class to be somewhat useful, around 7 years ago.

While today I don't really see it today, I decided to clean it up and released it in case it's useful for someone.

## Install

Use `pip`:
Expand All @@ -44,7 +50,7 @@ $ pip install io-chunks

## Documentation

Use the source, Luke!
You can read it at [readthedocs](https://python-io-chunks.readthedocs.io/en/latest/).

## Run the tests

Expand Down
Empty file added docs/_static/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys

sys.path.insert(0, os.path.abspath(".."))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "io-chunks"
copyright = "2022, David Caro Martínez <terseus@fastmail.com>"
author = "David Caro Martínez <terseus@fastmail.com>"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"myst_parser",
"sphinx.ext.autodoc",
]
source_suffix = [".md"]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
16 changes: 16 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
% io-chunks documentation master file, created by
% sphinx-quickstart on Sat Nov 12 10:42:33 2022.
% You can adapt this file completely to your liking, but it should at least
% contain the root `toctree` directive.

```{include} ../README.md
```

# API

```{eval-rst}
.. automodule:: io_chunks
:members:
:special-members: __init__
:inherited-members:
```
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
3 changes: 3 additions & 0 deletions requirements-doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
myst-parser
sphinx-rtd-theme
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ depends =
{py37, py38, py39, py310, py311}: cov-clean
cov-report: py37, py38, py39, py310, py311

[testenv:docs]
changedir = docs
deps = -rrequirements-doc.txt
skip_install = true
commands = sphinx-build -W -b html -d _build/doctrees . _build/html

[testenv:cov-report]
# [toml] required for pyproject.toml support
deps = coverage[toml]
Expand Down