uEdition-Editor 2.0.0b6__tar.gz → 2.0.0b7__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.

Potentially problematic release.


This version of uEdition-Editor might be problematic. Click here for more details.

Files changed (32) hide show
  1. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/PKG-INFO +2 -2
  2. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/pyproject.toml +1 -1
  3. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/__about__.py +1 -1
  4. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/branches.py +3 -0
  5. uedition_editor-2.0.0b7/uedition_editor/cron.py +63 -0
  6. uedition_editor-2.0.0b6/uedition_editor/cron.py +0 -57
  7. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/.gitignore +0 -0
  8. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/.pre-commit-config.yaml +0 -0
  9. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/Containerfile +0 -0
  10. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/LICENSE.txt +0 -0
  11. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/README.md +0 -0
  12. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/__init__.py +0 -0
  13. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/__main__.py +0 -0
  14. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/__init__.py +0 -0
  15. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/auth.py +0 -0
  16. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/configs.py +0 -0
  17. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/files.py +0 -0
  18. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/tests.py +0 -0
  19. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/api/util.py +0 -0
  20. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/cli/__init__.py +0 -0
  21. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/CodeMirrorEditor-BAn1Wzpi.js +0 -0
  22. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/CodeMirrorEditor-ddcHt3UE.css +0 -0
  23. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/FolderEditor-BrlMJ9kW.js +0 -0
  24. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/ImageEditor-Byg6QDjZ.js +0 -0
  25. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/TeiEditor-CjT57X2c.js +0 -0
  26. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/index-D6QIwXwq.js +0 -0
  27. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/index-HmBQiVS_.css +0 -0
  28. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/assets/index-Vcq4gwWv.js +0 -0
  29. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/index.html +0 -0
  30. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/frontend/dist/ueditor.svg +0 -0
  31. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/settings.py +0 -0
  32. {uedition_editor-2.0.0b6 → uedition_editor-2.0.0b7}/uedition_editor/state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: uEdition-Editor
3
- Version: 2.0.0b6
3
+ Version: 2.0.0b7
4
4
  Project-URL: Documentation, https://github.com/uEdition/uEditor#readme
5
5
  Project-URL: Issues, https://github.com/uEdition/uEditor/issues
6
6
  Project-URL: Source, https://github.com/uEdition/uEditor
@@ -19,7 +19,7 @@ Requires-Dist: aiocron<3,>=2.1
19
19
  Requires-Dist: fastapi<1
20
20
  Requires-Dist: httptools<1
21
21
  Requires-Dist: httpx<1,>=0.28.1
22
- Requires-Dist: lxml<6,>=5
22
+ Requires-Dist: lxml<7,>=5
23
23
  Requires-Dist: pydantic-settings<3,>=2
24
24
  Requires-Dist: pydantic[email]<3,>=2
25
25
  Requires-Dist: pygit2<2,>=1.17.0
