pyOpenSourceProjects 0.2.2__tar.gz → 0.2.3__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 (24) hide show
  1. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/PKG-INFO +4 -3
  2. pyopensourceprojects-0.2.3/osprojects/__init__.py +1 -0
  3. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/osprojects/checkos.py +70 -7
  4. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/pyproject.toml +4 -2
  5. pyopensourceprojects-0.2.2/osprojects/__init__.py +0 -1
  6. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/.github/workflows/build.yml +0 -0
  7. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/.github/workflows/upload-to-pypi.yml +0 -0
  8. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/.gitignore +0 -0
  9. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/.project +0 -0
  10. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/.pydevproject +0 -0
  11. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/LICENSE +0 -0
  12. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/README.md +0 -0
  13. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/mkdocs.yml +0 -0
  14. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/osprojects/editor.py +0 -0
  15. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/osprojects/osproject.py +0 -0
  16. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/blackisort +0 -0
  17. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/doc +0 -0
  18. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/install +0 -0
  19. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/installAndTest +0 -0
  20. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/release +0 -0
  21. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/scripts/test +0 -0
  22. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/tests/__init__.py +0 -0
  23. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/tests/basetest.py +0 -0
  24. {pyopensourceprojects-0.2.2 → pyopensourceprojects-0.2.3}/tests/test_osproject.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyOpenSourceProjects
3
- Version: 0.2.2
3
+ Version: 0.2.3
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
@@ -15,9 +15,10 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Requires-Python: >=3.9
18
+ Requires-Dist: gitpython
18
19
  Requires-Dist: packaging>=24.1
19
- Requires-Dist: py-3rdparty-mediawiki>=0.11.3
20
- Requires-Dist: pylodstorage>=0.11.6
20
+ Requires-Dist: py-3rdparty-mediawiki>=0.12.0
21
+ Requires-Dist: pylodstorage>=0.12.2
21
22
  Requires-Dist: python-dateutil>=2.8.2
22
23
  Provides-Extra: test
23
24
  Description-Content-Type: text/markdown
@@ -0,0 +1 @@
1
+ __version__ = "0.2.3"
@@ -8,6 +8,8 @@ import argparse
8
8
  import os
9
9
  from argparse import Namespace
10
10
  from dataclasses import dataclass
11
+ from git import Repo
12
+ from git.exc import InvalidGitRepositoryError, NoSuchPathError
11
13
  from typing import List
12
14
  # original at ngwidgets - use redundant local copy ...
13
15
  from osprojects.editor import Editor
@@ -93,6 +95,9 @@ class CheckOS:
93
95
  return local
94
96
 
95
97
  def check_github_workflows(self):
98
+ """
99
+ check the github workflow files
100
+ """
96
101
  workflows_path = os.path.join(self.project_path, ".github", "workflows")
97
102
  workflows_exist = self.add_path_check(workflows_path)
98
103
 
@@ -170,6 +175,9 @@ class CheckOS:
170
175
  def check_readme(self):
171
176
  readme_path = os.path.join(self.project_path, "README.md")
172
177
  readme_exists = self.add_path_check(readme_path)
178
+ if not hasattr(self, "project_name"):
179
+ self.add_check(False, "project_name from pyproject.toml needed for README.md check", self.project_path)
180
+ return
173
181
  if readme_exists.ok:
174
182
  readme_content = readme_exists.content
175
183
  badge_lines = [
@@ -190,7 +198,7 @@ class CheckOS:
190
198
  )
191
199
  self.add_content_check(readme_content, "readthedocs", readme_path, negative=True)
192
200
 
193
- def check_pyproject_toml(self):
201
+ def check_pyproject_toml(self)->bool:
194
202
  """
195
203
  pyproject.toml
196
204
  """
@@ -215,18 +223,63 @@ class CheckOS:
215
223
  self.add_content_check(content, needle, toml_path)
216
224
  self.add_content_check(content, "hatchling", toml_path)
217
225
  self.add_content_check(content,"[tool.hatch.build.targets.wheel.sources]",toml_path)
