diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..e3b7979 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,107 @@ +name: publish-caked-to-pypi + +on: push + +jobs: + build: + name: build-dist + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: setup-python + uses: actions/setup-python@v4 + with: + python-version: "3.10.4" + - name: install-pypa/build + run: >- + python3 -m pip install build --user + - name: build-bin-whl + run: python3 -m build + - name: grab-build + uses: actions/upload-artifact@v4 + with: + name: pkg-dist + path: dist/ + + publish-to-pypi: + name: >- + publish-to-pypi + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: production + url: https://pypi.org/p/caked + permissions: + id-token: write + + steps: + - name: download-dists + uses: actions/download-artifact@v4 + with: + name: pkg-dist + path: dist/ + - name: publish-dist-to-pypi + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + name: >- + sign-dist-via-sigstore-and-upload-to-github-release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - name: download-dists + uses: actions/download-artifact@v4 + with: + name: pkg-dist + path: dist/ + - name: sign-dists + uses: sigstore/gh-action-sigstore-python@v1.2.3 + with: + inputs: >- + ./dist/*.tar.gz ./dist/*.whl + - name: create-github-release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create '${{ github.ref_name }}' --repo '${{ + github.repository }}' --notes "" + - name: upload-artifact-signature-to-github-release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release upload '${{ github.ref_name }}' dist/** --repo '${{ + github.repository }}' + + publish-to-test-pypi: + name: publish-to-test-pypi + if: startsWith(github.ref, 'refs/heads/development') + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testing + url: https://test.pypi.org/p/caked + + permissions: + id-token: write + + steps: + - name: download-dists + uses: actions/download-artifact@v4 + with: + name: pkg-dist + path: dist/ + - name: publish-dist-to-test-pypi + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..5e45b50 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,20 @@ +# .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-22.04 + tools: + python: "3.11" + +sphinx: + configuration: docs/source/conf.py + +python: + install: + - method: pip + path: . + extra_requirements: + - doc diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_static/ccpem-logo-150x150.png b/docs/_static/ccpem-logo-150x150.png new file mode 100644 index 0000000..691bbc0 Binary files /dev/null and b/docs/_static/ccpem-logo-150x150.png differ diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +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 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..418056b --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,51 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) +from __future__ import annotations + +# -- Project information ----------------------------------------------------- + +project = "CAKED" +copyright = "MIT License" +author = "mooniean, jolaem, crangelsmith" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns: list[str] = [] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "pydata_sphinx_theme" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..7bd0976 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,34 @@ +.. CAKED documentation master file, edited copy of file created by + sphinx-quickstart + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to CAKED documentation! +========================== + +Provide an overview of the CAKED project here + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + installation + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + +CAKED details +=================================== + + +Example heading +---------------- +Example text + +Example code formatting: ```caked``` diff --git a/docs/source/installation.rst b/docs/source/installation.rst new file mode 100644 index 0000000..9419323 --- /dev/null +++ b/docs/source/installation.rst @@ -0,0 +1,15 @@ +.. _installation-instructions: + +Installation instructions +========================= + +Installing CAKED from PyPI +--------------------------------- + +This is recommended for most users. + +.. code:: bash + + pip install caked + +If you want to install the latest version, use: diff --git a/pyproject.toml b/pyproject.toml index 56eb38d..15c3561 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61"] build-backend = "setuptools.build_meta" [project] name = "CAKED" -version = "0.1.0" # need to also update version in src/caked/__init__.py +version = "0.1.3" # need to also update version in src/caked/__init__.py authors = [ { name = "Bea Costa Gomes", email = "bcostagomes@turing.ac.uk" }, ] @@ -40,6 +40,10 @@ dev = [ "pytest >=6", "pytest-cov >=3", ] +doc = [ + "sphinx >=5.0.0", + "pydata-sphinx-theme >=0.7", +] [project.urls] Homepage = "https://github.com/alan-turing-institute/CAKED" diff --git a/src/caked/__init__.py b/src/caked/__init__.py index 5b54632..7937e17 100644 --- a/src/caked/__init__.py +++ b/src/caked/__init__.py @@ -4,4 +4,4 @@ from __future__ import annotations __all__ = ("__version__",) -__version__ = "0.1.0" +__version__ = "0.1.3"