roundtripper 0.1.0__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.
@@ -0,0 +1,214 @@
1
+ # Downloaded confluence data
2
+ /confluence-export
3
+ # Current issue for editing by copilot
4
+ /CURRENT_ISSUE.md
5
+ # Some of this is based on confluence-markdown-exporter
6
+ /confluence-markdown-exporter
7
+
8
+ # Byte-compiled / optimized / DLL files
9
+ __pycache__/
10
+ *.py[codz]
11
+ *$py.class
12
+
13
+ # C extensions
14
+ *.so
15
+
16
+ # Distribution / packaging
17
+ .Python
18
+ build/
19
+ develop-eggs/
20
+ dist/
21
+ downloads/
22
+ eggs/
23
+ .eggs/
24
+ lib/
25
+ lib64/
26
+ parts/
27
+ sdist/
28
+ var/
29
+ wheels/
30
+ share/python-wheels/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ *.egg
34
+ MANIFEST
35
+
36
+ # PyInstaller
37
+ # Usually these files are written by a python script from a template
38
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
39
+ *.manifest
40
+ *.spec
41
+
42
+ # Installer logs
43
+ pip-log.txt
44
+ pip-delete-this-directory.txt
45
+
46
+ # Unit test / coverage reports
47
+ htmlcov/
48
+ .tox/
49
+ .nox/
50
+ .coverage
51
+ .coverage.*
52
+ .cache
53
+ nosetests.xml
54
+ coverage.xml
55
+ *.cover
56
+ *.py.cover
57
+ .hypothesis/
58
+ .pytest_cache/
59
+ cover/
60
+
61
+ # Translations
62
+ *.mo
63
+ *.pot
64
+
65
+ # Django stuff:
66
+ *.log
67
+ local_settings.py
68
+ db.sqlite3
69
+ db.sqlite3-journal
70
+
71
+ # Flask stuff:
72
+ instance/
73
+ .webassets-cache
74
+
75
+ # Scrapy stuff:
76
+ .scrapy
77
+
78
+ # Sphinx documentation
79
+ docs/_build/
80
+
81
+ # PyBuilder
82
+ .pybuilder/
83
+ target/
84
+
85
+ # Jupyter Notebook
86
+ .ipynb_checkpoints
87
+
88
+ # IPython
89
+ profile_default/
90
+ ipython_config.py
91
+
92
+ # pyenv
93
+ # For a library or package, you might want to ignore these files since the code is
94
+ # intended to run in multiple environments; otherwise, check them in:
95
+ # .python-version
96
+
97
+ # pipenv
98
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
100
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
101
+ # install all needed dependencies.
102
+ #Pipfile.lock
103
+
104
+ # UV
105
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ #uv.lock
109
+
110
+ # poetry
111
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
112
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
113
+ # commonly ignored for libraries.
114
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
115
+ #poetry.lock
116
+ #poetry.toml
117
+
118
+ # pdm
119
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
120
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
121
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
122
+ #pdm.lock
123
+ #pdm.toml
124
+ .pdm-python
125
+ .pdm-build/
126
+
127
+ # pixi
128
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
129
+ #pixi.lock
130
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
131
+ # in the .venv directory. It is recommended not to include this directory in version control.
132
+ .pixi
133
+
134
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
135
+ __pypackages__/
136
+
137
+ # Celery stuff
138
+ celerybeat-schedule
139
+ celerybeat.pid
140
+
141
+ # SageMath parsed files
142
+ *.sage.py
143
+
144
+ # Environments
145
+ .env
146
+ .envrc
147
+ .venv
148
+ env/
149
+ venv/
150
+ ENV/
151
+ env.bak/
152
+ venv.bak/
153
+
154
+ # Spyder project settings
155
+ .spyderproject
156
+ .spyproject
157
+
158
+ # Rope project settings
159
+ .ropeproject
160
+
161
+ # mkdocs documentation
162
+ /site
163
+
164
+ # mypy
165
+ .mypy_cache/
166
+ .dmypy.json
167
+ dmypy.json
168
+
169
+ # Pyre type checker
170
+ .pyre/
171
+
172
+ # pytype static type analyzer
173
+ .pytype/
174
+
175
+ # Cython debug symbols
176
+ cython_debug/
177
+
178
+ # PyCharm
179
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
180
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
181
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
182
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
183
+ #.idea/
184
+
185
+ # Abstra
186
+ # Abstra is an AI-powered process automation framework.
187
+ # Ignore directories containing user credentials, local state, and settings.
188
+ # Learn more at https://abstra.io/docs
189
+ .abstra/
190
+
191
+ # Visual Studio Code
192
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
193
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
194
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
195
+ # you could uncomment the following to ignore the entire vscode folder
196
+ # .vscode/
197
+
198
+ # Ruff stuff:
199
+ .ruff_cache/
200
+
201
+ # PyPI configuration file
202
+ .pypirc
203
+
204
+ # Cursor
205
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
206
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
207
+ # refer to https://docs.cursor.com/context/ignore-files
208
+ .cursorignore
209
+ .cursorindexingignore
210
+
211
+ # Marimo
212
+ marimo/_static/
213
+ marimo/_lsp/
214
+ __marimo__/
@@ -0,0 +1,31 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Manuel Holtgrewe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This project includes code adapted from confluence-markdown-exporter:
26
+ https://github.com/Spenhouet/confluence-markdown-exporter
27
+
28
+ Copyright (c) Sebastian Penhouet
29
+
30
+ The adapted code (config.py, config_store.py, and config_interactive.py) is
31
+ licensed under the MIT License. See the original project for details.
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: roundtripper
3
+ Version: 0.1.0
4
+ Summary: Roundtripping with Confluence
5
+ Project-URL: Documentation, https://github.com/holtgrewe/roundtripper
6
+ Project-URL: Issues, https://github.com/holtgrewe/roundtripper/issues
7
+ Project-URL: Source, https://github.com/holtgrewe/roundtripper
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.13
10
+ Requires-Dist: atlassian-python-api>=3.41.0
11
+ Requires-Dist: cyclopts>=4.4.4
12
+ Requires-Dist: httpx>=0.28.1
13
+ Requires-Dist: jmespath>=1.0.1
14
+ Requires-Dist: pydantic-settings>=2.7.0
15
+ Requires-Dist: pydantic>=2.10.6
16
+ Requires-Dist: questionary>=2.0.1
17
+ Requires-Dist: rich>=13.9.4
18
+ Requires-Dist: tqdm>=4.66.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ # roundtripper
22
+
23
+ Roundtripping with Confluence
24
+
25
+ ## Setup
26
+
27
+ Setup Python with uv
28
+
29
+ ```bash
30
+ curl -LsSf https://astral.sh/uv/install.sh | sh
31
+ uv python install 3.13
32
+ ```
33
+
34
+ Clone the repository
35
+
36
+ ```bash
37
+ git clone https://github.com/mholtgrewe/roundtripper.git
38
+ ```
39
+
40
+ Run Tests
41
+
42
+ ```bash
43
+ cd roundtripper
44
+ uv sync --group dev
45
+ make test
46
+ ```
47
+
48
+ ## Development
49
+
50
+ ### Check Code Quality
51
+
52
+ ```bash
53
+ make check
54
+ ```
55
+
56
+ ### Format Code
57
+
58
+ ```bash
59
+ make fix
60
+ ```
61
+
62
+ ### Run Tests
63
+
64
+ ```bash
65
+ make test
66
+ ```
67
+
68
+ ### Update Dependencies
69
+
70
+ ```bash
71
+ make lock
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ ```bash
77
+ roundtripper --help
78
+ ```
79
+
80
+ ### Configure Confluence
81
+
82
+ Configure your Confluence credentials and connection settings:
83
+
84
+ ```bash
85
+ roundtripper confluence config
86
+ ```
87
+
88
+ This will open an interactive configuration menu. Configuration is stored in `~/.config/roundtripper/config.json` following the XDG Base Directory specification.
89
+
90
+ To view your current configuration:
91
+
92
+ ```bash
93
+ roundtripper confluence config --show
94
+ ```
95
+
96
+ To jump directly to a specific configuration section:
97
+
98
+ ```bash
99
+ roundtripper confluence config --jump-to auth.confluence
100
+ ```
101
+
102
+ ## Acknowledgments
103
+
104
+ This project includes code adapted from [confluence-markdown-exporter](https://github.com/Spenhouet/confluence-markdown-exporter) by Sebastian Penhouet.
@@ -0,0 +1,84 @@
1
+ # roundtripper
2
+
3
+ Roundtripping with Confluence
4
+
5
+ ## Setup
6
+
7
+ Setup Python with uv
8
+
9
+ ```bash
10
+ curl -LsSf https://astral.sh/uv/install.sh | sh
11
+ uv python install 3.13
12
+ ```
13
+
14
+ Clone the repository
15
+
16
+ ```bash
17
+ git clone https://github.com/mholtgrewe/roundtripper.git
18
+ ```
19
+
20
+ Run Tests
21
+
22
+ ```bash
23
+ cd roundtripper
24
+ uv sync --group dev
25
+ make test
26
+ ```
27
+
28
+ ## Development
29
+
30
+ ### Check Code Quality
31
+
32
+ ```bash
33
+ make check
34
+ ```
35
+
36
+ ### Format Code
37
+
38
+ ```bash
39
+ make fix
40
+ ```
41
+
42
+ ### Run Tests
43
+
44
+ ```bash
45
+ make test
46
+ ```
47
+
48
+ ### Update Dependencies
49
+
50
+ ```bash
51
+ make lock
52
+ ```
53
+
54
+ ## Usage
55
+
56
+ ```bash
57
+ roundtripper --help
58
+ ```
59
+
60
+ ### Configure Confluence
61
+
62
+ Configure your Confluence credentials and connection settings:
63
+
64
+ ```bash
65
+ roundtripper confluence config
66
+ ```
67
+
68
+ This will open an interactive configuration menu. Configuration is stored in `~/.config/roundtripper/config.json` following the XDG Base Directory specification.
69
+
70
+ To view your current configuration:
71
+
72
+ ```bash
73
+ roundtripper confluence config --show
74
+ ```
75
+
76
+ To jump directly to a specific configuration section:
77
+
78
+ ```bash
79
+ roundtripper confluence config --jump-to auth.confluence
80
+ ```
81
+
82
+ ## Acknowledgments
83
+
84
+ This project includes code adapted from [confluence-markdown-exporter](https://github.com/Spenhouet/confluence-markdown-exporter) by Sebastian Penhouet.
@@ -0,0 +1,154 @@
1
+ [build-system]
2
+ build-backend = "hatchling.build"
3
+ requires = ["hatchling"]
4
+
5
+ [project]
6
+ name = "roundtripper"
7
+ version = "0.1.0"
8
+ description = "Roundtripping with Confluence"
9
+ readme = "README.md"
10
+ requires-python = ">=3.13"
11
+ dependencies = [
12
+ "atlassian-python-api>=3.41.0",
13
+ "cyclopts>=4.4.4",
14
+ "httpx>=0.28.1",
15
+ "jmespath>=1.0.1",
16
+ "pydantic>=2.10.6",
17
+ "pydantic-settings>=2.7.0",
18
+ "questionary>=2.0.1",
19
+ "rich>=13.9.4",
20
+ "tqdm>=4.66.0",
21
+ ]
22
+
23
+ [project.scripts]
24
+ roundtripper = "roundtripper.cli:cli"
25
+
26
+ [project.urls]
27
+ Documentation = "https://github.com/holtgrewe/roundtripper"
28
+ Issues = "https://github.com/holtgrewe/roundtripper/issues"
29
+ Source = "https://github.com/holtgrewe/roundtripper"
30
+
31
+ [tool.hatch.version]
32
+ path = "src/roundtripper/__init__.py"
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "coverage>=7.6.12",
37
+ "hatch>=1.14.0",
38
+ "pyright>=1.1.394",
39
+ "pytest>=8.3.4",
40
+ "pytest-asyncio>=1.3.0",
41
+ "pytest-coverage>=0.0",
42
+ "pytest-sugar>=1.0.0",
43
+ "pytest-mock>=3.14.0",
44
+ "ruff>=0.9.6",
45
+ ]
46
+
47
+ [tool.hatch.envs.quality]
48
+ installer = "uv"
49
+ group = "dev"
50
+
51
+ [tool.hatch.envs.quality.scripts]
52
+ check = [
53
+ "ruff check src tests",
54
+ ]
55
+ format = [
56
+ "ruff format src tests",
57
+ "ruff check --fix src tests",
58
+ "check",
59
+ ]
60
+ typecheck = [
61
+ """
62
+ pyright --pythonpath="$(uv run --active hatch run quality:python -c 'import sys; print(sys.executable)')" \
63
+ {args:src/ tests/}
64
+ """
65
+ ]
66
+
67
+ [tool.pyright]
68
+ include = ["src", "tests"]
69
+ exclude = [
70
+ "**/node_modules",
71
+ "**/__pycache__",
72
+ ]
73
+ defineConstant = { DEBUG = true }
74
+ stubPath = "stubs"
75
+
76
+ pythonVersion = "3.13"
77
+ pythonPlatform = "Linux"
78
+
79
+ # Missing type annotation reports
80
+ reportMissingParameterType = "error"
81
+ reportUnknownParameterType = "error"
82
+ reportUnknownVariableType = "error"
83
+ reportUnknownMemberType = "error"
84
+ reportUnknownArgumentType = "error"
85
+ reportMissingTypeArgument = "error"
86
+
87
+ # Other useful reports for type safety
88
+ reportGeneralTypeIssues = "error"
89
+ reportOptionalMemberAccess = "error"
90
+ reportOptionalSubscript = "error"
91
+ reportPrivateImportUsage = "error"
92
+
93
+ # Stub files
94
+ reportMissingTypeStubs = "error"
95
+ reportImportCycles = "error"
96
+ reportUnusedImport = "error"
97
+ reportUnusedVariable = "error"
98
+
99
+ [tool.ruff]
100
+ include = ["src/roundtripper/*.py", "tests/**/*.py"]
101
+ target-version = "py313"
102
+ line-length = 100
103
+ lint.ignore = [
104
+ "B008", # do not perform function calls in argument defaults
105
+ "C901", # too complex
106
+ ]
107
+ lint.select = [
108
+ "E", # pycodestyle errors
109
+ "W", # pycodestyle warnings
110
+ "F", # pyflakes
111
+ "I", # isort
112
+ "C", # flake8-comprehensions
113
+ "B", # flake8-bugbear
114
+ ]
115
+
116
+ [tool.ruff.lint.isort]
117
+ known-first-party = ["roundtripper"]
118
+
119
+ [tool.hatch.envs.tests]
120
+ installer = "uv"
121
+ python = "3.13"
122
+ group = "dev"
123
+
124
+ [tool.hatch.envs.tests.scripts]
125
+ run = "pytest --capture=no -vv --cov=roundtripper --cov-report=term-missing tests/ --durations 5 -s {args:tests}"
126
+ run-no-cov = "pytest -vv tests/ --durations 5 -s {args:tests}"
127
+
128
+ [tool.hatch.build]
129
+ include = [
130
+ "src/roundtripper/**/*.py",
131
+ "src/**/py.typed",
132
+ ]
133
+
134
+ [tool.hatch.build.targets.sdist]
135
+ ignore-vcs = true
136
+
137
+ [tool.hatch.build.targets.wheel]
138
+ packages = ["src/roundtripper"]
139
+ ignore-vcs = true
140
+
141
+ [tool.pytest.ini_options]
142
+ pythonpath = [
143
+ "src/"
144
+ ]
145
+ asyncio_mode = "auto"
146
+
147
+ [tool.coverage.run]
148
+ concurrency = ["thread"]
149
+
150
+ [tool.coverage.report]
151
+ exclude_also = [
152
+ # A pragma comment that excludes an entire file:
153
+ '\A(?s:.*# pragma: exclude file.*)\Z',
154
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,83 @@
1
+ """Confluence API client for roundtripper.
2
+
3
+ Adapted from confluence-markdown-exporter by Sebastian Penhouet.
4
+ https://github.com/Spenhouet/confluence-markdown-exporter
5
+ """
6
+
7
+ import logging
8
+ from typing import Any
9
+
10
+ from atlassian import Confluence as ConfluenceApiSdk
11
+
12
+ from roundtripper.config import ApiDetails
13
+ from roundtripper.config_store import get_settings
14
+
15
+ #: Logger instance.
16
+ LOGGER = logging.getLogger(__name__)
17
+
18
+
19
+ class ConfluenceClientFactory:
20
+ """Factory for creating authenticated Confluence API clients with retry config."""
21
+
22
+ def __init__(self, connection_config: dict[str, Any]) -> None:
23
+ """Initialize the factory with connection configuration.
24
+
25
+ Parameters
26
+ ----------
27
+ connection_config
28
+ Connection configuration dictionary with retry/timeout settings.
29
+ """
30
+ self.connection_config = connection_config
31
+
32
+ def create(self, auth: ApiDetails) -> ConfluenceApiSdk:
33
+ """Create an authenticated Confluence client.
34
+
35
+ Parameters
36
+ ----------
37
+ auth
38
+ API details including URL and credentials.
39
+
40
+ Returns
41
+ -------
42
+ ConfluenceApiSdk
43
+ Authenticated Confluence API client.
44
+
45
+ Raises
46
+ ------
47
+ ConnectionError
48
+ If the connection to Confluence fails.
49
+ """
50
+ try:
51
+ instance = ConfluenceApiSdk(
52
+ url=str(auth.url),
53
+ username=auth.username.get_secret_value() if auth.api_token else None,
54
+ password=auth.api_token.get_secret_value() if auth.api_token else None,
55
+ token=auth.pat.get_secret_value() if auth.pat else None,
56
+ **self.connection_config,
57
+ )
58
+ # Test connection
59
+ instance.get_all_spaces(limit=1)
60
+ except Exception as e:
61
+ msg = f"Confluence connection failed: {e}"
62
+ raise ConnectionError(msg) from e
63
+ return instance
64
+
65
+
66
+ def get_confluence_client() -> ConfluenceApiSdk:
67
+ """Get an authenticated Confluence API client using current settings.
68
+
69
+ Returns
70
+ -------
71
+ ConfluenceApiSdk
72
+ Authenticated Confluence API client.
73
+
74
+ Raises
75
+ ------
76
+ ConnectionError
77
+ If the connection to Confluence fails.
78
+ """
79
+ settings = get_settings()
80
+ auth = settings.auth.confluence
81
+ connection_config = settings.connection_config.model_dump()
82
+
83
+ return ConfluenceClientFactory(connection_config).create(auth)