stapel-atlassian 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.
- stapel_atlassian-0.1.0/CONFIG.MD +11 -0
- stapel_atlassian-0.1.0/LICENSE +21 -0
- stapel_atlassian-0.1.0/MODULE.md +17 -0
- stapel_atlassian-0.1.0/PKG-INFO +68 -0
- stapel_atlassian-0.1.0/README.md +33 -0
- stapel_atlassian-0.1.0/__init__.py +39 -0
- stapel_atlassian-0.1.0/apps.py +15 -0
- stapel_atlassian-0.1.0/conf.py +16 -0
- stapel_atlassian-0.1.0/conftest.py +63 -0
- stapel_atlassian-0.1.0/dto.py +46 -0
- stapel_atlassian-0.1.0/llms.txt +17 -0
- stapel_atlassian-0.1.0/presenters.py +22 -0
- stapel_atlassian-0.1.0/py.typed +0 -0
- stapel_atlassian-0.1.0/pyproject.toml +81 -0
- stapel_atlassian-0.1.0/serializers.py +46 -0
- stapel_atlassian-0.1.0/setup.cfg +4 -0
- stapel_atlassian-0.1.0/stapel_atlassian.egg-info/PKG-INFO +68 -0
- stapel_atlassian-0.1.0/stapel_atlassian.egg-info/SOURCES.txt +56 -0
- stapel_atlassian-0.1.0/stapel_atlassian.egg-info/dependency_links.txt +1 -0
- stapel_atlassian-0.1.0/stapel_atlassian.egg-info/requires.txt +10 -0
- stapel_atlassian-0.1.0/stapel_atlassian.egg-info/top_level.txt +1 -0
- stapel_atlassian-0.1.0/stpl_atlassian_adf.py +235 -0
- stapel_atlassian-0.1.0/stpl_atlassian_client.py +168 -0
- stapel_atlassian-0.1.0/stpl_atlassian_confluence.py +368 -0
- stapel_atlassian-0.1.0/stpl_atlassian_jira.py +603 -0
- stapel_atlassian-0.1.0/stpl_atlassian_jql.py +131 -0
- stapel_atlassian-0.1.0/stpl_atlassian_provider.py +107 -0
- stapel_atlassian-0.1.0/stpl_atlassian_storage.py +334 -0
- stapel_atlassian-0.1.0/tests/test_module_names.py +23 -0
- stapel_atlassian-0.1.0/tests/test_provider.py +81 -0
- stapel_atlassian-0.1.0/tests/test_public_api.py +45 -0
- stapel_atlassian-0.1.0/tests/test_stpl_atlassian_client.py +72 -0
- stapel_atlassian-0.1.0/tests/test_stpl_atlassian_formats.py +170 -0
- stapel_atlassian-0.1.0/tests/test_stpl_atlassian_products.py +305 -0
- stapel_atlassian-0.1.0/urls.py +6 -0
- stapel_atlassian-0.1.0/urls_v1.py +21 -0
- stapel_atlassian-0.1.0/views.py +107 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# CONFIG.MD — stapel-atlassian
|
|
2
|
+
|
|
3
|
+
`STAPEL_ATLASSIAN`:
|
|
4
|
+
|
|
5
|
+
| Key | Default | Meaning |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `ATLASSIAN_SITE_HOSTS` | `[".atlassian.net"]` | Where stored tokens may be sent. |
|
|
8
|
+
| `ATLASSIAN_MAX_ATTACHMENT_BYTES` | `26214400` | Up and down. |
|
|
9
|
+
| `ATLASSIAN_EPIC_ISSUE_TYPE` | `"Epic"` | Name of the epic type. |
|
|
10
|
+
| `ATLASSIAN_STORY_POINTS_FIELD` | `""` | Custom field id, read into `Issue.story_points`. |
|
|
11
|
+
| `ATLASSIAN_START_DATE_FIELD` | `""` | Custom field id, read into `Issue.start_date`. |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stapel contributors
|
|
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.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# MODULE.md — stapel-atlassian
|
|
2
|
+
|
|
3
|
+
## Provider `atlassian`
|
|
4
|
+
Fields: `site_url`, `email`, `api_token` (secret), `cloud_id` (scoped tokens), `jira_project_key`, `jira_issue_type`, `confluence_parent_page_id`. `open_integration()` returns `AtlassianSite(client, jira, confluence, …defaults)`.
|
|
5
|
+
|
|
6
|
+
## HTTP (`/atlassian/api/v1/connections/<id>/…`, need permission to use)
|
|
7
|
+
`jira/projects`, `jira/projects/<key>/issue-types`, `…/assignees`, `…/required-fields?issue_type=`, `confluence/pages?query&space_key&under&in_body`.
|
|
8
|
+
|
|
9
|
+
## Sites
|
|
10
|
+
Atlassian Cloud only (`*.atlassian.net`). Data Center has a different API.
|
|
11
|
+
|
|
12
|
+
## Known limits
|
|
13
|
+
- Confluence pages use REST v2; text search and attachment upload exist only in v1.
|
|
14
|
+
- `update_page(markdown=)` cannot keep inline comment anchors, images or macros; it refuses instead.
|
|
15
|
+
- Link direction is read back after creation and corrected, because the request fields do not document it.
|
|
16
|
+
- Scoped tokens through `api.atlassian.com` are untested against a live site.
|
|
17
|
+
- No footer comments, no Confluence attachment download.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stapel-atlassian
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Jira and Confluence Cloud for Stapel: guarded client, integrations, connection provider
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/usestapel/stapel-atlassian
|
|
7
|
+
Project-URL: Repository, https://github.com/usestapel/stapel-atlassian
|
|
8
|
+
Project-URL: Documentation, https://github.com/usestapel/stapel-atlassian#readme
|
|
9
|
+
Project-URL: Changelog, https://github.com/usestapel/stapel-atlassian/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Issues, https://github.com/usestapel/stapel-atlassian/issues
|
|
11
|
+
Keywords: django,stapel,atlassian,jira,confluence
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: stapel-core<1.0,>=0.99.5
|
|
27
|
+
Requires-Dist: stapel-integrations-core<1.0,>=0.1.0
|
|
28
|
+
Requires-Dist: drf-spectacular>=0.27
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
Requires-Dist: pytest-django; extra == "test"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# stapel-atlassian
|
|
37
|
+
|
|
38
|
+
Jira and Confluence Cloud for Stapel: a guarded client, two integration classes and an `atlassian` connection provider.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install stapel-atlassian
|
|
44
|
+
```
|
|
45
|
+
Add `stapel_integrations_core` and `stapel_atlassian` to `INSTALLED_APPS`, mount `path("atlassian/", include("stapel_atlassian.urls"))`. The classes also work without Django.
|
|
46
|
+
|
|
47
|
+
## Use
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from stapel_atlassian import (AtlassianClient, AtlassianCredentials,
|
|
51
|
+
StapelJiraIntegration, StapelConfluenceIntegration, currentUser)
|
|
52
|
+
|
|
53
|
+
client = AtlassianClient(AtlassianCredentials("https://your-team.atlassian.net", email, api_token))
|
|
54
|
+
jira = StapelJiraIntegration(client)
|
|
55
|
+
confluence = StapelConfluenceIntegration(client)
|
|
56
|
+
|
|
57
|
+
jira.filter_issues(assignee=currentUser(), status="In Progress")
|
|
58
|
+
task = jira.create_issue("STPL", "Prepare the release notes", description="## Scope\n- changelog")
|
|
59
|
+
jira.transition(task.key, "Done")
|
|
60
|
+
|
|
61
|
+
parent = confluence.find_pages("Meeting notes", space_key="STPL")[0]
|
|
62
|
+
page = confluence.create_page(parent.id, "Weekly sync", markdown="## Decisions\n- ship it")
|
|
63
|
+
jira.link_confluence_page(task.key, page.url, page.title)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
See `MODULE.md` for the contract, `CONFIG.MD` for settings, `llms.txt` for agents.
|
|
67
|
+
|
|
68
|
+
MIT licensed.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# stapel-atlassian
|
|
2
|
+
|
|
3
|
+
Jira and Confluence Cloud for Stapel: a guarded client, two integration classes and an `atlassian` connection provider.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install stapel-atlassian
|
|
9
|
+
```
|
|
10
|
+
Add `stapel_integrations_core` and `stapel_atlassian` to `INSTALLED_APPS`, mount `path("atlassian/", include("stapel_atlassian.urls"))`. The classes also work without Django.
|
|
11
|
+
|
|
12
|
+
## Use
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from stapel_atlassian import (AtlassianClient, AtlassianCredentials,
|
|
16
|
+
StapelJiraIntegration, StapelConfluenceIntegration, currentUser)
|
|
17
|
+
|
|
18
|
+
client = AtlassianClient(AtlassianCredentials("https://your-team.atlassian.net", email, api_token))
|
|
19
|
+
jira = StapelJiraIntegration(client)
|
|
20
|
+
confluence = StapelConfluenceIntegration(client)
|
|
21
|
+
|
|
22
|
+
jira.filter_issues(assignee=currentUser(), status="In Progress")
|
|
23
|
+
task = jira.create_issue("STPL", "Prepare the release notes", description="## Scope\n- changelog")
|
|
24
|
+
jira.transition(task.key, "Done")
|
|
25
|
+
|
|
26
|
+
parent = confluence.find_pages("Meeting notes", space_key="STPL")[0]
|
|
27
|
+
page = confluence.create_page(parent.id, "Weekly sync", markdown="## Decisions\n- ship it")
|
|
28
|
+
jira.link_confluence_page(task.key, page.url, page.title)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
See `MODULE.md` for the contract, `CONFIG.MD` for settings, `llms.txt` for agents.
|
|
32
|
+
|
|
33
|
+
MIT licensed.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""stapel-atlassian — Jira and Confluence Cloud for the Stapel framework.
|
|
2
|
+
|
|
3
|
+
Public names are exported lazily (PEP 562): importing the package never
|
|
4
|
+
imports Django::
|
|
5
|
+
|
|
6
|
+
from stapel_atlassian import (
|
|
7
|
+
AtlassianClient, AtlassianCredentials,
|
|
8
|
+
StapelJiraIntegration, StapelConfluenceIntegration, currentUser,
|
|
9
|
+
)
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
_LAZY_EXPORTS = {
|
|
13
|
+
**{name: ".stpl_atlassian_client" for name in (
|
|
14
|
+
"AtlassianClient", "AtlassianCredentials", "AtlassianError", "AtlassianAuthError",
|
|
15
|
+
"AtlassianPermissionError", "AtlassianNotFoundError", "AtlassianValidationError",
|
|
16
|
+
"AtlassianRateLimited", "AtlassianUnavailable", "AtlassianUnknownOutcome",
|
|
17
|
+
)},
|
|
18
|
+
"StapelJiraIntegration": ".stpl_atlassian_jira",
|
|
19
|
+
"StapelConfluenceIntegration": ".stpl_atlassian_confluence",
|
|
20
|
+
**{name: ".stpl_atlassian_jql" for name in (
|
|
21
|
+
"build_jql", "currentUser", "membersOf", "now", "openSprints", "startOfDay", "startOfWeek",
|
|
22
|
+
)},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
__all__ = sorted(_LAZY_EXPORTS)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def __getattr__(name):
|
|
29
|
+
if name in _LAZY_EXPORTS:
|
|
30
|
+
from importlib import import_module
|
|
31
|
+
|
|
32
|
+
value = getattr(import_module(_LAZY_EXPORTS[name], __name__), name)
|
|
33
|
+
globals()[name] = value
|
|
34
|
+
return value
|
|
35
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def __dir__():
|
|
39
|
+
return sorted(set(globals()) | set(__all__))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from django.apps import AppConfig
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AtlassianConfig(AppConfig):
|
|
5
|
+
name = "stapel_atlassian"
|
|
6
|
+
label = "atlassian"
|
|
7
|
+
verbose_name = "Atlassian"
|
|
8
|
+
default_auto_field = "django.db.models.BigAutoField"
|
|
9
|
+
|
|
10
|
+
def ready(self):
|
|
11
|
+
from stapel_integrations_core.stpl_integrations_providers import register_provider
|
|
12
|
+
|
|
13
|
+
from .stpl_atlassian_provider import AtlassianProvider
|
|
14
|
+
|
|
15
|
+
register_provider(AtlassianProvider())
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Settings namespace ``STAPEL_ATLASSIAN`` (keys are prefixed: see the core)."""
|
|
2
|
+
from stapel_core.conf import AppSettings
|
|
3
|
+
|
|
4
|
+
DEFAULTS = {
|
|
5
|
+
# Exact hosts, or suffixes starting with a dot.
|
|
6
|
+
"ATLASSIAN_SITE_HOSTS": [".atlassian.net"],
|
|
7
|
+
"ATLASSIAN_MAX_ATTACHMENT_BYTES": 25 * 1024 * 1024,
|
|
8
|
+
"ATLASSIAN_EPIC_ISSUE_TYPE": "Epic",
|
|
9
|
+
# Custom field ids differ between sites; empty = not mapped.
|
|
10
|
+
"ATLASSIAN_STORY_POINTS_FIELD": "",
|
|
11
|
+
"ATLASSIAN_START_DATE_FIELD": "",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
atlassian_settings = AppSettings("STAPEL_ATLASSIAN", defaults=DEFAULTS)
|
|
15
|
+
|
|
16
|
+
__all__ = ["DEFAULTS", "atlassian_settings"]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
def pytest_configure(config):
|
|
2
|
+
from cryptography.fernet import Fernet
|
|
3
|
+
from django.conf import settings
|
|
4
|
+
if not settings.configured:
|
|
5
|
+
settings.configure(
|
|
6
|
+
SECRET_KEY="test-secret-key-not-for-production",
|
|
7
|
+
INSTALLED_APPS=[
|
|
8
|
+
"django.contrib.contenttypes",
|
|
9
|
+
"django.contrib.auth",
|
|
10
|
+
"django.contrib.sessions",
|
|
11
|
+
"django.contrib.admin",
|
|
12
|
+
"django.contrib.messages",
|
|
13
|
+
"stapel_core.django.users",
|
|
14
|
+
"rest_framework",
|
|
15
|
+
"stapel_integrations_core",
|
|
16
|
+
"stapel_atlassian",
|
|
17
|
+
],
|
|
18
|
+
AUTH_USER_MODEL="users.User",
|
|
19
|
+
DATABASES={
|
|
20
|
+
"default": {
|
|
21
|
+
"ENGINE": "django.db.backends.sqlite3",
|
|
22
|
+
"NAME": ":memory:",
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
DEFAULT_AUTO_FIELD="django.db.models.BigAutoField",
|
|
26
|
+
USE_TZ=True,
|
|
27
|
+
ROOT_URLCONF="stapel_atlassian.tests.urls",
|
|
28
|
+
STAPEL_INTEGRATIONS_CORE={
|
|
29
|
+
# A throwaway key generated per run.
|
|
30
|
+
"INTEGRATIONS_ENCRYPTION_KEYS": [Fernet.generate_key().decode()],
|
|
31
|
+
},
|
|
32
|
+
CACHES={
|
|
33
|
+
"default": {
|
|
34
|
+
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
# Synchronous in-process comm with schema validation ON, so the
|
|
38
|
+
# committed contracts in schemas/ are enforced by the tests.
|
|
39
|
+
STAPEL_BUS_BACKEND="stapel_core.bus.backends.memory.MemoryBus",
|
|
40
|
+
STAPEL_COMM={
|
|
41
|
+
"OUTBOX_ENABLED": False,
|
|
42
|
+
"ACTION_TRANSPORT": "inprocess",
|
|
43
|
+
"VALIDATE_SCHEMAS": True,
|
|
44
|
+
},
|
|
45
|
+
MIGRATION_MODULES={
|
|
46
|
+
"users": None,
|
|
47
|
+
"integrations": None, "atlassian": None,
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
import django
|
|
51
|
+
django.setup()
|
|
52
|
+
|
|
53
|
+
from stapel_core.comm.schemas import autoload_schemas
|
|
54
|
+
autoload_schemas()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
import pytest # noqa: E402
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@pytest.fixture
|
|
61
|
+
def api_client():
|
|
62
|
+
from rest_framework.test import APIClient
|
|
63
|
+
return APIClient()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Response DTOs of the pickers an export dialog needs."""
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class JiraProjectDTO:
|
|
7
|
+
"""A Jira project to choose from."""
|
|
8
|
+
|
|
9
|
+
id: str
|
|
10
|
+
key: str
|
|
11
|
+
name: str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class JiraIssueTypeDTO:
|
|
16
|
+
"""An issue type of a project."""
|
|
17
|
+
|
|
18
|
+
id: str
|
|
19
|
+
name: str
|
|
20
|
+
subtask: bool
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class JiraUserDTO:
|
|
25
|
+
"""A person a task can be assigned to."""
|
|
26
|
+
|
|
27
|
+
account_id: str
|
|
28
|
+
name: str
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class JiraRequiredFieldsDTO:
|
|
33
|
+
"""What would stop a task from being created."""
|
|
34
|
+
|
|
35
|
+
#: Names of fields this library cannot fill; empty = a task can be created.
|
|
36
|
+
missing: list[str] = field(default_factory=list)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass
|
|
40
|
+
class ConfluencePageDTO:
|
|
41
|
+
"""A Confluence page to choose as a parent."""
|
|
42
|
+
|
|
43
|
+
id: str
|
|
44
|
+
title: str
|
|
45
|
+
space: str = ""
|
|
46
|
+
url: str = ""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# stapel-atlassian
|
|
2
|
+
|
|
3
|
+
> Jira and Confluence Cloud for Stapel: a guarded client, two integration classes and an `atlassian` connection provider.
|
|
4
|
+
|
|
5
|
+
## Jira (`StapelJiraIntegration(client)`)
|
|
6
|
+
Read: `search(jql)`, `filter_issues(**filters, order_by=, limit=)`, `get_issue(key)`, `get_relatives(issue)`, `issues_by_keys(keys)`, `status_changes(key)`, `projects(query)`, `issue_types(project)`, `required_fields(project, issue_type, filled)`, `assignable_users(project, query)`, `comments(key)`, `attachments(key)`, `download_attachment(id)`, `link_types()`.
|
|
7
|
+
Write: `create_issue(project, summary, description=, issue_type=, parent_key=, labels=, priority=, assignee_account_id=, due_date=, fields=)`, `create_epic`, `create_subtask(parent_key, summary)`, `update_issue(key, …, preserve_media=True)`, `append_to_description`, `add_labels`, `remove_labels`, `transition(key, status)`, `add_comment`, `link_issues(source, target, relation)`, `add_remote_link`, `link_confluence_page`, `upload_attachment`.
|
|
8
|
+
|
|
9
|
+
## Confluence (`StapelConfluenceIntegration(client)`)
|
|
10
|
+
`find_pages(text, space_key=, under=, in_body=)`, `search_cql`, `parse_page_ref`, `get_page`, `get_page_markdown`, `create_page(parent, title, markdown=|storage=, space_id=, draft=, toc=)`, `update_page(page, …, expected_version=, discard_unsupported=)`, `append_to_page`, `children`, `spaces`, `attachments`, `upload_attachment`, `inline_comments`, `reply_to_comment`, `resolve_comment`, `delete_comment`.
|
|
11
|
+
|
|
12
|
+
## Rules
|
|
13
|
+
- Text goes in as Markdown. For text that is not Markdown (a transcript line) use `stpl_integrations_markdown.escape`.
|
|
14
|
+
- JQL: pass values to `filter_issues`; functions are objects (`currentUser()`), never strings.
|
|
15
|
+
- Never retry a write after `AtlassianUnknownOutcome`: look first.
|
|
16
|
+
- Before offering "create a task", call `required_fields`.
|
|
17
|
+
- Rewriting a page from Markdown is refused when it would lose comments, images or macros. Prefer `append_to_page`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""The one place the picker DTOs are built."""
|
|
2
|
+
from .dto import ConfluencePageDTO, JiraIssueTypeDTO, JiraProjectDTO, JiraRequiredFieldsDTO, JiraUserDTO
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def present_projects(projects) -> list:
|
|
6
|
+
return [JiraProjectDTO(p.id, p.key, p.name) for p in projects]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def present_issue_types(types) -> list:
|
|
10
|
+
return [JiraIssueTypeDTO(t.id, t.name, t.subtask) for t in types]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def present_users(users) -> list:
|
|
14
|
+
return [JiraUserDTO(u.account_id, u.name) for u in users if u.active]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def present_required(missing) -> JiraRequiredFieldsDTO:
|
|
18
|
+
return JiraRequiredFieldsDTO(list(missing))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def present_pages(pages) -> list:
|
|
22
|
+
return [ConfluencePageDTO(p.id, p.title, p.space, p.url) for p in pages]
|
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "stapel-atlassian"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Jira and Confluence Cloud for Stapel: guarded client, integrations, connection provider"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["django", "stapel", "atlassian", "jira", "confluence"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Framework :: Django",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Programming Language :: Python :: 3.14",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"stapel-core>=0.99.5,<1.0",
|
|
28
|
+
"stapel-integrations-core>=0.1.0,<1.0",
|
|
29
|
+
"drf-spectacular>=0.27",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://github.com/usestapel/stapel-atlassian"
|
|
34
|
+
Repository = "https://github.com/usestapel/stapel-atlassian"
|
|
35
|
+
Documentation = "https://github.com/usestapel/stapel-atlassian#readme"
|
|
36
|
+
Changelog = "https://github.com/usestapel/stapel-atlassian/blob/main/CHANGELOG.md"
|
|
37
|
+
Issues = "https://github.com/usestapel/stapel-atlassian/issues"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
all = []
|
|
41
|
+
# ONE declaration of what the TEST SUITE needs, as opposed to what the package
|
|
42
|
+
# needs. CI installs exactly this (`pip install -e ".[test]"`), so a sibling a
|
|
43
|
+
# test imports and this list does not name is a red release on a clean runner —
|
|
44
|
+
# the class that killed three of them in one night on 2026-08-24. The gate over
|
|
45
|
+
# this list is `stapel-sibling-lint` (SIB001-006), wired into CI below; the
|
|
46
|
+
# skip-vs-fail half of the contract is `tests/siblings.py`.
|
|
47
|
+
test = [
|
|
48
|
+
"pytest",
|
|
49
|
+
"pytest-django",
|
|
50
|
+
"pytest-cov",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.setuptools]
|
|
54
|
+
package-dir = {"stapel_atlassian" = "."}
|
|
55
|
+
packages = ["stapel_atlassian"]
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.package-data]
|
|
58
|
+
# The contract documents ship IN THE WHEEL: that is what makes
|
|
59
|
+
# `stapel-catalog --from-installed` possible, i.e. what turns catalog
|
|
60
|
+
# freshness from somebody's discipline into a property of the lockfile.
|
|
61
|
+
# A module that keeps them repo-only publishes code an agent cannot read.
|
|
62
|
+
stapel_atlassian = ["py.typed", "llms.txt", "MODULE.md", "docs/capabilities.json", "docs/flows.json", "docs/errors.json", "CONFIG.MD"]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
target-version = "py311"
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint]
|
|
68
|
+
# Single source for the git hooks and CI (they pass the same flags on the CLI).
|
|
69
|
+
select = ["E", "F", "W"]
|
|
70
|
+
ignore = ["E501"]
|
|
71
|
+
|
|
72
|
+
[tool.pytest.ini_options]
|
|
73
|
+
django_find_project = false
|
|
74
|
+
addopts = "--tb=short -q --import-mode=importlib"
|
|
75
|
+
|
|
76
|
+
[tool.coverage.run]
|
|
77
|
+
omit = [
|
|
78
|
+
"*/tests/*",
|
|
79
|
+
"*/conftest.py",
|
|
80
|
+
"*/migrations/*",
|
|
81
|
+
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Serializers of the picker endpoints."""
|
|
2
|
+
from rest_framework import serializers
|
|
3
|
+
from stapel_core.django.api.serializers import StapelDataclassSerializer
|
|
4
|
+
|
|
5
|
+
from .dto import ConfluencePageDTO, JiraIssueTypeDTO, JiraProjectDTO, JiraRequiredFieldsDTO, JiraUserDTO
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class JiraProjectSerializer(StapelDataclassSerializer):
|
|
9
|
+
class Meta:
|
|
10
|
+
dataclass = JiraProjectDTO
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class JiraIssueTypeSerializer(StapelDataclassSerializer):
|
|
14
|
+
class Meta:
|
|
15
|
+
dataclass = JiraIssueTypeDTO
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JiraUserSerializer(StapelDataclassSerializer):
|
|
19
|
+
class Meta:
|
|
20
|
+
dataclass = JiraUserDTO
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class JiraRequiredFieldsSerializer(StapelDataclassSerializer):
|
|
24
|
+
class Meta:
|
|
25
|
+
dataclass = JiraRequiredFieldsDTO
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ConfluencePageSerializer(StapelDataclassSerializer):
|
|
29
|
+
class Meta:
|
|
30
|
+
dataclass = ConfluencePageDTO
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class QuerySerializer(serializers.Serializer):
|
|
34
|
+
query = serializers.CharField(max_length=200, required=False, allow_blank=True, default="")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class PageQuerySerializer(QuerySerializer):
|
|
38
|
+
space_key = serializers.CharField(max_length=64, required=False, allow_blank=True, default="")
|
|
39
|
+
under = serializers.CharField(max_length=1000, required=False, allow_blank=True, default="")
|
|
40
|
+
in_body = serializers.BooleanField(required=False, default=False)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class RequiredQuerySerializer(serializers.Serializer):
|
|
44
|
+
issue_type = serializers.CharField(max_length=64)
|
|
45
|
+
#: Fields the caller will fill besides summary, e.g. ``description``.
|
|
46
|
+
filled = serializers.ListField(child=serializers.CharField(max_length=64), required=False, default=list)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stapel-atlassian
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Jira and Confluence Cloud for Stapel: guarded client, integrations, connection provider
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/usestapel/stapel-atlassian
|
|
7
|
+
Project-URL: Repository, https://github.com/usestapel/stapel-atlassian
|
|
8
|
+
Project-URL: Documentation, https://github.com/usestapel/stapel-atlassian#readme
|
|
9
|
+
Project-URL: Changelog, https://github.com/usestapel/stapel-atlassian/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Issues, https://github.com/usestapel/stapel-atlassian/issues
|
|
11
|
+
Keywords: django,stapel,atlassian,jira,confluence
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: stapel-core<1.0,>=0.99.5
|
|
27
|
+
Requires-Dist: stapel-integrations-core<1.0,>=0.1.0
|
|
28
|
+
Requires-Dist: drf-spectacular>=0.27
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
Requires-Dist: pytest-django; extra == "test"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# stapel-atlassian
|
|
37
|
+
|
|
38
|
+
Jira and Confluence Cloud for Stapel: a guarded client, two integration classes and an `atlassian` connection provider.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install stapel-atlassian
|
|
44
|
+
```
|
|
45
|
+
Add `stapel_integrations_core` and `stapel_atlassian` to `INSTALLED_APPS`, mount `path("atlassian/", include("stapel_atlassian.urls"))`. The classes also work without Django.
|
|
46
|
+
|
|
47
|
+
## Use
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from stapel_atlassian import (AtlassianClient, AtlassianCredentials,
|
|
51
|
+
StapelJiraIntegration, StapelConfluenceIntegration, currentUser)
|
|
52
|
+
|
|
53
|
+
client = AtlassianClient(AtlassianCredentials("https://your-team.atlassian.net", email, api_token))
|
|
54
|
+
jira = StapelJiraIntegration(client)
|
|
55
|
+
confluence = StapelConfluenceIntegration(client)
|
|
56
|
+
|
|
57
|
+
jira.filter_issues(assignee=currentUser(), status="In Progress")
|
|
58
|
+
task = jira.create_issue("STPL", "Prepare the release notes", description="## Scope\n- changelog")
|
|
59
|
+
jira.transition(task.key, "Done")
|
|
60
|
+
|
|
61
|
+
parent = confluence.find_pages("Meeting notes", space_key="STPL")[0]
|
|
62
|
+
page = confluence.create_page(parent.id, "Weekly sync", markdown="## Decisions\n- ship it")
|
|
63
|
+
jira.link_confluence_page(task.key, page.url, page.title)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
See `MODULE.md` for the contract, `CONFIG.MD` for settings, `llms.txt` for agents.
|
|
67
|
+
|
|
68
|
+
MIT licensed.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
CONFIG.MD
|
|
2
|
+
LICENSE
|
|
3
|
+
MODULE.md
|
|
4
|
+
README.md
|
|
5
|
+
__init__.py
|
|
6
|
+
apps.py
|
|
7
|
+
conf.py
|
|
8
|
+
conftest.py
|
|
9
|
+
dto.py
|
|
10
|
+
llms.txt
|
|
11
|
+
presenters.py
|
|
12
|
+
py.typed
|
|
13
|
+
pyproject.toml
|
|
14
|
+
serializers.py
|
|
15
|
+
stpl_atlassian_adf.py
|
|
16
|
+
stpl_atlassian_client.py
|
|
17
|
+
stpl_atlassian_confluence.py
|
|
18
|
+
stpl_atlassian_jira.py
|
|
19
|
+
stpl_atlassian_jql.py
|
|
20
|
+
stpl_atlassian_provider.py
|
|
21
|
+
stpl_atlassian_storage.py
|
|
22
|
+
urls.py
|
|
23
|
+
urls_v1.py
|
|
24
|
+
views.py
|
|
25
|
+
./CONFIG.MD
|
|
26
|
+
./MODULE.md
|
|
27
|
+
./__init__.py
|
|
28
|
+
./apps.py
|
|
29
|
+
./conf.py
|
|
30
|
+
./conftest.py
|
|
31
|
+
./dto.py
|
|
32
|
+
./llms.txt
|
|
33
|
+
./presenters.py
|
|
34
|
+
./py.typed
|
|
35
|
+
./serializers.py
|
|
36
|
+
./stpl_atlassian_adf.py
|
|
37
|
+
./stpl_atlassian_client.py
|
|
38
|
+
./stpl_atlassian_confluence.py
|
|
39
|
+
./stpl_atlassian_jira.py
|
|
40
|
+
./stpl_atlassian_jql.py
|
|
41
|
+
./stpl_atlassian_provider.py
|
|
42
|
+
./stpl_atlassian_storage.py
|
|
43
|
+
./urls.py
|
|
44
|
+
./urls_v1.py
|
|
45
|
+
./views.py
|
|
46
|
+
stapel_atlassian.egg-info/PKG-INFO
|
|
47
|
+
stapel_atlassian.egg-info/SOURCES.txt
|
|
48
|
+
stapel_atlassian.egg-info/dependency_links.txt
|
|
49
|
+
stapel_atlassian.egg-info/requires.txt
|
|
50
|
+
stapel_atlassian.egg-info/top_level.txt
|
|
51
|
+
tests/test_module_names.py
|
|
52
|
+
tests/test_provider.py
|
|
53
|
+
tests/test_public_api.py
|
|
54
|
+
tests/test_stpl_atlassian_client.py
|
|
55
|
+
tests/test_stpl_atlassian_formats.py
|
|
56
|
+
tests/test_stpl_atlassian_products.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stapel_atlassian
|