Skip to content

Commit f25fdc8

Browse files
committed
DOCS : Update docs and fix regression action.
1 parent e4a2502 commit f25fdc8

17 files changed

+178
-61
lines changed

.github/workflows/regression.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ jobs:
2121
sudo apt-get install qemu-system-arm qemu-efi qemu-user-static -y
2222
2323
- name: build
24-
run: ./key.sh make
24+
run: |
25+
touch ~/.ssh/id_rsa
26+
touch ~/.ssh/id_rsa.pub
27+
./key.sh make
2528
2629
- name: regression
2730
run: ./key.sh regression

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
### Latest
55

6+
* BUGFIX : Remove errant debugging statement
7+
* FEATURE : .include_files()
8+
* BUGFIX : Fix hitchrunpy.
69
* FEATURE : Run python code in different directory to the working directory.
710

811

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# HitchRunPy
22

3+
[![Main branch status](https://github.com/hitchdev/hitchrunpy/actions/workflows/regression.yml/badge.svg)](https://github.com/hitchdev/hitchrunpy/actions/workflows/regression.yml)
4+
35
HitchRunPy is a tool to run, test and profile snippets of python code.
46

57
HitchRunPy was developed to run executable specifications
@@ -30,24 +32,21 @@ ExamplePythonCode(
3032

3133
## Install
3234

33-
Hitchstory is designed to be used mainly with hitchkey and hitchstory. [ TODO set up ]
34-
35-
However, hitchrunpy can also be installed directly from pypi using pip.
36-
3735
```sh
3836
$ pip install hitchstory
3937
```
4038

4139
## Using HitchRunPy
4240

43-
- [Run with environment variables](https://hitchdev.com/hitchrunpy/using/alpha/)
44-
- [Timeout](https://hitchdev.com/hitchrunpy/using/alpha/)
45-
- [Error occurred](https://hitchdev.com/hitchrunpy/using/alpha/)
46-
- [Setup code](https://hitchdev.com/hitchrunpy/using/alpha/)
47-
- [CProfile](https://hitchdev.com/hitchrunpy/using/alpha/)
48-
- [Exceptions](https://hitchdev.com/hitchrunpy/using/alpha/)
49-
- [Interact with running code](https://hitchdev.com/hitchrunpy/using/alpha/)
50-
- [Use modules](https://hitchdev.com/hitchrunpy/using/alpha/)
41+
- [CProfile](https://hitchdev.com/hitchrunpy/using/alpha/cprofile)
42+
- [Run with environment variables](https://hitchdev.com/hitchrunpy/using/alpha/environment-vars)
43+
- [Exceptions](https://hitchdev.com/hitchrunpy/using/alpha/exceptions)
44+
- [Include files](https://hitchdev.com/hitchrunpy/using/alpha/include-files)
45+
- [Interact with running code](https://hitchdev.com/hitchrunpy/using/alpha/interact-with-running-code)
46+
- [Setup code](https://hitchdev.com/hitchrunpy/using/alpha/setup-code)
47+
- [Error occurred](https://hitchdev.com/hitchrunpy/using/alpha/syntax-errors)
48+
- [Timeout](https://hitchdev.com/hitchrunpy/using/alpha/timeout)
49+
- [Use modules](https://hitchdev.com/hitchrunpy/using/alpha/variables)
5150

5251

5352

docs/public/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
### Latest
55

6+
* BUGFIX : Remove errant debugging statement
7+
* FEATURE : .include_files()
8+
* BUGFIX : Fix hitchrunpy.
69
* FEATURE : Run python code in different directory to the working directory.
710

811

docs/public/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $ pip install hitchstory
4848
- [CProfile](using/alpha/cprofile)
4949
- [Run with environment variables](using/alpha/environment-vars)
5050
- [Exceptions](using/alpha/exceptions)
51+
- [Include files](using/alpha/include-files)
5152
- [Interact with running code](using/alpha/interact-with-running-code)
5253
- [Setup code](using/alpha/setup-code)
5354
- [Error occurred](using/alpha/syntax-errors)

docs/public/using/alpha/cprofile.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ from ensure import Ensure
2828
import hitchbuildpy
2929
import hitchbuild
3030

31+
BUILD_DIR = "/path/to/build_dir/.."
32+
3133
virtualenv = hitchbuildpy.VirtualenvBuild(
32-
name="py3.7",
33-
base_python=hitchbuildpy.PyenvBuild("3.7").with_build_path(
34-
'/path/to/share_dir/'
34+
"/path/to/build_dir/../py3.7",
35+
base_python=hitchbuildpy.PyenvBuild(
36+
'/path/to/share_dir/../pyenv3.7',
37+
"3.7",
3538
),
36-
).with_build_path("/path/to/build_dir/")
39+
)
3740

38-
virtualenv.ensure_built()
41+
virtualenv.verify()
3942

4043
pyrunner = ExamplePythonCode(
4144
virtualenv.bin.python,

docs/public/using/alpha/environment-vars.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ from ensure import Ensure
1818
import hitchbuildpy
1919
import hitchbuild
2020

21+
BUILD_DIR = "/path/to/build_dir/.."
22+
2123
virtualenv = hitchbuildpy.VirtualenvBuild(
22-
name="py3.7",
23-
base_python=hitchbuildpy.PyenvBuild("3.7").with_build_path(
24-
'/path/to/share_dir/'
24+
"/path/to/build_dir/../py3.7",
25+
base_python=hitchbuildpy.PyenvBuild(
26+
'/path/to/share_dir/../pyenv3.7',
27+
"3.7",
2528
),
26-
).with_build_path("/path/to/build_dir/")
29+
)
2730

28-
virtualenv.ensure_built()
31+
virtualenv.verify()
2932

3033
pyrunner = ExamplePythonCode(
3134
virtualenv.bin.python,
@@ -54,7 +57,7 @@ pyrunner.with_env(MYVAR="myenvironmentvar").with_code((
5457

5558

5659

57-
Then the file "working/examplefile" in the working dir will contain:
60+
Then the file "examplefile" in the working dir will contain:
5861

5962
```
6063
myenvironmentvar

docs/public/using/alpha/exceptions.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ from ensure import Ensure
2020
import hitchbuildpy
2121
import hitchbuild
2222

23+
BUILD_DIR = "/path/to/build_dir/.."
24+
2325
virtualenv = hitchbuildpy.VirtualenvBuild(
24-
name="py3.7",
25-
base_python=hitchbuildpy.PyenvBuild("3.7").with_build_path(
26-
'/path/to/share_dir/'
26+
"/path/to/build_dir/../py3.7",
27+
base_python=hitchbuildpy.PyenvBuild(
28+
'/path/to/share_dir/../pyenv3.7',
29+
"3.7",
2730
),
28-
).with_build_path("/path/to/build_dir/")
31+
)
2932

30-
virtualenv.ensure_built()
33+
virtualenv.verify()
3134

3235
pyrunner = ExamplePythonCode(
3336
virtualenv.bin.python,
@@ -91,7 +94,7 @@ hitchrunpy.exceptions.ExpectedExceptionWasDifferent:
9194
Expected exception '__main__.CustomException', instead '__main__.AnotherCustomException' was raised:
9295

9396
[0]: function '[[ BRIGHT ]]<module>[[ RESET ALL ]]'
94-
/path/to/code/working/examplepythoncode.py
97+
/path/to/working/examplepythoncode.py
9598

9699

97100
67 :
@@ -102,7 +105,7 @@ Expected exception '__main__.CustomException', instead '__main__.AnotherCustomEx
102105

103106

104107
[1]: function '[[ BRIGHT ]]run_example_code[[ RESET ALL ]]'
105-
/path/to/code/working/examplepythoncode.py
108+
/path/to/working/examplepythoncode.py
106109

107110

108111
63 :
@@ -113,7 +116,7 @@ Expected exception '__main__.CustomException', instead '__main__.AnotherCustomEx
113116

114117

115118
[2]: function '[[ BRIGHT ]]runcode[[ RESET ALL ]]'
116-
/path/to/code/working/examplepythoncode.py
119+
/path/to/working/examplepythoncode.py
117120

118121

119122
58 : pass
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
---
3+
title: Include files
4+
---
5+
6+
7+
8+
This example shows how to include files which can be
9+
used as e.g. modules to import or text files to read accessible
10+
in the working directory.
11+
12+
13+
14+
15+
16+
```python
17+
from hitchrunpy import ExamplePythonCode
18+
from ensure import Ensure
19+
import hitchbuildpy
20+
import hitchbuild
21+
22+
BUILD_DIR = "/path/to/build_dir/.."
23+
24+
virtualenv = hitchbuildpy.VirtualenvBuild(
25+
"/path/to/build_dir/../py3.7",
26+
base_python=hitchbuildpy.PyenvBuild(
27+
'/path/to/share_dir/../pyenv3.7',
28+
"3.7",
29+
),
30+
)
31+
32+
virtualenv.verify()
33+
34+
pyrunner = ExamplePythonCode(
35+
virtualenv.bin.python,
36+
'/path/to/working_dir',
37+
)
38+
39+
```
40+
41+
42+
43+
44+
45+
46+
```python
47+
CODE = """
48+
from write_file import write_to_file
49+
50+
write_to_file()
51+
"""
52+
53+
pyrunner.with_code(CODE).include_files("../differentdirectory/write_file.py").run()
54+
55+
```
56+
57+
58+
59+
60+
61+
62+
Then the file "examplefile" in the working dir will contain:
63+
64+
```
65+
â string of some kind
66+
```
67+
68+
69+
70+
71+
72+
73+
74+
75+
!!! note "Executable specification"
76+
77+
Documentation automatically generated from
78+
<a href="https://github.com/hitchdev/hitchrunpy/blob/master/hitch/story/include-files.story">include-files.story</a>
79+
storytests.
80+

docs/public/using/alpha/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Using HitchRunPy
55
- [CProfile](cprofile)
66
- [Run with environment variables](environment-vars)
77
- [Exceptions](exceptions)
8+
- [Include files](include-files)
89
- [Interact with running code](interact-with-running-code)
910
- [Setup code](setup-code)
1011
- [Error occurred](syntax-errors)

0 commit comments

Comments
 (0)