Skip to content

Commit 095356d

Browse files
committed
Merge branch 'master' of github.com:astropy/astropy-tutorials
2 parents ba740be + 2ed3708 commit 095356d

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

.circleci/config.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Python CircleCI 2.0 configuration file
2+
# Check https://circleci.com/docs/2.0/language-python/ for more details
3+
version: 2
4+
5+
apt-run: &apt-install
6+
name: Install apt packages
7+
command: |
8+
sudo apt-get update
9+
sudo apt-get install build-essential pandoc
10+
11+
pip-run: &pip-install
12+
name: Install Python dependencies
13+
command: |
14+
python3 -m venv venv
15+
. venv/bin/activate
16+
pip install -q -r pip-requirements.txt
17+
pip install astropy_helpers sphinx
18+
19+
jobs:
20+
21+
build:
22+
docker:
23+
- image: circleci/python:3.6
24+
25+
steps:
26+
- checkout
27+
- add_ssh_keys: # add GitHub SSH keys
28+
fingerprints:
29+
- 32:53:df:4a:53:71:25:8b:73:42:71:c8:57:8a:3f:f7
30+
- run: *apt-install # run the apt install defined above
31+
- run: *pip-install # run the pip install defined above
32+
33+
# - restore_cache: # Need cache for all tutorial data!
34+
# keys: sample-data-v1
35+
36+
- run:
37+
name: Build documentation
38+
command: |
39+
. venv/bin/activate
40+
make html
41+
42+
- store_artifacts:
43+
path: build/html
44+
45+
- run:
46+
name: Built documentation is available at
47+
command: |
48+
DOCS_URL="${CIRCLE_BUILD_URL}/artifacts/${CIRCLE_NODE_INDEX}/${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}/build/html/index.html"; echo $DOCS_URL
49+
50+
- run:
51+
name: Push to RTD branch
52+
command: |
53+
bash .circleci/rtd-push.sh
54+
55+
# - save_cache: # Specify what paths to cache
56+
# key: sample-data-v1
57+
# paths:
58+
# - ~/sunpy/data/sample_data
59+
60+
notify:
61+
webhooks:
62+
- url: https://giles.cadair.com/circleci

.circleci/rtd-push.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -eux
2+
3+
# if [ -z "${GIT_USER_NAME}" ]; then
4+
# echo "Please set an env var GIT_USER_NAME"
5+
# exit 1
6+
# fi
7+
#
8+
# if [ -z "${GIT_USER_EMAIL}" ]; then
9+
# echo "Please set an env var GIT_USER_EMAIL"
10+
# exit 1
11+
# fi
12+
13+
if [[ -z $CIRCLE_PULL_REQUEST ]] ; then
14+
git checkout --orphan rst
15+
git add -f tutorials/rst-tutorials/*
16+
git -c user.name='circle' -c user.email='circle' commit -m "now with RST"
17+
git remote add origin git@github.com:astropy/astropy-tutorials.git
18+
git push -q -f origin rst
19+
echo "Not a pull request: pushing RST files to rst branch."
20+
else
21+
echo $CIRCLE_PULL_REQUEST
22+
echo "This is a pull request: not pushing RST files."
23+
fi

pip-requirements.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ astroquery==0.3.7
44
matplotlib==2.0.2
55
numpy==1.13.1
66
jupyter==1.0
7-
scipy=0.19
7+
scipy==0.19
8+
notebook==5.0
9+
aplpy
10+
spectral-cube
11+
reproject
12+
git+https://github.com/jupyter/nbconvert

scripts/convert.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def __init__(self, nb_path, output_path=None, template_file=None,
4141
logger.info('Processing notebook {0} (in {1})'.format(fn,
4242
self.path_only))
4343

44+
# the RST file
45+
self._rst_path = path.join(self.output_path,
46+
'{0}.rst'.format(self.nb_name))
47+
4448
if kernel_name is None:
4549
self.kernel_name = ExecutePreprocessor.kernel_name.default_value
4650
else:
@@ -107,6 +111,12 @@ def convert(self, remove_executed=False):
107111
raise IOError("Executed notebook file doesn't exist! Expected: {0}"
108112
.format(self._executed_nb_path))
109113

114+
if path.exists(self._rst_path) and not self.overwrite:
115+
logger.debug("RST version of notebook already exists at {0}. Use "
116+
"overwrite=True or --overwrite (at cmd line) to re-run"
117+
.format(self._rst_path))
118+
return self._rst_path
119+
110120
# Initialize the resources dict - see:
111121
# https://github.com/jupyter/nbconvert/blob/master/nbconvert/nbconvertapp.py#L327
112122
resources = {}

0 commit comments

Comments
 (0)