Skip to content

Commit f4f97fe

Browse files
author
gh-actions
committed
auto commit from showyourwork tests
1 parent 82778c9 commit f4f97fe

6 files changed

Lines changed: 63 additions & 83 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
</a>
1919
</p>
2020

21-
An open source scientific article created using the [showyourwork](https://github.com/showyourwork/showyourwork) workflow.
21+
*This is an automatically generated test for [showyourwork](https://github.com/showyourwork/showyourwork) generated from the file [test_cache.py](https://github.com/showyourwork/showyourwork/blob/main/tests/integration/test_cache.py).*
22+
23+
24+
Test the Zenodo Sandbox caching feature for a rule with a single output.
25+
26+

Snakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
4+
rule generate_data:
5+
output:
6+
'src/data/test_data.npz'
7+
cache:
8+
True
9+
script:
10+
'src/scripts/test_data.py'

showyourwork.yml

Lines changed: 21 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,44 @@
1-
# Enable rule caching on Zenodo?
21
cache_on_zenodo: true
3-
4-
# Workflow graph (DAG) generation
52
dag:
6-
# Generate `dag.pdf` on each build?
7-
render: false
8-
# Graphviz layout engine
93
engine: sfdp
10-
# Group files by type into plates?
11-
group_by_type: false
12-
# Custom graph attributes
134
graph_attr:
14-
ranksep: "1"
15-
nodesep: "0.65"
16-
# Custom node attributes
5+
nodesep: '0.65'
6+
ranksep: '1'
7+
group_by_type: false
178
node_attr:
18-
shape: "box"
19-
penwidth: "2"
20-
width: "1"
21-
# Files and glob patterns to ignore
22-
# ignore_files:
23-
# - src/tex/orcid-ID.png
24-
25-
26-
# Externally-hosted datasets, e.g. on Zenodo
27-
datasets:
28-
# 10.5281/zenodo.6468327:
29-
# contents:
30-
# TOI640b.json: src/data/TOI640b.json
31-
32-
# Custom file dependencies
9+
penwidth: '2'
10+
shape: box
11+
width: '1'
12+
render: false
13+
datasets: null
3314
dependencies:
34-
# src/scripts/my_script.py:
35-
# - src/data/dataset_for_my_script.dat
36-
# src/tex/ms.tex:
37-
# - src/tex/stylesheet.tex
38-
39-
# Name of the `.tex` manuscript and corresponding `.pdf` article
15+
src/scripts/test_figure.py: src/data/test_data.npz
4016
ms_name: ms
41-
42-
# Optimize DAG by removing unnecessary jobs upstream of cache hits?
4317
optimize_caching: false
44-
45-
# Overleaf sync settings
4618
overleaf:
47-
# Overleaf project ID (blank = disabled)
48-
id:
49-
# Perform sync on GitHub Actions?
5019
gh_actions_sync: true
51-
# List of files to push to Overleaf
52-
push:
53-
- src/tex/figures
54-
- src/tex/output
55-
# List of files to pull from Overleaf
20+
id: null
5621
pull:
57-
- src/tex/ms.tex
58-
- src/tex/bib.bib
59-
60-
# Always require all input files to be present on disk for workflow to pass?
22+
- src/tex/ms.tex
23+
- src/tex/bib.bib
24+
push:
25+
- src/tex/figures
26+
- src/tex/output
6127
require_inputs: true
62-
63-
# Allow cacheable rules to run on GitHub Actions?
64-
run_cache_rules_on_ci: false
65-
66-
# Mapping of script file extensions to instructions for executing them
28+
run_cache_rules_on_ci: true
6729
scripts:
6830
py: python {script}
69-
70-
# Display of the `showyourwork` stamp on first page
7131
stamp:
72-
# Show the stamp?
73-
enabled: true
74-
# Stamp angle in degrees
7532
angle: -20.0
76-
# Stamp size in inches
33+
enabled: true
7734
size: 0.75
78-
# Horizontal position in inches from right edge of paper
79-
xpos: 0.50
80-
# Vertical position in inches from top edge of paper
81-
ypos: 0.50
82-
# Display of the repo URL in the stamp
8335
url:
84-
# Show the URL?
8536
enabled: true
86-
# Maximum URL length to display
8737
maxlen: 40
88-
89-
# Enable SyncTeX?
90-
synctex: True
91-
92-
# Command-line options to be passed to tectonic when building the manuscript
38+
xpos: 0.5
39+
ypos: 0.5
40+
synctex: true
9341
tectonic_args: []
94-
95-
# Preprocessing script for arXiv tarball
96-
# (such as to switch `minted` from `finalizecache` to `frozencache`)
97-
# The script will be passed a directory containing the manuscript source
98-
# as input, and should modify the contents of that directory in-place.
99-
# preprocess_arxiv_script: my_preprocess_script.sh
100-
101-
# Enable verbose output?
10242
verbose: false
103-
104-
# Version of `showyourwork` used to create this workflow
10543
version: 0.4.4.dev316+g24151750f
44+

src/scripts/test_data.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import numpy as np
2+
import paths
3+
import os
4+
no_run_ci = os.getenv('CI', 'false') == 'true' and not snakemake.config['run_cache_rules_on_ci']
5+
if no_run_ci or os.getenv('SYW_NO_RUN', 'false') == 'true':
6+
raise Exception('Output should have been downloaded from Zenodo.')
7+
np.random.seed(0)
8+
data = np.random.randn(100, 10)
9+
np.savez(paths.data / 'test_data.npz', data=data)

src/scripts/test_figure.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
import paths
4+
np.random.seed(0)
5+
data = np.load(paths.data / 'test_data.npz')
6+
fig = plt.figure(figsize=(7, 6))
7+
plt.plot(data)
8+
fig.savefig(paths.figures / 'test_figure.pdf', bbox_inches='tight', dpi=300)

src/tex/ms.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,13 @@ \section{Introduction}
5959

6060
\bibliography{bib}
6161

62+
\begin{figure}[ht!]
63+
\script{test_figure.py}
64+
\begin{centering}
65+
\includegraphics[width=\linewidth]{figures/test_figure.pdf}
66+
\caption{A test figure.}
67+
\label{fig:test_figure}
68+
\end{centering}
69+
\end{figure}
70+
6271
\end{document}

0 commit comments

Comments
 (0)