Skip to content

Commit

Permalink
Merge branch 'main' into python-api
Browse files Browse the repository at this point in the history
  • Loading branch information
grst authored Dec 17, 2024
2 parents 2c589e4 + 6d221b6 commit 1ef31e1
Show file tree
Hide file tree
Showing 48 changed files with 1,097 additions and 660 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Build

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
run: python -m pip install --upgrade pip wheel twine build
- name: Build package
run: python -m build
- name: Check package
run: twine check --strict dist/*.whl
48 changes: 48 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Build docs using sphinx"
on:
push:
branches:
- main
pull_request:
# also run on 'closed' to clean up the github pages dir
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

jobs:
docs:
name: "Build Docs"
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: "Install hatch"
run: pip install hatch

- name: "Build docs with Sphinx"
run: hatch run docs:build -W --keep-going

- name: Deploy preview
if: github.event_name == 'pull_request'
uses: rossjrw/pr-preview-action@v1
with:
source-dir: docs/_build/html

- name: Deploy docs
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html
branch: gh-pages
clean-exclude: pr-preview/
force: false
5 changes: 3 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.12"]
# test minimum and maximum supported python version
python-version: ["3.10", "3.13"]

env:
# GitHub currently has 4 cores available for Linux runners
Expand All @@ -38,7 +39,7 @@ jobs:
run: sudo apt-get install -y libgit2-dev pandoc

- name: "Install DSO"
run: pip install -e '.[test]'
run: pip install '.[test]'

- name: "Run unit tests"
run: pytest -vv tests -n ${{ env.worker_cores }} --cov=dso --cov-report=xml
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ buck-out/
__pycache__/
.*cache/

# UV
uv.lock

# Distribution / packaging
/dist/

Expand All @@ -18,3 +21,7 @@ __pycache__/
# docs
/docs/generated/
/docs/_build/

# Windows
Thumbs.db
~$*
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
- pre-commit
- pre-push
minimum_pre_commit_version: 2.16.0
repos:
# - repo: https://github.com/pre-commit/mirrors-prettier
Expand Down Expand Up @@ -36,6 +36,7 @@ repos:
rev: "2.2.4"
hooks:
- id: pyproject-fmt
exclude: "^src/dso/templates/.*"
- repo: local
hooks:
- id: forbid-to-commit
Expand Down
65 changes: 64 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,70 @@ and this project adheres to [Semantic Versioning][].

- Python API that mirrors `dso-r` functionality (e.g. to be used from Jupyter notebooks) ([#30](https://github.com/Boehringer-Ingelheim/dso/pull/30))

## v0.10.1

### Fixes

- Take comments into account when linting for `DSO001` ([#69](https://github.com/Boehringer-Ingelheim/dso/pull/69))
- Make it possible to override watermarks/disclaimers with a simple `null` ([#69](https://github.com/Boehringer-Ingelheim/dso/pull/69)).
- Compile *all* configs on `dso repro`, not just the ones relvant to the specified stage. This is required because we don't
know which other stages dvc might compile ([#69](https://github.com/Boehringer-Ingelheim/dso/pull/69)).
- Make `get-config` compatible with dvc matrix stages ([#69](https://github.com/Boehringer-Ingelheim/dso/pull/69)).

### Template updates

- Do not ignore the `.gitignore` files in output/report directories of template ([#63](https://github.com/Boehringer-Ingelheim/dso/pull/63))
- Update `.pre-commit-config.yaml` for pre-commit 4.x ([#63](https://github.com/Boehringer-Ingelheim/dso/pull/63))

## v0.10.0

### Template updates
- Improve instruction text in quarto template to get users started more quickly ([#40](https://github.com/Boehringer-Ingelheim/dso/pull/40))
- Add `.gitignore` catch-all clauses for `output` and `report` folders in stages to not pick up data and repots being tracked via git ([#46](https://github.com/Boehringer-Ingelheim/dso/issues/46)).
- Every dso project is now also a [uv project](https://docs.astral.sh/uv/concepts/projects/#building-projects) declaring Python dependencies in `pyproject.toml`. This makes it possible to
use a different dso version per project and makes it easy to work with virtual Python environments ([#52](https://github.com/Boehringer-Ingelheim/dso/pull/52))
- bash templates now include `-euo pipefail` settings, ensuring that stages fail early and return a nonzero error code if something failed ([#59](https://github.com/Boehringer-Ingelheim/dso/pull/59)).

### Fixes
- Remove vendored `hiyapyco` code since required changes were released upstream in v0.7.0 ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)).
- `None` values in `params.in.yaml` can now be used to override anything, e.g. to disable watermarking only in a specific stage ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)).
- Clean up existing `*.rmarkdown` files in quarto stage before running `quarto render`. This fixes issues with re-running quarto stages that failed in the previous attempt ([#57](https://github.com/Boehringer-Ingelheim/dso/pull/57)).
- DSO now respects a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set
to anything that evaluates as `True`, we skip the check if pre-commit is installed. This was a
requirement introduced by the R API package, see [#50](https://github.com/Boehringer-Ingelheim/dso/issues/50) ([#58](https://github.com/Boehringer-Ingelheim/dso/pull/58)).
- Improve logging for "missing path" warning during `compile-config` ([#59](https://github.com/Boehringer-Ingelheim/dso/pull/59)).
- Improve logging for missing parameters in `dvc.yaml` during `get-config` ([#59](https://github.com/Boehringer-Ingelheim/dso/pull/59)).
- Make sure internal calls to the dso pandocfilter use the same python and dso version as the parent command. This is important for the upcoming `dso-mgr` feature ([#61](https://github.com/Boehringer-Ingelheim/dso/pull/61)).

## v0.9.0

### New Features

- `dso watermark` now supports files in PDF format. With this change, quarto reports using the watermark feature can
be rendered to PDF, too ([#26](https://github.com/Boehringer-Ingelheim/dso/pull/26)).

### Fixes

- Fix linting rule DSO001: It is now allowed to specify additional arguments in `read_params()`, e.g. `quiet = TRUE` ([#36](https://github.com/Boehringer-Ingelheim/dso/pull/36)).
- It is now possible to use Jinja2 interpolation in combination with `!path` objects ([#36](https://github.com/Boehringer-Ingelheim/dso/pull/36))
- Improve error messages when `dso get-config` can't find required input files ([#36](https://github.com/Boehringer-Ingelheim/dso/pull/36))

### Documentation

- Documentation is now built via sphinx and hosted on GitHub pages: https://boehringer-ingelheim.github.io/dso/ ([#35](https://github.com/Boehringer-Ingelheim/dso/pull/35)).

### Template updates

- Make instruction comments in quarto template more descriptive ([#33](https://github.com/Boehringer-Ingelheim/dso/pull/33)).
- Include `params.yaml` in default project `.gitignore`. We decided to not track `params.yaml` in git anymore
since it adds noise during code review and led to merge conflicts in some cases. In the future, a certain
`dso` version will be tied to each project, improving reproducibility also without `params.yaml` files.

### Migration advice

- Add `params.yaml` to your project-level `.gitignore`. Then execute `find -iname "params.yaml" -exec git rm --cached {} \;`
to untrack existing `params.yaml` files.

## v0.8.2

### Fixes
Expand Down Expand Up @@ -52,7 +116,6 @@ and this project adheres to [Semantic Versioning][].
- When running `dso repro`, configuration is only compiled once and not recompiled when `dso exec` or `dso get-config`
is called internally. This reduces runtime and redundant log messages.


## v0.7.0

- Improved watermarking support
Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```{include} ../CHANGELOG.md
```
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 ?= -W --keep-going
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
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)
Empty file added docs/_static/.gitkeep
Empty file.
4 changes: 4 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Reduce the font size in data frames - See https://github.com/scverse/cookiecutter-scverse/issues/193 */
div.cell_output table.dataframe {
font-size: 0.8em;
}
Empty file added docs/_templates/.gitkeep
Empty file.
61 changes: 61 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. add toctree option to make autodoc generate the pages
.. autoclass:: {{ objname }}

{% block attributes %}
{% if attributes %}
Attributes table
~~~~~~~~~~~~~~~~

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block methods %}
{% if methods %}
Methods table
~~~~~~~~~~~~~

.. autosummary::
{% for item in methods %}
{%- if item != '__init__' %}
~{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes_documentation %}
{% if attributes %}
Attributes
~~~~~~~~~~

{% for item in attributes %}

.. autoattribute:: {{ [objname, item] | join(".") }}
{%- endfor %}

{% endif %}
{% endblock %}

{% block methods_documentation %}
{% if methods %}
Methods
~~~~~~~

{% for item in methods %}
{%- if item != '__init__' %}

.. automethod:: {{ [objname, item] | join(".") }}
{%- endif -%}
{%- endfor %}

{% endif %}
{% endblock %}
Loading

0 comments on commit 1ef31e1

Please sign in to comment.