diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1349834..9d6c2f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,7 +11,7 @@ jobs: runs-on: "${{ matrix.os }}" strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.9", "3.10"] os: [windows-latest, ubuntu-latest, macos-latest] env: OS: ${{ matrix.os }} @@ -51,7 +51,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.12 - name: Install dependencies run: | python -m pip install --upgrade pip poetry @@ -78,7 +78,7 @@ jobs: poetry config virtualenvs.create false --local poetry install - name: Build docs - run: cd docs && make html + run: pip install sphinx && pip install myst_parser && cd docs && make html - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: diff --git a/docs/Makefile b/docs/Makefile index 92dd33a..4825263 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -8,13 +8,21 @@ SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = _build +# Function to check if sphinx-build exists +check_sphinx: + @command -v $(SPHINXBUILD) >/dev/null 2>&1 || { \ + echo "Error: $(SPHINXBUILD) not found."; \ + echo "You can check your Python installation with: whereis python"; \ + exit 1; \ + } + # Put it first so that "make" without argument is like "make help". -help: +help: check_sphinx @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +.PHONY: help Makefile check_sphinx # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile +%: Makefile check_sphinx @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/source/guide.md b/docs/source/guide.md deleted file mode 100644 index f69ca3e..0000000 --- a/docs/source/guide.md +++ /dev/null @@ -1,22 +0,0 @@ -# DesktopTools -python http file server - -## Install & Run -### Source -```bash -# TODO -``` - -### Pip -Make sure you have pip installed. - -```bash -pip install DesktopTools -``` -#### Local -``` -git clone git@github.com:xmsociety/DesktopTools.git -cd DesktopTools -pip install . -DesktopTools -``` diff --git a/docs/source/index.md b/docs/source/index.md index f69ca3e..309da0a 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -1,17 +1,19 @@ # DesktopTools -python http file server +python desktop tools ## Install & Run ### Source ```bash -# TODO +git clone git@github.com:xmsociety/DesktopTools.git +cd DesktopTools +pip install . ``` ### Pip Make sure you have pip installed. ```bash -pip install DesktopTools +pip install DesktopTools[ui] ``` #### Local ``` diff --git a/docs/source/server.md b/docs/source/server.md deleted file mode 100644 index 1840b43..0000000 --- a/docs/source/server.md +++ /dev/null @@ -1,91 +0,0 @@ -# API - -```python -import email.message -import io -import socketserver -import sys -from _typeshed import StrPath, SupportsRead, SupportsWrite -from collections.abc import Mapping, Sequence -from typing import Any, AnyStr, BinaryIO, ClassVar - -if sys.version_info >= (3, 7): - __all__ = ["HTTPServer", "ThreadingHTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"] -else: - __all__ = ["HTTPServer", "BaseHTTPRequestHandler", "SimpleHTTPRequestHandler", "CGIHTTPRequestHandler"] - -class HTTPServer(socketserver.TCPServer): - server_name: str - server_port: int - -if sys.version_info >= (3, 7): - class ThreadingHTTPServer(socketserver.ThreadingMixIn, HTTPServer): - daemon_threads: bool # undocumented - -class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): - client_address: tuple[str, int] - server: socketserver.BaseServer - close_connection: bool - requestline: str - command: str - path: str - request_version: str - headers: email.message.Message - server_version: str - sys_version: str - error_message_format: str - error_content_type: str - protocol_version: str - MessageClass: type - responses: Mapping[int, tuple[str, str]] - default_request_version: str # undocumented - weekdayname: ClassVar[Sequence[str]] # undocumented - monthname: ClassVar[Sequence[str | None]] # undocumented - def __init__(self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer) -> None: ... - def handle(self) -> None: ... - def handle_one_request(self) -> None: ... - def handle_expect_100(self) -> bool: ... - def send_error(self, code: int, message: str | None = ..., explain: str | None = ...) -> None: ... - def send_response(self, code: int, message: str | None = ...) -> None: ... - def send_header(self, keyword: str, value: str) -> None: ... - def send_response_only(self, code: int, message: str | None = ...) -> None: ... - def end_headers(self) -> None: ... - def flush_headers(self) -> None: ... - def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ... - def log_error(self, format: str, *args: Any) -> None: ... - def log_message(self, format: str, *args: Any) -> None: ... - def version_string(self) -> str: ... - def date_time_string(self, timestamp: int | None = ...) -> str: ... - def log_date_time_string(self) -> str: ... - def address_string(self) -> str: ... - def parse_request(self) -> bool: ... # undocumented - -class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): - server_version: str - extensions_map: dict[str, str] - if sys.version_info >= (3, 7): - def __init__( - self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer, directory: str | None = ... - ) -> None: ... - else: - def __init__(self, request: bytes, client_address: tuple[str, int], server: socketserver.BaseServer) -> None: ... - - def do_GET(self) -> None: ... - def do_HEAD(self) -> None: ... - def send_head(self) -> io.BytesIO | BinaryIO | None: ... # undocumented - def list_directory(self, path: StrPath) -> io.BytesIO | None: ... # undocumented - def translate_path(self, path: str) -> str: ... # undocumented - def copyfile(self, source: SupportsRead[AnyStr], outputfile: SupportsWrite[AnyStr]) -> None: ... # undocumented - def guess_type(self, path: StrPath) -> str: ... # undocumented - -def executable(path: StrPath) -> bool: ... # undocumented - -class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): - cgi_directories: list[str] - have_fork: bool # undocumented - def do_POST(self) -> None: ... - def is_cgi(self) -> bool: ... # undocumented - def is_executable(self, path: StrPath) -> bool: ... # undocumented - def is_python(self, path: StrPath) -> bool: ... # undocumented - def run_cgi(self) -> None: ... # undocumented -``` \ No newline at end of file