226
+ return toml_exists.ok
227
+
228
+ def check_git(self):
229
+ """
230
+ Check git repository information using gitpython
231
+ """
232
+ try:
233
+ repo = Repo(self.project_path)
234
+
235
+ # Check if it's actually a git repository
236
+ if not repo.bare:
237
+ self.add_check(True, "Is a git repository", self.project_path)
238
+
239
+ # Get the remote URL
240
+ try:
241
+ remote_url = repo.remotes.origin.url
242
+ self.add_check(True, "Has remote origin", self.project_path)
243
+
244
+ # Extract owner and repository name from the URL
245
+ parts = remote_url.split('/')
246
+ git_owner = parts[-2]
247
+ git_repo = parts[-1].replace('.git', '')
218
248
 
249
+ # Compare with the project information we have
250
+ owner_match = git_owner.lower() == self.project.owner.lower()
251
+ self.add_check(owner_match, f"Git owner ({git_owner}) matches project owner ({self.project.owner})", self.project_path)
219
252
 
220
- def check(self,title:str):
253
+ repo_match = git_repo.lower() == self.project.id.lower()
254
+ self.add_check(repo_match, f"Git repo name ({git_repo}) matches project id ({self.project.id})", self.project_path)
255
+
256
+ except AttributeError:
257
+ self.add_check(False, "No remote origin found", self.project_path)
258
+
259
+ # Check if there are uncommitted changes
260
+ if repo.is_dirty():
261
+ self.add_check(False, "Repository has uncommitted changes", self.project_path)
262
+ else:
263
+ self.add_check(True, "Repository is clean", self.project_path)
264
+
265
+ else:
266
+ self.add_check(False, "Not a valid git repository (bare repository)", self.project_path)
267
+
268
+ except InvalidGitRepositoryError:
269
+ self.add_check(False, "Not a valid git repository", self.project_path)
270
+ except NoSuchPathError:
271
+ self.add_check(False, "Git repository path does not exist", self.project_path)
272
+
273
+ def check(self, title:str):
221
274
  """
222
275
  Check the given project and print results
223
276
  """
224
277
  self.check_local()
225
- self.check_pyproject_toml()
226
- self.check_github_workflows()
227
- self.check_readme()
228
- self.check_scripts()
229
-
278
+ self.check_git()
279
+ if self.check_pyproject_toml():
280
+ self.check_github_workflows()
281
+ self.check_readme()
282
+ self.check_scripts()
230
283
 
231
284
  # ok_count=len(ok_checks)
232
285
  failed_count = len(self.failed_checks)
@@ -322,6 +375,16 @@ def main(_argv=None):
322
375
  local_projects.append(project)
323
376
  projects = local_projects
324
377
 
378
+ # filter for git ownership
379
+ filtered_projects = []
380
+ for project in projects:
381
+ checker = CheckOS(args=args, project=project)
382
+ checker.check_git()
383
+ git_owner_check = next((check for check in checker.checks if "Git owner" in check.msg), None)
384
+ if git_owner_check and git_owner_check.ok:
385
+ filtered_projects.append(project)
386
+ projects = filtered_projects
387
+
325
388
  for i,project in enumerate(projects):
326
389
  checker = CheckOS(args=args, project=project)
327
390
  checker.check(f"{i+1:3}:")
@@ -15,8 +15,10 @@ readme = "README.md"
15
15
  license = "Apache-2.0"
16
16
 
17
17
  dependencies = [
18
- "pyLodStorage>=0.11.6",
19
- "py-3rdparty-mediawiki>=0.11.3",
18
+ # https://pypi.org/project/GitPython/
19
+ "gitpython",
20
+ "pyLodStorage>=0.12.2",
21
+ "py-3rdparty-mediawiki>=0.12.0",
20
22
  # https://pypi.org/project/python-dateutil/
21
23
  "python-dateutil>=2.8.2",
22
24
  # https://github.com/pypa/packaging
@@ -1 +0,0 @@
1
- __version__ = "0.2.2"