pyOpenSourceProjects 0.2.1__tar.gz → 0.2.2__tar.gz

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.
Files changed (25) hide show
  1. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/.github/workflows/build.yml +4 -4
  2. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/PKG-INFO +1 -1
  3. pyopensourceprojects-0.2.2/osprojects/__init__.py +1 -0
  4. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/osprojects/checkos.py +25 -11
  5. pyopensourceprojects-0.2.2/scripts/test +132 -0
  6. pyopensourceprojects-0.2.1/osprojects/__init__.py +0 -1
  7. pyopensourceprojects-0.2.1/scripts/test +0 -9
  8. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/.github/workflows/upload-to-pypi.yml +0 -0
  9. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/.gitignore +0 -0
  10. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/.project +0 -0
  11. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/.pydevproject +0 -0
  12. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/LICENSE +0 -0
  13. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/README.md +0 -0
  14. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/mkdocs.yml +0 -0
  15. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/osprojects/editor.py +0 -0
  16. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/osprojects/osproject.py +0 -0
  17. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/pyproject.toml +0 -0
  18. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/scripts/blackisort +0 -0
  19. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/scripts/doc +0 -0
  20. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/scripts/install +0 -0
  21. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/scripts/installAndTest +0 -0
  22. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/scripts/release +0 -0
  23. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/tests/__init__.py +0 -0
  24. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/tests/basetest.py +0 -0
  25. {pyopensourceprojects-0.2.1 → pyopensourceprojects-0.2.2}/tests/test_osproject.py +0 -0
@@ -18,10 +18,10 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  strategy:
20
20
  matrix:
21
- os: [ubuntu-latest, macos-latest, windows-latest]
22
- #os: [ubuntu-latest]
23
- python-version: [ 3.9, '3.10', '3.11', '3.12' ]
24
- #python-version: ["3.10"]
21
+ #os: [ubuntu-latest, macos-latest, windows-latest]
22
+ os: [ubuntu-latest]
23
+ #python-version: [ '3.9', '3.10', '3.11', '3.12' ]
24
+ python-version: ["3.10"]
25
25
 
26
26
  steps:
27
27
  - uses: actions/checkout@v4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyOpenSourceProjects
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Dynamic: Summary
5
5
  Project-URL: Home, https://github.com/WolfgangFahl/pyOpenSourceProjects
6
6
  Project-URL: Documentation, http://wiki.bitplan.com/index.php/pyOpenSourceProjects
@@ -0,0 +1 @@
1
+ __version__ = "0.2.2"
@@ -49,6 +49,8 @@ class CheckOS:
49
49
  self.project = project
50
50
  self.project_path = os.path.join(self.workspace, project.id)
51
51
  self.checks = []
52
+ # python 3.12 is max version
53
+ self.max_python_version_minor=12
52
54
 
53
55
  @property
54
56
  def total(self) -> int:
@@ -104,8 +106,9 @@ class CheckOS:
104
106
  content = file_exists.content
105
107
 
106
108
  if file == "build.yml":
