codespector 0.2.0__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ class CodeSpector:
18
18
  result_file: str,
19
19
  output_dir: str,
20
20
  chat_model: str | None = None,
21
+ exclude_file_ext: list[str] | None = None,
21
22
  ):
22
23
  self.chat_token = chat_token
23
24
  self.chat_agent = chat_agent
@@ -30,6 +31,7 @@ class CodeSpector:
30
31
  self.pipeline = pipeline
31
32
  self.result_file = result_file
32
33
  self.chat_model = chat_model
34
+ self.exclude_file_exc: list[str] | None = (None,)
33
35
 
34
36
  @classmethod
35
37
  def create(
@@ -42,6 +44,7 @@ class CodeSpector:
42
44
  result_file: str,
43
45
  output_dir: str,
44
46
  chat_model: str | None = None,
47
+ exclude_file_ext: list[str] | None = None,
45
48
  ) -> 'CodeSpector':
46
49
  agent_info = AgentInfo.create(
47
50
  chat_agent=chat_agent,
@@ -51,6 +54,7 @@ class CodeSpector:
51
54
  data_preparer = CodeSpectorDataPreparer(
52
55
  output_dir=output_dir,
53
56
  compare_branch=compare_branch,
57
+ exclude_file_ext=exclude_file_ext,
54
58
  )
55
59
  reviewer = CodeSpectorReviewer(
56
60
  diff_file=data_preparer.combined_file,
@@ -77,6 +81,7 @@ class CodeSpector:
77
81
  pipeline=pipeline,
78
82
  output_dir=output_dir,
79
83
  result_file=result_file,
84
+ exclude_file_ext=exclude_file_ext,
80
85
  )
81
86
 
82
87
  def review(self):
codespector/local.py CHANGED
@@ -10,9 +10,11 @@ class CodeSpectorDataPreparer(BasePipe):
10
10
  self,
11
11
  output_dir: str,
12
12
  compare_branch: str,
13
+ exclude_file_ext: list[str] | None = None,
13
14
  ):
14
15
  self.output_dir = output_dir
15
16
  self.compare_branch = compare_branch
17
+ self.exclude_file_ext = exclude_file_ext
16
18
 
17
19
  self.original_files_tmp = 'original_files_tmp.json'
18
20
  self.code_changes_only = 'code_changes_only.txt'
@@ -61,8 +63,9 @@ class CodeSpectorDataPreparer(BasePipe):
61
63
  result = {'original files': []}
62
64
 
63
65
  for file in changed_files:
64
- if not file.endswith('.py'):
65
- continue
66
+ if self.exclude_file_ext:
67
+ if file.endswith(tuple(self.exclude_file_ext)):
68
+ continue
66
69
 
67
70
  if os.path.isfile(file):
68
71
  with open(file, 'r', encoding='utf-8') as f:
codespector/main.py CHANGED
@@ -11,6 +11,13 @@ env = Env()
11
11
  env.read_env(path=str(BASE_PATH / '.env'))
12
12
 
13
13
 
14
+ @click.option(
15
+ '--exclude-file-ext',
16
+ type=list,
17
+ envvar='CODESPECTOR_EXCLUDE_FILE_EXT',
18
+ help='Exclude file extensions from the review',
19
+ show_envvar=True,
20
+ )
14
21
  @click.option(
15
22
  '--result-file',
16
23
  type=str,
@@ -50,7 +57,7 @@ env.read_env(path=str(BASE_PATH / '.env'))
50
57
  '--chat-agent',
51
58
  envvar='CODESPECTOR_CHAT_AGENT',
52
59
  show_envvar=True,
53
- help='Choose the chat agent to use you can use one from [codestral, chatgpr, deepseek]. Or set yours chat agent',
60
+ help='Choose the chat agent to use you can use one from [codestral, chatgpt, deepseek]. Or set yours chat agent',
54
61
  )