@@ -25,7 +25,7 @@ dependencies = [
25
25
  "fastapi<1",
26
26
  "httptools<1",
27
27
  "httpx>=0.28.1,<1",
28
- "lxml>=5,<6",
28
+ "lxml>=5,<7",
29
29
  "pydantic[email]>=2,<3",
30
30
  "pydantic_settings>=2,<3",
31
31
  "pygit2>=1.17.0,<2",
@@ -3,4 +3,4 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
  """About this package."""
5
5
 
6
- __version__ = "2.0.0b6"
6
+ __version__ = "2.0.0b7"
@@ -97,6 +97,7 @@ async def create_branch(
97
97
  repo.branches.local.create(branch_id, commit)
98
98
  repo.checkout(repo.branches[branch_id])
99
99
  repo.branches[branch_id].upstream = repo.branches[f"{init_settings.git.remote_name}/{branch_id}"]
100
+ await cron.insecure_track_branches()
100
101
  return {"id": branch_id, "title": de_slugify(data.title)}
101
102
  else:
102
103
  for remote_branch_id in repo.branches.remote:
@@ -115,6 +116,7 @@ async def create_branch(
115
116
  )
116
117
  fetch_repo(repo, init_settings.git.remote_name)
117
118
  repo.branches[branch_id].upstream = repo.branches[f"{init_settings.git.remote_name}/{branch_id}"]
119
+ await cron.insecure_track_branches()
118
120
  return {"id": branch_id, "title": data.title}
119
121
  except GitError as ge:
120
122
  logger.error(ge)
@@ -165,3 +167,4 @@ async def delete_branch(
165
167
  )
166
168
  if branch_id in repo.branches:
167
169
  repo.branches.delete(branch_id)
170
+ await cron.insecure_track_branches()
@@ -0,0 +1,63 @@
1
+ # SPDX-FileCopyrightText: 2024-present Mark Hall <mark.hall@work.room3b.eu>
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ """Regular jobs run in the background of the uEditor."""
5
+
6
+ import logging
7
+
8
+ import aiocron
9
+ from pygit2 import GitError, Repository
10
+ from pygit2.enums import RepositoryOpenFlag
11
+
12
+ from uedition_editor.api.util import de_slugify, fetch_repo, pull_branch, uedition_lock
13
+ from uedition_editor.settings import init_settings
14
+ from uedition_editor.state import local_branches, remote_branches
15
+
16
+ logger = logging.getLogger(__name__)
17
+
18
+
19
+ async def insecure_track_branches():
20
+ """
21
+ Track the status of all git branches.
22
+
23
+ Use only when the uedition_lock is already completed.
24
+ """
25
+ remote_branches.clear()
26
+ local_branches.clear()
27
+ try:
28
+ repo = Repository(init_settings.base_path, flags=RepositoryOpenFlag.NO_SEARCH)
29
+ logger.debug("Tracking branches")
30
+ repo.checkout(repo.branches[init_settings.git.default_branch])
31
+ if init_settings.git.remote_name in list(repo.remotes.names()):
32
+ logger.debug("Synchronising with remote")
33
+ fetch_repo(repo, init_settings.git.remote_name)
34
+ logger.debug("Updating branch status")
35
+ for branch_name in repo.branches.local:
36
+ repo.checkout(repo.branches[branch_name])
37
+ if init_settings.git.remote_name in list(repo.remotes.names()):
38
+ if repo.branches[branch_name].upstream is not None:
39
+ pull_branch(repo, branch_name)
40
+ diff = repo.diff(
41
+ repo.revparse_single(init_settings.git.default_branch),
42
+ )
43
+ local_branches.append(
44
+ {
45
+ "id": branch_name,
46
+ "title": de_slugify(branch_name),
47
+ "update_from_default": diff.stats.files_changed > 0,
48
+ }
49
+ )
50
+ for branch_name in repo.branches.remote:
51
+ if repo.branches[branch_name].remote_name == init_settings.git.remote_name and "HEAD" not in branch_name:
52
+ remote_branches.append({"id": branch_name, "title": de_slugify(branch_name)})
53
+ logger.debug("Tracking complete")
54
+ except GitError as ge:
55
+ logger.error(ge)
56
+ local_branches.append({"id": "-", "title": "Direct Access", "nogit": True})
57
+
58
+
59
+ @aiocron.crontab("*/5 * * * *")
60
+ async def track_branches() -> None:
61
+ """Track the status of all git branches."""
62
+ async with uedition_lock:
63
+ await insecure_track_branches()
@@ -1,57 +0,0 @@
1
- # SPDX-FileCopyrightText: 2024-present Mark Hall <mark.hall@work.room3b.eu>
2
- #
3
- # SPDX-License-Identifier: MIT
4
- """Regular jobs run in the background of the uEditor."""
5
-
6
- import logging
7
-
8
- import aiocron
9
- from pygit2 import GitError, Repository
10
- from pygit2.enums import RepositoryOpenFlag
11
-
12
- from uedition_editor.api.util import de_slugify, fetch_repo, pull_branch, uedition_lock
13
- from uedition_editor.settings import init_settings
14
- from uedition_editor.state import local_branches, remote_branches
15
-
16
- logger = logging.getLogger(__name__)
17
-
18
-
19
- @aiocron.crontab("*/5 * * * *")
20
- async def track_branches() -> None:
21
- """Track the status of all git branches."""
22
- async with uedition_lock:
23
- remote_branches.clear()
24
- local_branches.clear()
25
- try:
26
- repo = Repository(init_settings.base_path, flags=RepositoryOpenFlag.NO_SEARCH)
27
- logger.debug("Tracking branches")
28
- repo.checkout(repo.branches[init_settings.git.default_branch])
29
- if init_settings.git.remote_name in list(repo.remotes.names()):
30
- logger.debug("Synchronising with remote")
31
- fetch_repo(repo, init_settings.git.remote_name)
32
- logger.debug("Updating branch status")
33
- for branch_name in repo.branches.local:
34
- repo.checkout(repo.branches[branch_name])
35
- if init_settings.git.remote_name in list(repo.remotes.names()):
36
- if repo.branches[branch_name].upstream is not None:
37
- pull_branch(repo, branch_name)
38
- diff = repo.diff(
39
- repo.revparse_single(init_settings.git.default_branch),
40
- )
41
- local_branches.append(
42
- {
43
- "id": branch_name,
44
- "title": de_slugify(branch_name),
45
- "update_from_default": diff.stats.files_changed > 0,
46
- }
47
- )
48
- for branch_name in repo.branches.remote:
49
- if (
50
- repo.branches[branch_name].remote_name == init_settings.git.remote_name
51
- and "HEAD" not in branch_name
52
- ):
53
- remote_branches.append({"id": branch_name, "title": de_slugify(branch_name)})
54
- logger.debug("Tracking complete")
55
- except GitError as ge:
56
- logger.error(ge)
57
- local_branches.append({"id": "-", "title": "Direct Access", "nogit": True})