pyeasyphd 0.1.2__py3-none-any.whl → 0.1.6__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.

Potentially problematic release.


This version of pyeasyphd might be problematic. Click here for more details.

Files changed (41) hide show
  1. pyeasyphd/__init__.py +5 -0
  2. pyeasyphd/data/Templates/CSL/apa-no-ampersand.csl +2183 -0
  3. pyeasyphd/data/Templates/CSL/apa.csl +2133 -0
  4. pyeasyphd/data/Templates/CSL/ieee.csl +512 -0
  5. pyeasyphd/data/Templates/TEX/Article.tex +38 -0
  6. pyeasyphd/data/Templates/TEX/Article_Header.tex +29 -0
  7. pyeasyphd/data/Templates/TEX/Article_Tail.tex +3 -0
  8. pyeasyphd/data/Templates/TEX/Beamer_Header.tex +80 -0
  9. pyeasyphd/data/Templates/TEX/Beamer_Tail.tex +14 -0
  10. pyeasyphd/data/Templates/TEX/Style.tex +249 -0
  11. pyeasyphd/data/Templates/TEX/TEVC_Header.tex +52 -0
  12. pyeasyphd/data/Templates/TEX/TEVC_Tail.tex +4 -0
  13. pyeasyphd/data/Templates/TEX/eisvogel.beamer +700 -0
  14. pyeasyphd/data/Templates/TEX/eisvogel.latex +1040 -0
  15. pyeasyphd/data/Templates/TEX/eisvogel.tex +1064 -0
  16. pyeasyphd/data/Templates/TEX/math.tex +196 -0
  17. pyeasyphd/data/Templates/TEX/math_commands.tex +673 -0
  18. pyeasyphd/main/__init__.py +6 -7
  19. pyeasyphd/main/basic_input.py +59 -77
  20. pyeasyphd/main/pandoc_md_to.py +48 -47
  21. pyeasyphd/main/python_run_md.py +65 -24
  22. pyeasyphd/main/python_run_tex.py +52 -21
  23. pyeasyphd/pyeasyphd.py +20 -6
  24. pyeasyphd/pyeasyphd.sublime-settings +8 -14
  25. pyeasyphd/tools/__init__.py +5 -8
  26. pyeasyphd/tools/generate/generate_from_bibs.py +41 -37
  27. pyeasyphd/tools/generate/generate_html.py +48 -8
  28. pyeasyphd/tools/generate/generate_library.py +39 -26
  29. pyeasyphd/tools/generate/generate_links.py +14 -8
  30. pyeasyphd/tools/py_run_bib_md_tex.py +80 -116
  31. pyeasyphd/tools/search/data.py +12 -48
  32. pyeasyphd/tools/search/search_base.py +37 -11
  33. pyeasyphd/tools/search/search_core.py +108 -38
  34. pyeasyphd/tools/search/search_keywords.py +18 -16
  35. pyeasyphd/tools/search/search_writers.py +94 -34
  36. pyeasyphd/tools/search/utils.py +48 -9
  37. pyeasyphd/utils/utils.py +7 -6
  38. {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/METADATA +3 -3
  39. pyeasyphd-0.1.6.dist-info/RECORD +43 -0
  40. pyeasyphd-0.1.2.dist-info/RECORD +0 -27
  41. {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/WHEEL +0 -0
pyeasyphd/pyeasyphd.py CHANGED
@@ -8,7 +8,12 @@ from pyeasyphd.tools.py_run_bib_md_tex import PyRunBibMdTex
8
8
 
9
9
 
10
10
  def delete_files(path_storage: str, extensions) -> None:
11
- """Delete."""
11
+ """Delete files with specified extensions from storage path.
12
+
13
+ Args:
14
+ path_storage (str): Path to the storage directory.
15
+ extensions: List of file extensions to delete.
16
+ """
12
17
  for name in os.listdir(path_storage):
13
18
  for ext in extensions:
14
19
  if name.endswith(ext) and os.path.isfile(os.path.join(path_storage, name)):
@@ -16,7 +21,16 @@ def delete_files(path_storage: str, extensions) -> None:
16
21
 
17
22
 
18
23
  class PypapersCommand(sublime_plugin.WindowCommand):
24
+ """Sublime Text command for processing papers with various templates."""
25
+
19
26
  def run(self, template="Paper", output_level="next", delete_cache=False):
27
+ """Run the paper processing command.
28
+
29
+ Args:
30
+ template (str, optional): Template type to use. Defaults to "Paper".
31
+ output_level (str, optional): Output level for processing. Defaults to "next".
32
+ delete_cache (bool, optional): Whether to delete cache files. Defaults to False.
33
+ """
20
34
  vars_dict = self.window.extract_variables()
21
35
 
22
36
  packages_path = vars_dict["packages"]
@@ -48,13 +62,13 @@ class PypapersCommand(sublime_plugin.WindowCommand):
48
62
  options[key] = os.path.expandvars(os.path.expanduser(options[key]))
49
63
 
50
64
  if delete_cache:
51
- file_path = vars_dict['file_path']
65
+ file_path = vars_dict["file_path"]
52
66
 
53
- if latex_clean_file_types := options.get('latex_clean_file_types', []):
67
+ if latex_clean_file_types := options.get("latex_clean_file_types", []):
54
68
  postfix = latex_clean_file_types
55
69
  else:
56
- postfix = ['.aux', '.bbl', '.bcf', '.blg', '.fdb_latexmk', '.fls', '.log', '.out', '.run.xml']
57
- postfix.extend(['.synctex.gz', '.gz', '.nav', '.snm', '.toc', '.xdv'])
70
+ postfix = [".aux", ".bbl", ".bcf", ".blg", ".fdb_latexmk", ".fls", ".log", ".out", ".run.xml"]
71
+ postfix.extend([".synctex.gz", ".gz", ".nav", ".snm", ".toc", ".xdv"])
58
72
 
59
73
  delete_files(file_path, postfix)
60
74
  delete_files(os.path.dirname(file_path), postfix)
@@ -69,4 +83,4 @@ class PypapersCommand(sublime_plugin.WindowCommand):
69
83
  p_r_l_m.run_files([vars_dict["file"]], vars_dict["file_base_name"], output_level)
70
84
 
71
85
  # display
72
- self.window.status_message('Successful.')
86
+ self.window.status_message("Successful.")
@@ -1,14 +1,4 @@
1
1
  {
2
- // config
3
- // config path
4
- // Must be configured by the user.
5
- "path_config": "",
6
-
7
- // figures, templates, bibs
8
- "path_bibs": "",
9
- "path_figures": "",
10
- "path_templates": "",
11
-
12
2
  // pyeasyphd/main/pandoc_md_to.py
13
3
  // for pandoc
14
4
  "csl_name": "apa-no-ampersand",
@@ -56,15 +46,19 @@
56
46
  ],
57
47
 
58
48
  // pyeasyphd/tools/python_run_latex_md.py
49
+ // Path to bibliographic data, can be either a directory path or a specific file path
50
+ "bib_path_or_file": "",
51
+
52
+ // Path to the figures directory (must be a directory path, not a file)
53
+ "figures_directory": "",
54
+ // ture, false
55
+ "shutil_figures": true,
56
+
59
57
  // true, false
60
58
  "generate_html": false,
61
-
62
59
  // true, false
63
60
  "generate_tex": true,
64
61
 
65
- // ture, false
66
- "shutil_figures": true,
67
-
68
62
  // for figure, bib, tex, and md
69
63
  "figure_folder_name": "fig", // "" or "figs" or "main"
70
64
  "bib_folder_name": "bib", // "" or "bibs" or "main"
@@ -1,13 +1,10 @@
1
- """Initialization."""
1
+ """Tools module for PyEasyPhD advanced functionality.
2
2
 
3
- __all__ = [
4
- "PyRunBibMdTex",
3
+ This module provides advanced tools for bibliography processing,
4
+ search functionality, and content generation.
5
+ """
5
6
 
6
- "Searchkeywords",
7
-
8
- "generate_from_bibs_and_write",
9
- "PaperLinksGenerator",
10
- ]
7
+ __all__ = ["PyRunBibMdTex", "Searchkeywords", "generate_from_bibs_and_write", "PaperLinksGenerator"]
11
8
 
12
9
  from .generate.generate_from_bibs import generate_from_bibs_and_write
13
10
  from .generate.generate_links import PaperLinksGenerator
@@ -5,7 +5,7 @@ from typing import Any, Dict, List, Union
5
5
  from pyadvtools import standard_path, write_list
6
6
  from pybibtexer.tools.experiments_base import generate_standard_publisher_abbr_options_dict
7
7
 
8
- from ...main import BasicInput, PandocMdTo
8
+ from ...main import PandocMdTo
9
9
  from .generate_html import generate_html_content, generate_html_from_bib_data
10
10
  from .generate_library import generate_library_by_filters
11
11
 
@@ -21,20 +21,26 @@ def preparation(
21
21
  ):
22
22
  """Prepare paths and flags for data generation.
23
23
 
24
- Examples
25
- --------
26
- | | current_issue | current_month | all_months |
27
- |--------------|---------------|---------------|------------|
28
- | current_year | YES | YES | YES |
29
- | all_years | NO | NO | YES |
30
- | given_years | NO | NO | YES |
31
-
32
- given_years = ["2020", "2025"]
33
-
34
- Returns
35
- -------
36
- Tuple[str, str, bool]
37
- Returns (path_root, path_output, combine_flag)
24
+ Args:
25
+ path_storage (str): Path to storage directory.
26
+ path_output (str): Path to output directory.
27
+ output_basename (str): Base name for output files.
28
+ pub_type (str): Type of publication.
29
+ issue_or_month_flag (Union[str, List[str]], optional): Issue or month flag. Defaults to "current_issue".
30
+ year_flag (Union[str, List[str]], optional): Year flag. Defaults to "current_year".
31
+ options (Dict[str, Any], optional): Additional options. Defaults to {}.
32
+
33
+ Examples:
34
+ | | current_issue | current_month | all_months |
35
+ |--------------|---------------|---------------|------------|
36
+ | current_year | YES | YES | YES |
37
+ | all_years | NO | NO | YES |
38
+ | given_years | NO | NO | YES |
39
+
40
+ given_years = ["2020", "2025"]
41
+
42
+ Returns:
43
+ Tuple[str, str, bool]: Returns (path_root, path_output, combine_flag).
38
44
  """
39
45
  # default settings
40
46
  path_storage = standard_path(path_storage)
@@ -77,31 +83,20 @@ def generate_from_bibs_and_write(
77
83
  ) -> None:
78
84
  """Generate or combine data from bibliographies.
79
85
 
80
- Parameters
81
- ----------
82
- path_storage : str
83
- Path to storage directory
84
- path_output : str
85
- Path to output directory
86
- generate_or_combine : str
87
- Either "generate_data" or "combine_data"
88
- year_flag : Union[str, List[str]], optional
89
- Flag for year selection, by default "current_year"
90
- issue_or_month_flag : Union[str, List[str]], optional
91
- Flag for issue/month selection, by default "current_issue"
92
- options : Dict[str, Any], optional
93
- Additional options, by default {}
86
+ Args:
87
+ path_storage (str): Path to storage directory.
88
+ path_output (str): Path to output directory.
89
+ output_basename (str): Base name for output files.
90
+ pub_type (str): Type of publication.
91
+ generate_or_combine (str): Either "generate_data" or "combine_data".
92
+ year_flag (Union[str, List[str]], optional): Flag for year selection. Defaults to "current_year".
93
+ issue_or_month_flag (Union[str, List[str]], optional): Flag for issue/month selection. Defaults to "current_issue".
94
+ options (Dict[str, Any], optional): Additional options. Defaults to {}.
94
95
  """
95
96
  path_root, path_output, combine_flag = preparation(
96
97
  path_storage, path_output, output_basename, pub_type, issue_or_month_flag, year_flag, options
97
98
  )
98
99
 
99
- # Default settings
100
- x = BasicInput(options)
101
- options = x.options
102
- full_json_c = x.full_json_c
103
- full_json_j = x.full_json_j
104
-
105
100
  if generate_or_combine == "generate_data":
106
101
  publisher_abbr_dict = generate_standard_publisher_abbr_options_dict(path_storage, options)
107
102
  for publisher in publisher_abbr_dict:
@@ -123,11 +118,11 @@ def generate_from_bibs_and_write(
123
118
 
124
119
  # Generate and process library
125
120
  library = generate_library_by_filters(
126
- path_abbr, issue_or_month_flag, year_flag, new_options, full_json_c, full_json_j
121
+ path_abbr, issue_or_month_flag, year_flag, new_options
127
122
  )
128
123
 
129
124
  # Generate md, tex, pdf, html
130
- html_body = generate_html_from_bib_data(abbr, library, pp, new_options, full_json_c, full_json_j)
125
+ html_body = generate_html_from_bib_data(abbr, library, pp, new_options)
131
126
  if combine_flag and html_body:
132
127
  publisher_html_body.extend(html_body + ["\n"])
133
128
 
@@ -143,6 +138,15 @@ def generate_from_bibs_and_write(
143
138
 
144
139
 
145
140
  def _combine_data(path_storage, path_root, path_output, combine_flag, options):
141
+ """Combine data from multiple sources.
142
+
143
+ Args:
144
+ path_storage: Path to storage directory.
145
+ path_root: Root path for output.
146
+ path_output: Path to output directory.
147
+ combine_flag: Flag indicating whether to combine data.
148
+ options: Configuration options.
149
+ """
146
150
  # Compulsory
147
151
  options["include_abbr_list"] = []
148
152
  options["exclude_abbr_list"] = []
@@ -9,7 +9,15 @@ from ...utils.utils import html_head, html_style, html_tail, textarea_header, te
9
9
 
10
10
 
11
11
  def generate_html_content(html_body, abbr_standard):
12
- """Create complete HTML document from body content."""
12
+ """Create complete HTML document from body content.
13
+
14
+ Args:
15
+ html_body: List of HTML body content lines.
16
+ abbr_standard (str): Standard abbreviation for the document.
17
+
18
+ Returns:
19
+ List[str]: Complete HTML document as list of lines.
20
+ """
13
21
  return [html_head.format(abbr_standard), html_style, "\n"] + html_body + [html_tail]
14
22
 
15
23
 
@@ -18,10 +26,20 @@ def generate_html_from_bib_data(
18
26
  original_bib_data: Union[List[str], str, Library],
19
27
  path_output: str,
20
28
  options: Dict[str, Any] = {},
21
- full_json_c: str = "",
22
- full_json_j: str = ""
23
29
  ) -> List[str]:
24
- """Generate html from bibliography data."""
30
+ """Generate HTML from bibliography data.
31
+
32
+ Args:
33
+ abbr_standard (str): Standard abbreviation for the publication.
34
+ original_bib_data (Union[List[str], str, Library]): Bibliography data in various formats.
35
+ path_output (str): Path to output directory.
36
+ options (Dict[str, Any], optional): Additional processing options. Defaults to {}.
37
+ full_json_c (str, optional): Path to conferences JSON file. Defaults to "".
38
+ full_json_j (str, optional): Path to journals JSON file. Defaults to "".
39
+
40
+ Returns:
41
+ List[str]: List of HTML body content lines.
42
+ """
25
43
  # Set processing options
26
44
  processing_options: dict = {
27
45
  # convert_str_to_library
@@ -49,10 +67,10 @@ def generate_html_from_bib_data(
49
67
  processing_options.update(options)
50
68
 
51
69
  # Process bibliography data
52
- _python_bib = PythonRunBib(full_json_c, full_json_j, processing_options)
70
+ _python_bib = PythonRunBib(processing_options)
53
71
  _, zotero_library, _ = _python_bib.parse_to_multi_standard_library(original_bib_data)
54
72
 
55
- _python_writer = PythonWriters(full_json_c, full_json_j, processing_options)
73
+ _python_writer = PythonWriters(processing_options)
56
74
 
57
75
  # Generate HTML content for each entry
58
76
  html_body = []
@@ -77,7 +95,16 @@ def generate_html_from_bib_data(
77
95
 
78
96
 
79
97
  def _format_entry_to_html(entry, abbr, data_list):
80
- """Format a single bibliography entry into HTML."""
98
+ """Format a single bibliography entry into HTML.
99
+
100
+ Args:
101
+ entry: Bibliography entry dictionary.
102
+ abbr (str): Publication abbreviation.
103
+ data_list: List of formatted bibliography data.
104
+
105
+ Returns:
106
+ str: HTML formatted entry string.
107
+ """
81
108
  # Extract entry fields
82
109
  number = entry["number"] if "number" in entry else ""
83
110
  pages = entry["pages"] if "pages" in entry else ""
@@ -103,7 +130,20 @@ def _format_entry_to_html(entry, abbr, data_list):
103
130
 
104
131
 
105
132
  def _format_entry_to_apa_style(title, year, volume, number, pages, url, abbr):
106
- """Format entry in APA citation style."""
133
+ """Format entry in APA citation style.
134
+
135
+ Args:
136
+ title (str): Article title.
137
+ year (str): Publication year.
138
+ volume (str): Journal volume.
139
+ number (str): Issue number.
140
+ pages (str): Page numbers.
141
+ url (str): Article URL.
142
+ abbr (str): Publication abbreviation.
143
+
144
+ Returns:
145
+ str: APA formatted citation string.
146
+ """
107
147
  line = f"({year}). {title}. <em>{abbr}</em>"
108
148
 
109
149
  if volume:
@@ -10,30 +10,19 @@ def generate_library_by_filters(
10
10
  issue_or_month_flag: Union[str, List[str]], # filter
11
11
  year_flag: Union[str, List[str]] = "current_year", # filter
12
12
  options: Dict[str, Any] = {},
13
- full_json_c: str = "",
14
- full_json_j: str = ""
15
13
  ) -> Library:
16
14
  """Generate a Library object from input data with given filters.
17
15
 
18
- Parameters
19
- ----------
20
- original_data : Union[List[str], str, Library]
21
- Input bibliography data
22
- issue_or_month_flag : Union[str, List[str]]
23
- Flag for issue/month selection
24
- year_flag : Union[str, List[str]], optional
25
- Flag for year selection, by default "current_year"
26
- options : Dict[str, Any], optional
27
- Additional options, by default {}
28
- full_json_c : str, optional
29
- JSON configuration for conference proceedings, by default "".
30
- full_json_j : str, optional
31
- JSON configuration for journal articles, by default "".
32
-
33
- Returns
34
- -------
35
- Library
36
- Processed library object
16
+ Args:
17
+ original_data (Union[List[str], str, Library]): Input bibliography data.
18
+ issue_or_month_flag (Union[str, List[str]]): Flag for issue/month selection.
19
+ year_flag (Union[str, List[str]], optional): Flag for year selection. Defaults to "current_year".
20
+ options (Dict[str, Any], optional): Additional options. Defaults to {}.
21
+ full_json_c (str, optional): JSON configuration for conference proceedings. Defaults to "".
22
+ full_json_j (str, optional): JSON configuration for journal articles. Defaults to "".
23
+
24
+ Returns:
25
+ Library: Processed library object.
37
26
  """
38
27
  _options = {}
39
28
  # convert_str_to_library
@@ -62,7 +51,7 @@ def generate_library_by_filters(
62
51
  _options["substitute_in_bib"] = False # default is True
63
52
 
64
53
  _options.update(options)
65
- _python_bib = PythonRunBib(full_json_c, full_json_j, _options)
54
+ _python_bib = PythonRunBib(_options)
66
55
 
67
56
  # Generate nested entries dictionary
68
57
  entry_type_year_volume_number_month_entry_dict = _python_bib.parse_to_nested_entries_dict(original_data)
@@ -87,7 +76,15 @@ def _obtain_year_flag_library(
87
76
  nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
88
77
  year_flag: Union[str, List[str]] = "current_year",
89
78
  ):
90
- """Filter dict by year flag."""
79
+ """Filter dictionary by year flag.
80
+
81
+ Args:
82
+ nested_entries: Nested dictionary containing bibliography entries.
83
+ year_flag (Union[str, List[str]], optional): Year filter flag. Defaults to "current_year".
84
+
85
+ Returns:
86
+ Dict: Filtered dictionary by year.
87
+ """
91
88
  new_dict = {}
92
89
  for entry_type in nested_entries:
93
90
  years = [year for year in nested_entries[entry_type]]
@@ -111,9 +108,17 @@ def _obtain_year_flag_library(
111
108
 
112
109
  def _obtain_issue_flag_library(
113
110
  nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
114
- issue_flag: str = "current_issue"
111
+ issue_flag: str = "current_issue",
115
112
  ) -> Library:
116
- """Filter dict by issue flag."""
113
+ """Filter dictionary by issue flag.
114
+
115
+ Args:
116
+ nested_entries: Nested dictionary containing bibliography entries.
117
+ issue_flag (str, optional): Issue filter flag. Defaults to "current_issue".
118
+
119
+ Returns:
120
+ Library: Filtered library object.
121
+ """
117
122
  nested_entries = IterateSortDict(True).dict_update(nested_entries)
118
123
 
119
124
  entries = []
@@ -149,7 +154,15 @@ def _obtain_month_flag_library(
149
154
  nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
150
155
  month_flag: Union[str, List[str]] = "current_month",
151
156
  ) -> Library:
152
- """Filter dict by month flag."""
157
+ """Filter dictionary by month flag.
158
+
159
+ Args:
160
+ nested_entries: Nested dictionary containing bibliography entries.
161
+ month_flag (Union[str, List[str]], optional): Month filter flag. Defaults to "current_month".
162
+
163
+ Returns:
164
+ Library: Filtered library object.
165
+ """
153
166
  new_dict = {}
154
167
  for entry_type in nested_entries:
155
168
  for year in nested_entries[entry_type]:
@@ -19,12 +19,14 @@ class PaperLinksGenerator(object):
19
19
  keywords_category_name: str = "",
20
20
  display_year_period: int = 10,
21
21
  ):
22
- """
23
- Initialize the generator with base paths.
22
+ """Initialize the generator with base paths.
24
23
 
25
24
  Args:
26
- json_base_path: Path to JSON files directory
27
- data_base_path: Path to data files directory
25
+ full_json_c (str): Path to conferences JSON file.
26
+ full_json_j (str): Path to journals JSON file.
27
+ data_base_path (str): Path to data files directory.
28
+ keywords_category_name (str, optional): Category name for keywords. Defaults to "".
29
+ display_year_period (int, optional): Number of years to display. Defaults to 10.
28
30
  """
29
31
  self.full_json_c = full_json_c
30
32
  self.full_json_j = full_json_j
@@ -46,11 +48,11 @@ class PaperLinksGenerator(object):
46
48
  self.display_year_period = display_year_period
47
49
 
48
50
  def generate_yearly_links(self, cj: str, folder_name=os.path.join("data", "Yearly")) -> None:
49
- """
50
- Generate yearly markdown table with paper links.
51
+ """Generate yearly markdown table with paper links.
51
52
 
52
53
  Args:
53
- cj: Publication type - 'conferences' or 'journals'
54
+ cj (str): Publication type - 'conferences' or 'journals'.
55
+ folder_name (str, optional): Output folder name. Defaults to "data/Yearly".
54
56
  """
55
57
  flags = self._get_yearly_flags(cj)
56
58
  folder_flags = [f"{f}_all_months" for f in flags]
@@ -58,7 +60,11 @@ class PaperLinksGenerator(object):
58
60
  self._generate_links(cj, flags, folder_flags, folder_name)
59
61
 
60
62
  def generate_weekly_links(self, folder_name=os.path.join("data", "Weekly")) -> None:
61
- """Generate weekly markdown table with journal paper links."""
63
+ """Generate weekly markdown table with journal paper links.
64
+
65
+ Args:
66
+ folder_name (str, optional): Output folder name. Defaults to "data/Weekly".
67
+ """
62
68
  cj = "Journals"
63
69
 
64
70
  flags = ["Current Issue", "Current Month", "All Months"]