Skip to content
Merged
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
107 changes: 107 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -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/
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ repos:
rev: "v0.9.0.5"
hooks:
- id: shellcheck

- repo: local
hooks:
- id: pytest
stages: [commit, push]
types: [python]
name: pytest
entry: pytest
pass_filenames: false
language: system
always_run: true
20 changes: 20 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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)
Binary file added docs/_static/ccpem-logo-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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=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
51 changes: 51 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -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"]
34 changes: 34 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -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```
15 changes: 15 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -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:
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6" # need to also update version in src/caked/__init__.py
authors = [
{ name = "Bea Costa Gomes", email = "bcostagomes@turing.ac.uk" },
]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/caked/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from __future__ import annotations

__all__ = ("__version__",)
__version__ = "0.1.0"
__version__ = "0.1.6"
Empty file added tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/test_disk_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import numpy as np
import pytest
import torch
from tests import testdata_mrc, testdata_npy

from caked.dataloader import DiskDataLoader, DiskDataset
from tests import testdata_mrc, testdata_npy

ORIG_DIR = Path.cwd()
TEST_DATA_MRC = Path(testdata_mrc.__file__).parent
Expand Down
Loading