107
- min_version = int(self.requires_python.split('.')[-1])
108
- python_versions = f"""python-version: [ {', '.join([f"'3.{i}'" for i in range(min_version, 13)])} ]"""
109
+ min_python_version_minor = int(self.requires_python.split('.')[-1])
110
+ self.add_check(min_python_version_minor==self.min_python_version_minor,msg=f"{min_python_version_minor} (build.yml)!={self.min_python_version_minor} (pyprojec.toml)",path=file_path)
111
+ python_versions = f"""python-version: [ {', '.join([f"'3.{i}'" for i in range(self.min_python_version_minor, self.max_python_version_minor+1)])} ]"""
109
112
  self.add_content_check(
110
113
  content,
111
114
  python_versions,
@@ -159,8 +162,10 @@ class CheckOS:
159
162
  if file=="doc":
160
163
  self.add_content_check(content, "sphinx", file_path, negative=True)
161
164
  self.add_content_check(content,"WF 2024-07-30 - updated",file_path)
165
+ if file=="test":
166
+ self.add_content_check(content,"WF 2024-08-03",file_path)
162
167
  if file=="release":
163
- self.add_content_check(content, "scripts/docs -d", file_path, negative=True)
168
+ self.add_content_check(content, "scripts/doc -d", file_path)
164
169
 
165
170
  def check_readme(self):
166
171
  readme_path = os.path.join(self.project_path, "README.md")
@@ -186,6 +191,9 @@ class CheckOS:
186
191
  self.add_content_check(readme_content, "readthedocs", readme_path, negative=True)
187
192
 
188
193
  def check_pyproject_toml(self):
194
+ """
195
+ pyproject.toml
196
+ """
189
197
  toml_path = os.path.join(self.project_path, "pyproject.toml")
190
198
  toml_exists = self.add_path_check(toml_path)
191
199
  if toml_exists.ok:
@@ -197,27 +205,33 @@ class CheckOS:
197
205
  requires_python_check=self.add_check("requires-python" in toml_dict["project"], "requires-python", toml_path)
198
206
  if requires_python_check.ok:
199
207
  self.requires_python = toml_dict["project"]["requires-python"]
200
- self.min_python_version = version.parse(self.requires_python.replace(">=", ""))
208
+ min_python_version = version.parse(self.requires_python.replace(">=", ""))
201
209
  min_version_needed="3.9"
202
- version_ok=self.min_python_version >= version.parse(min_version_needed)
210
+ version_ok=min_python_version >= version.parse(min_version_needed)
203
211
  self.add_check(version_ok, f"requires-python>={min_version_needed}", toml_path)
212
+ self.min_python_version_minor=int(str(min_python_version).split('.')[-1])
213
+ for minor_version in range(self.min_python_version_minor, self.max_python_version_minor+1):
214
+ needle=f"Programming Language :: Python :: 3.{minor_version}"
215
+ self.add_content_check(content, needle, toml_path)
204
216
  self.add_content_check(content, "hatchling", toml_path)
205
217
  self.add_content_check(content,"[tool.hatch.build.targets.wheel.sources]",toml_path)
206
218
 
207
- def check(self):
219
+
220
+ def check(self,title:str):
208
221
  """
209
222
  Check the given project and print results
210
223
  """
211
224
  self.check_local()
212
225
  self.check_pyproject_toml()
226
+ self.check_github_workflows()
213
227
  self.check_readme()
214
228
  self.check_scripts()
215
- self.check_github_workflows()
229
+
216
230
 
217
231
  # ok_count=len(ok_checks)
218
232
  failed_count = len(self.failed_checks)
219
- summary = f"❌ {failed_count}/{self.total}" if failed_count > 0 else f"✅ {self.total}/{self.total}"
220
- print(f"{self.project} {summary}: {self.project.url}")
233
+ summary = f"❌ {failed_count:2}/{self.total:2}" if failed_count > 0 else f"✅ {self.total:2}/{self.total:2}"
234
+ print(f"{title}{summary}:{self.project}→{self.project.url}")
221
235
  if failed_count > 0:
222
236
  # Sort checks by path
223
237
  sorted_checks = sorted(self.checks, key=lambda c: c.path or "")
@@ -308,9 +322,9 @@ def main(_argv=None):
308
322
  local_projects.append(project)
309
323
  projects = local_projects
310
324
 
311
- for project in projects:
325
+ for i,project in enumerate(projects):
312
326
  checker = CheckOS(args=args, project=project)
313
- checker.check()
327
+ checker.check(f"{i+1:3}:")
314
328
  except Exception as ex:
315
329
  if args.debug:
316
330
  print(traceback.format_exc())
@@ -0,0 +1,132 @@
1
+ #!/bin/bash
2
+ # WF 2022-08-20
3
+ # WF 2024-08-03
4
+
5
+ #ansi colors
6
+ #http://www.csc.uvic.ca/~sae/seng265/fall04/tips/s265s047-tips/bash-using-colors.html
7
+ blue='\033[0;34m'
8
+ red='\033[0;31m'
9
+ green='\033[0;32m' # '\e[1;32m' is too bright for white bg.
10
+ endColor='\033[0m'
11
+
12
+ #
13
+ # a colored message
14
+ # params:
15
+ # 1: l_color - the color of the message
16
+ # 2: l_msg - the message to display
17
+ #
18
+ color_msg() {
19
+ local l_color="$1"
20
+ local l_msg="$2"
21
+ echo -e "${l_color}$l_msg${endColor}"
22
+ }
23
+
24
+ #
25
+ # error
26
+ #
27
+ # show the given error message on stderr and exit
28
+ #
29
+ # params:
30
+ # 1: l_msg - the error message to display
31
+ #
32
+ error() {
33
+ local l_msg="$1"
34
+ # use ansi red for error
35
+ color_msg $red "Error:" 1>&2
36
+ color_msg $red "\t$l_msg" 1>&2
37
+ exit 1
38
+ }
39
+
40
+ #
41
+ # show a negative message
42
+ #
43
+ negative() {
44
+ local l_msg="$1"
45
+ color_msg $red "❌:$l_msg"
46
+ }
47
+
48
+ #
49
+ # show a positive message
50
+ #
51
+ positive() {
52
+ local l_msg="$1"
53
+ color_msg $green "✅:$l_msg"
54
+ }
55
+
56
+ # show usage
57
+ #
58
+ usage() {
59
+ echo "$0 [-g|--green|-m|--module|-t|--tox|-h|--help]"
60
+ echo "-t |--tox: run tests with tox"
61
+ echo "-g |--green: run tests with green"
62
+ echo "-m |--module: run modulewise test"
63
+ echo "-h |--help: show this usage"
64
+ echo "default is running tests with unittest discover"
65
+ exit 1
66
+ }
67
+
68
+ #
69
+ # check and optional install the given package
70
+ #
71
+ check_package() {
72
+ local l_package="$1"
73
+ pip show $l_package > /dev/null
74
+ if [ $? -ne 0 ]
75
+ then
76
+ negative "$l_package"
77
+ color_msg $blue "installing $l_package"
78
+ pip install $l_package
79
+ else
80
+ positive "$l_package"
81
+ fi
82
+ }
83
+
84
+ #
85
+ # test module by module
86
+ #
87
+ modulewise_test() {
88
+ foundErrors=0
89
+ foundTests=0
90
+ for testmodule in tests/test*.py
91
+ do
92
+ echo "testing $testmodule ..."
93
+ # see https://github.com/CleanCut/green/issues/263
94
+ #green $testmodule -s1
95
+ python -m unittest $testmodule
96
+ exit_code=$?
97
+ foundErrors=$((foundErrors+exit_code))
98
+ foundTests=$((foundTests+1))
99
+ done
100
+ echo "$foundErrors/$foundTests module unit tests failed" 1>&2
101
+ if [[ $foundErrors -gt 0 ]]
102
+ then
103
+ exit 1
104
+ fi
105
+ }
106
+
107
+ export PYTHON_PATH="."
108
+ while [ "$1" != "" ]
109
+ do
110
+ option="$1"
111
+ case $option in
112
+ -h|--help)
113
+ usage
114
+ exit 0
115
+ ;;
116
+ -g|--green)
117
+ check_package green
118
+ green tests -s 1
119
+ exit 0
120
+ ;;
121
+ -m|--module)
122
+ modulewise_test
123
+ exit 0
124
+ ;;
125
+ -t|--tox)
126
+ check_package tox
127
+ tox -e py
128
+ exit 0
129
+ ;;
130
+ esac
131
+ done
132
+ python3 -m unittest discover
@@ -1 +0,0 @@
1
- __version__ = "0.2.1"
@@ -1,9 +0,0 @@
1
- #!/bin/bash
2
- # WF 2020-06-03
3
- #python3 -m unittest discover
4
- pip list | egrep "^green "
5
- if [ $? -ne 0 ]
6
- then
7
- pip install green
8
- fi
9
- green