Skip to content

Commit 723d334

Browse files
committed
core(doc): add docker option in the readme
1 parent bf85e4f commit 723d334

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

README.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,6 @@ Given a function body `f` as a string of code tokens (including special tokens s
2323

2424
`run_pipeline -r test_files`
2525

26-
```
27-
======== Analysing test_files/test_code_add.py =========
28-
29-
30-
>>> Function "add" with Dcostring """sums two numbers and returns the result"""
31-
>>> Do they match?
32-
Yes
33-
```
34-
35-
```
36-
======== Analysing test_files/test_code_add.py =========
37-
38-
>>> Function "return_all_even" with Dcostring """numbers that are not really odd"""
39-
>>> Do they match?
40-
Yes
41-
42-
```
43-
4426
```
4527
======== Analysing test_files/inner_dir/test_code_get.py =========
4628
@@ -111,14 +93,15 @@ We have provided very easy to use CLI commands to achieve all these, and at scal
11193
Assuming that model is downloaded and ready, you can run the following command to analyze one file or a directory containing a bunch of files
11294

11395
```
114-
usage: run_pipeline [-h] [-f FILE_NAME] [-r RECURSIVE]
96+
usage: run_pipeline [-h] [-f FILE_NAME] [-r RECURSIVE] [-m]
11597
11698
optional arguments:
11799
-h, --help show this help message and exit
118100
-f FILE_NAME, --file_name FILE_NAME
119101
The name of the file you want to run the pipeline on
120102
-r RECURSIVE, --recursive RECURSIVE
121103
Put the directory if you want to run recursively
104+
-m, --show_match Shall we show the matches? (Default false)
122105
```
123106

124107
So, let's say you have a directory called `test_files` with some python files in it. This is how you can analyze them
@@ -130,6 +113,19 @@ A prompt will appear to confirm the model location. Once you confirm that then t
130113
🏆 It should produce a report like the following -
131114

132115

116+
```
117+
======== Analysing test_files/test_code_add.py =========
118+
119+
120+
======== Analysing test_files/inner_dir/test_code_get.py =========
121+
>>> Function "get_file" with Dcostring """opens a url"""
122+
>>> Do they match?
123+
No
124+
******************************************************************
125+
```
126+
127+
You can optionally pass the `--show_match` flag like so `run_pipeline -r test_files --show_match` and then it will also show you the function docstring pairs where they match. By default it will only show you the mis-matches. So, with this flag set the report will look like this
128+
133129
```
134130
======== Analysing test_files/test_code_add.py =========
135131
@@ -152,4 +148,14 @@ No
152148
******************************************************************
153149
```
154150

151+
## code-bert Docker
152+
153+
It has been request by our users and here it is! You will not need to go through any painful setup process at all. We have Dockerized the entire thing for you. Here are the steps to use it.
154+
155+
- Pull the image `docker pull codistai/codebert`
156+
157+
- Assuming that you have a bunch of files to be analyzed under `test_files` in your present working directory, run this command - `docker run -v "$(pwd)"/test_files:/usr/src/app/test_files -it codistai/codebert run_pipeline -r test_files`
158+
159+
- If you wish to analyze any other directory, simply change the mounting option in the `docker run` command (the path after `-v` the format should be `full/local/path:/usr/src/app/<mount_dir_name>`) and also mention the same `<mount_dir_name>` after the `run_pipeline` command.
160+
155161
Stay tuned!

code_bert/cli/run_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def main():
6969
parser = ArgumentParser()
7070
parser.add_argument("-f", "--file_name", type=str, required=False, help="The name of the file you want to run the pipeline on")
7171
parser.add_argument("-r", "--recursive", required=False, help="Put the directory if you want to run recursively")
72-
parser.add_argument("-m", "--show_match", action="store_false", help="Shall we only show the mis matches?")
72+
parser.add_argument("-m", "--show_match", action="store_false", help="Shall we show the matches? (Default false)")
7373

7474
args = parser.parse_args()
7575
run_pipeline(args)

0 commit comments

Comments
 (0)