55
62
  @click.option(
56
63
  '--chat-model',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codespector
3
- Version: 0.2.0
3
+ Version: 1.0.0
4
4
  Summary: Assistant for reviewing your code
5
5
  Project-URL: Repository, https://github.com/Vladimir-Titov/codespector
6
6
  Project-URL: Issues, https://github.com/Vladimir-Titov/codespector/issues
@@ -50,18 +50,23 @@ You can use the `codespector` command to start a code review. Below are the avai
50
50
  Usage: codespector [OPTIONS]
51
51
 
52
52
  Options:
53
- --system-content TEXT Content which used in system field for agent
54
- [default: Ты код ревьювер. Отвечай на русском языке.]
55
- --output-dir TEXT Select the output directory [default: codespector]
56
- -b, --compare-branch TEXT Select the branch to compare the current one with
57
- [default: develop]
58
- --chat-agent [codestral|chatgpt]
59
- Choose the chat agent to use [default: codestral]
60
- --chat-model TEXT Choose the chat model to use
61
- --chat-token TEXT Chat agent token
62
- --mode [local] Choose the mode of the application [default: local]
63
- --version Show the version and exit.
64
- --help Show this message and exit.
53
+ --chat-token TEXT Chat agent token [env var: CODESPECTOR_CHAT_TOKEN]
54
+ --chat-model TEXT Choose the chat model to use [env var: CODESPECTOR_CHAT_MODEL]
55
+ --chat-agent TEXT Choose the chat agent to use (codestral, chatgpt, deepseek)
56
+ or set your own [env var: CODESPECTOR_CHAT_AGENT]
57
+ -b, --compare-branch TEXT Select the branch to compare the current one with
58
+ --output-dir TEXT Select the output directory [default: codespector]
59
+ [env var: CODESPECTOR_OUTPUT_DIR]
60
+ --system-content TEXT Content which used in system field for agent
61
+ [env var: CODESPECTOR_SYSTEM_CONTENT]
62
+ --prompt-content TEXT Prompt content which included to review prompt
63
+ [env var: CODESPECTOR_PROMPT_CONTENT]
64
+ --result-file TEXT Set file for saving the result
65
+ [env var: CODESPECTOR_RESULT_FILE]
66
+ --exclude-file-ext LIST Exclude file extensions from the review
67
+ [env var: CODESPECTOR_EXCLUDE_FILE_EXT]
68
+ --version Show the version and exit.
69
+ --help Show this message and exit.
65
70
  ```
66
71
 
67
72
  ### Example
@@ -69,7 +74,7 @@ Options:
69
74
  To run a code review, use the following command:
70
75
 
71
76
  ```sh
72
- codespector --chat-token YOUR_CHAT_TOKEN --chat-agent codestral --compare-branch develop
77
+ codespector --chat-token YOUR_CHAT_TOKEN --chat-agent codestral --compare-branch develop --result-file result.md --system-content "system content" --prompt-content "prompt content"
73
78
  ```
74
79
 
75
80
  ## Configuration
@@ -77,11 +82,14 @@ codespector --chat-token YOUR_CHAT_TOKEN --chat-agent codestral --compare-branch
77
82
  You can also configure CodeSpector using environment variables. Create a `.env` file in the root directory of your project with the following content:
78
83
 
79
84
  ```
80
- CODESPECTOR_SYSTEM_CONTENT=Ты код ревьювер. Отвечай на русском языке.
85
+ CODESPECTOR_CHAT_TOKEN=your_token
81
86
  CODESPECTOR_OUTPUT_DIR=codespector
87
+ CODESPECTOR_SYSTEM_CONTENT="Ты код ревьювер. Отвечай на русском"
88
+ CODESPECTOR_PROMPT_CONTENT="Оцени код на безопасноть, соблюдение лучших техник"
89
+ CODESPECTOR_RESULT_FILE="result.md"
82
90
  CODESPECTOR_CHAT_AGENT=codestral
83
- CODESPECTOR_CHAT_MODEL=codestral-latest
84
- CODESPECTOR_CHAT_TOKEN=YOUR_CHAT_TOKEN
91
+ CODESPECTOR_CHAT_MODEL=your_model
92
+ CODESPECTOR_EXCLUDE_FILE_EXT=.pyc,.pyo
85
93
  ```
86
94
 
87
95
  ## Makefile Commands
@@ -0,0 +1,13 @@
1
+ codespector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ codespector/base.py,sha256=uPoJ8h0Dlna-eUXyyD9s7uaQ4z0pS6qPdQMeu10muEk,159
3
+ codespector/codespector.py,sha256=XHUbdWOZB0HSpXLdpDDFDIse9tiwVJ-gSyOPV0SCHcw,2842
4
+ codespector/errors.py,sha256=Z5W6i7iG_iBj_IfdSZ_f9jij0oPxTZ2Cxs87kzk3oyU,377
5
+ codespector/local.py,sha256=neODRe9DwQ_ghXccXVc-A-hdVA6Tz7EtVcmCwUh4HHs,2965
6
+ codespector/main.py,sha256=NoXN8nraW6_EtDK1oOx63rojs_fuSNeM2VX-rsSyg7o,1882
7
+ codespector/reviewer.py,sha256=WoKRO-bFFLKNUiWB_TWoK0rRjenHkJ5fej_lhcj_e2Q,2740
8
+ codespector/types.py,sha256=i5PFazyUc5rVq5Fhn4_FsG7R1l617vyjByvnixDUw1Y,1255
9
+ codespector-1.0.0.dist-info/METADATA,sha256=5gkMmkUJHFw7yjAl2xA7YXLs1sAqiBqOg9ciqT3-t_o,3791
10
+ codespector-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ codespector-1.0.0.dist-info/entry_points.txt,sha256=QlHn96KY8vzY1sOweKIuZOAQrSVse6h3v57vkwmHmJg,54
12
+ codespector-1.0.0.dist-info/licenses/LICENSE,sha256=Eta34ENUL_dZWy-prVNucMkoA38WIqiO9pKTUYiuT_A,1070
13
+ codespector-1.0.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- codespector/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- codespector/base.py,sha256=uPoJ8h0Dlna-eUXyyD9s7uaQ4z0pS6qPdQMeu10muEk,159
3
- codespector/codespector.py,sha256=qW9G3arSq3VzWxdvPP4uCMNFfWFd7HBqs8M8dQsOAHU,2588
4
- codespector/errors.py,sha256=Z5W6i7iG_iBj_IfdSZ_f9jij0oPxTZ2Cxs87kzk3oyU,377
5
- codespector/local.py,sha256=aEq1YBm4fAFywpwmTaAdpM0_C2RHuIFDmAKikUZkmtQ,2800
6
- codespector/main.py,sha256=dfCds8mEIVb7mHVoczijnceIOd94I9yJc-8ZWaXcllo,1707
7
- codespector/reviewer.py,sha256=WoKRO-bFFLKNUiWB_TWoK0rRjenHkJ5fej_lhcj_e2Q,2740
8
- codespector/types.py,sha256=i5PFazyUc5rVq5Fhn4_FsG7R1l617vyjByvnixDUw1Y,1255
9
- codespector-0.2.0.dist-info/METADATA,sha256=YNuCT3bCxjyw46_gFGQdqwTwTOhswYWMqFRTF7eFXD0,3131
10
- codespector-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
- codespector-0.2.0.dist-info/entry_points.txt,sha256=QlHn96KY8vzY1sOweKIuZOAQrSVse6h3v57vkwmHmJg,54
12
- codespector-0.2.0.dist-info/licenses/LICENSE,sha256=Eta34ENUL_dZWy-prVNucMkoA38WIqiO9pKTUYiuT_A,1070
13
- codespector-0.2.0.dist-info/RECORD,,