port-ocean 0.10.0__py3-none-any.whl → 0.10.2__py3-none-any.whl

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 port-ocean might be problematic. Click here for more details.

@@ -1,12 +1,39 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  import click
4
+ import json
4
5
  from cookiecutter.main import cookiecutter # type: ignore
6
+ import os
5
7
 
6
8
  from port_ocean.cli.commands.main import cli_start, print_logo, console
7
9
  from port_ocean.cli.utils import cli_root_path
8
10
 
9
11
 
12
+ def add_vscode_configuration(result: str, name: str) -> None:
13
+ vscode_entry_root_path = "${workspaceFolder}/integrations/" + name
14
+ new_vscode_entry = {
15
+ "console": "integratedTerminal",
16
+ "cwd": vscode_entry_root_path,
17
+ "envFile": f"{vscode_entry_root_path}/.env",
18
+ "justMyCode": True,
19
+ "name": f"Run {name} integration",
20
+ "program": f"{vscode_entry_root_path}/debug.py",
21
+ "python": f"{vscode_entry_root_path}/.venv/bin/python",
22
+ "request": "launch",
23
+ "type": "debugpy",
24
+ }
25
+
26
+ vs_code_json_path = os.path.join(os.path.dirname(result), "../.vscode/launch.json")
27
+ if not os.path.exists(vs_code_json_path):
28
+ return
29
+ vs_code_json = json.load(open(vs_code_json_path, "r"))
30
+ vs_code_json["configurations"].append(new_vscode_entry)
31
+
32
+ with open(vs_code_json_path, "w") as vs_code_json_file:
33
+ json.dump(vs_code_json, vs_code_json_file, indent=2)
34
+ vs_code_json_file.write("\n")
35
+
36
+
10
37
  @cli_start.command()
11
38
  @click.argument("path", default=".", type=click.Path(exists=True))
12
39
  @click.option(
@@ -37,6 +64,9 @@ def new(path: str, is_private_integration: bool) -> None:
37
64
  )
38
65
  name = result.split("/")[-1]
39
66
 
67
+ if not is_private_integration:
68
+ add_vscode_configuration(result, name)
69
+
40
70
  console.print(
41
71
  "\n🌊 Ahoy, Captain! Your project is ready to set sail into the vast ocean of possibilities!",
42
72
  style="bold",
@@ -47,10 +77,14 @@ def new(path: str, is_private_integration: bool) -> None:
47
77
  f"▶️ [bold][blue]cd {path}/{name} && make install && . .venv/bin/activate[/blue][/bold]\n"
48
78
  )
49
79
  console.print(
50
- "⚓️ Set sail with [blue]Ocean[/blue]: Run [bold][blue]ocean sail[/blue] <path_to_integration>[/bold] to run the project using Ocean.\n"
51
- f"▶️ [bold][blue]ocean sail {path}/{name}[/blue][/bold] \n"
80
+ f"⚓️ Copy example env file: Run [bold][blue]cp {path}/{name}.env.example {path}/{name}/.env [/blue][/bold] and set your port credentials in the created file.\n"
52
81
  )
53
82
  console.print(
54
- "⚓️ Smooth sailing with [blue]Make[/blue]: Alternatively, you can run [bold][blue]make run[/blue][/bold] to launch your project using Make. \n"
55
- f"▶️ [bold][blue]make run {path}/{name}[/blue][/bold]"
83
+ "⚓️ Set sail with [blue]Ocean[/blue]: Run [bold][blue]ocean sail[/blue] <path_to_integration>[/bold] to run the project using Ocean.\n"
84
+ f"▶️ [bold][blue]ocean sail {path}/{name}[/blue][/bold] \n"
56
85
  )
86
+ if not is_private_integration:
87
+ console.print(
88
+ "⚓️ Smooth sailing with [blue]Make[/blue]: Alternatively, you can run [bold][blue]make run[/blue][/bold] to launch your project using Make. \n"
89
+ f"▶️ [bold][blue]make run {path}/{name}[/blue][/bold]"
90
+ )
@@ -0,0 +1,2 @@
1
+ OCEAN__PORT__CLIENT_ID="<port-client-id>"
2
+ OCEAN__PORT__CLIENT_SECRET="<port-client-secret>"
@@ -0,0 +1,41 @@
1
+ [
2
+ {
3
+ "identifier": "{{ cookiecutter.integration_slug }}ExampleBlueprint",
4
+ "title": "{{ cookiecutter.integration_name }} Example",
5
+ "icon": "Blueprint",
6
+ "schema": {
7
+ "properties": {
8
+ "status": {
9
+ "type": "string",
10
+ "enum": [
11
+ "VALID",
12
+ "FAILED"
13
+ ],
14
+ "enumColors": {
15
+ "VALID": "green",
16
+ "FAILED": "red"
17
+ },
18
+ "title": "Status"
19
+ },
20
+ "text": {
21
+ "type": "string",
22
+ "title": "Text"
23
+ },
24
+ "component": {
25
+ "type": "string",
26
+ "title": "Component"
27
+ },
28
+ "service": {
29
+ "type": "string",
30
+ "title": "Service"
31
+ },
32
+ "score": {
33
+ "type": "number",
34
+ "title": "Score"
35
+ }
36
+ },
37
+ "required": []
38
+ },
39
+ "relations": {}
40
+ }
41
+ ]
@@ -0,0 +1,16 @@
1
+ resources:
2
+ - kind: {{ cookiecutter.integration_slug}}-example-kind
3
+ selector:
4
+ query: 'true'
5
+ port:
6
+ entity:
7
+ mappings:
8
+ identifier: .my_custom_id
9
+ title: '(.my_component + " @ " + .my_service)'
10
+ blueprint: '"{{ cookiecutter.integration_slug }}ExampleBlueprint"'
11
+ properties:
12
+ status: .my_enum
13
+ text: .my_custom_text
14
+ component: .my_component
15
+ service: .my_service
16
+ score: .my_special_score
@@ -1,14 +1,14 @@
1
1
  description: {{cookiecutter.integration_name}} integration for Port Ocean
2
- icon: Cookiecutter # Should be one of the available icons in Port
2
+ icon: Cookiecutter # Should be one of the available icons in Port
3
3
  features:
4
4
  - type: exporter
5
- section: Git Providers # Should be one of the available sections in Port
5
+ section: Under Development # Should be one of the available sections in Port
6
6
  resources:
7
- - kind: <ResourceName1>
8
- - kind: <ResourceName2>
7
+ - kind: {{ cookiecutter.integration_slug }}-example-kind
8
+ # - kind: <ResourceName2>
9
9
  configurations:
10
- - name: myGitToken
11
- required: true
10
+ - name: my{{ cookiecutter.integration_slug}}Token
11
+ # required: true
12
12
  type: string
13
13
  sensitive: true
14
14
  - name: someApplicationUrl
@@ -1,4 +1,4 @@
1
- # Changelog
1
+ # Changelog - Ocean - {{ cookiecutter.integration_slug }}
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
@@ -0,0 +1,7 @@
1
+ # Contributing to Ocean - {{ cookiecutter.integration_slug }}
2
+
3
+ ## Running locally
4
+
5
+ #### NOTE: Add your own instructions of how to run {{ cookiecutter.integration_slug }}
6
+
7
+ This could be any gotcha's such as rate limiting, how to setup credentials and so forth
@@ -55,8 +55,8 @@ lint:
55
55
  run:
56
56
  $(ACTIVATE) && ocean sail
57
57
 
58
- test: lint
59
- $(ACTIVATE) && poetry run pytest
58
+ test:
59
+ $(ACTIVATE) && poetry run pytest -n auto
60
60
 
61
61
  clean:
62
62
  @find . -name '.venv' -type d -exec rm -rf {} \;
@@ -71,4 +71,4 @@ clean:
71
71
  rm -rf htmlcov
72
72
  rm -rf .tox/
73
73
  rm -rf docs/_build
74
- rm -rf dist/
74
+ rm -rf dist/
@@ -15,6 +15,21 @@ async def on_resync(kind: str) -> list[dict[Any, Any]]:
15
15
  # return [{"some_project_key": "someProjectValue", ...}]
16
16
  # if kind == "issues":
17
17
  # return [{"some_issue_key": "someIssueValue", ...}]
18
+
19
+ # Initial stub to show complete flow, replace this with your own logic
20
+ if kind == "{{ cookiecutter.integration_slug }}-example-kind":
21
+ return [
22
+ {
23
+ "my_custom_id": f"id_{x}",
24
+ "my_custom_text": f"very long text with {x} in it",
25
+ "my_special_score": x * 32 % 3,
26
+ "my_component": f"component-{x}",
27
+ "my_service": f"service-{x %2}",
28
+ "my_enum": "VALID" if x % 2 == 0 else "FAILED",
29
+ }
30
+ for x in range(25)
31
+ ]
32
+
18
33
  return []
19
34
 
20
35
 
@@ -38,4 +53,4 @@ async def on_resync(kind: str) -> list[dict[Any, Any]]:
38
53
  async def on_start() -> None:
39
54
  # Something to do when the integration starts
40
55
  # For example create a client to query 3rd party services - GitHub, Jira, etc...
41
- print("Starting integration")
56
+ print("Starting {{ cookiecutter.integration_slug }} integration")
@@ -9,13 +9,17 @@ python = "^3.11"
9
9
  port_ocean = { version = "^{% version %}", extras = ["cli"] }
10
10
 
11
11
  [tool.poetry.group.dev.dependencies]
12
+ # Uncomment this if you want to debug the ocean core together with your integration
13
+ # port_ocean = { path = '../../', develop = true, extras = ['all'] }
12
14
  pytest = "^7.2"
15
+ pytest-xdist = "^3.6.1"
16
+ pre-commit = "^3.7.1"
17
+ requests = "^2.32.3"
13
18
  black = "^23.3.0"
14
19
  mypy = "^1.3.0"
15
20
  ruff = "^0.0.278"
16
21
  pylint = "^2.17.4"
17
22
  towncrier = "^23.6.0"
18
- pytest-xdist = "^3.6.1"
19
23
 
20
24
  [tool.towncrier]
21
25
  directory = "changelog"
@@ -54,8 +58,8 @@ underlines = [""]
54
58
  showcontent = true
55
59
 
56
60
  [build-system]
57
- requires = ["poetry>=0.12"]
58
- build-backend = "poetry.masonry.api"
61
+ requires = ["poetry-core>=1.0.0"]
62
+ build-backend = "poetry.core.masonry.api"
59
63
 
60
64
  [tool.mypy]
61
65
  exclude = [
@@ -1,4 +1,4 @@
1
- from typing import Any, Literal, Type
1
+ from typing import Any, Literal, Type, cast
2
2
 
3
3
  from pydantic import Extra, AnyHttpUrl, parse_obj_as, parse_raw_as
4
4
  from pydantic.class_validators import root_validator, validator
@@ -55,9 +55,8 @@ class IntegrationSettings(BaseOceanModel, extra=Extra.allow):
55
55
  integ_type = get_integration_name()
56
56
 
57
57
  values["type"] = integ_type.lower() if integ_type else None
58
- values["identifier"] = values.get(
59
- "identifier", f"my-{integ_type}-integration".lower()
60
- )
58
+ if not values.get("identifier"):
59
+ values["identifier"] = f"my-{integ_type}-integration".lower()
61
60
 
62
61
  return values
63
62
 
@@ -71,7 +70,9 @@ class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow):
71
70
  client_timeout: int = 30
72
71
  send_raw_data_examples: bool = True
73
72
  port: PortSettings
74
- event_listener: EventListenerSettingsType
73
+ event_listener: EventListenerSettingsType = Field(
74
+ default=cast(EventListenerSettingsType, {"type": "POLLING"})
75
+ )
75
76
  # If an identifier or type is not provided, it will be generated based on the integration name
76
77
  integration: IntegrationSettings = Field(
77
78
  default_factory=lambda: IntegrationSettings(type="", identifier="")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.10.0
3
+ Version: 0.10.2
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -9,7 +9,7 @@ port_ocean/cli/commands/defaults/dock.py,sha256=pFtHrU_LTvb5Ddrzj09Wxy-jg1Ym10wB
9
9
  port_ocean/cli/commands/defaults/group.py,sha256=hii_4CYoQ7jSMePbnP4AmruO_RKWCUcoV7dXXBlZafc,115
10
10
  port_ocean/cli/commands/list_integrations.py,sha256=DVVioFruGUE-_v6UUHlcemWNN6RlWwCrf1X4HmAXsf8,1134
11
11
  port_ocean/cli/commands/main.py,sha256=gj0lmuLep2XeLNuabB7Wk0UVYPT7_CD_rAw5AoUQWSE,1057
12
- port_ocean/cli/commands/new.py,sha256=y8QFeISoXb31a4RqMhXCDIPa3gJSYz2NPMGEI5p0Hxc,2074
12
+ port_ocean/cli/commands/new.py,sha256=3hefYQrFXJzwfoJgV8yHgnB0HYOVmk3-6XQeb694_Ao,3404
13
13
  port_ocean/cli/commands/pull.py,sha256=VvrRjLNlfPuLIf7KzeIcbzzdi98Z0M9wCRpXC3QPxdI,2306
14
14
  port_ocean/cli/commands/sail.py,sha256=rY7rEMjfy_KXiWvtL0T72TTLgeQ3HW4SOzKkz9wL9nI,2282
15
15
  port_ocean/cli/commands/version.py,sha256=hEuIEIcm6Zkamz41Z9nxeSM_4g3oNlAgWwQyDGboh-E,536
@@ -18,18 +18,22 @@ port_ocean/cli/cookiecutter/cookiecutter.json,sha256=N5UrAP2e5JbgEDz_WTQFIZlzSve
18
18
  port_ocean/cli/cookiecutter/extensions.py,sha256=eQNjZvy2enDkJpvMbBGil77Xk9-38f862wfnmCjdoBc,446
19
19
  port_ocean/cli/cookiecutter/hooks/post_gen_project.py,sha256=N-gcNPhVSMGBPI69etVU2QgyhvdzaxNMvUZbyYSdVM4,413
20
20
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.dockerignore,sha256=9Mz_WI7XBpKzlJ7ILb4vlcuzYkh98Ql3bP_5GHN1sRY,1034
21
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.env.example,sha256=LnNPRe3RnzjWPL4tNLYEQiMvFEZHSy3ceqwQEapcpwE,92
21
22
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.gitignore,sha256=32p1lDW_g5hyBz486GWfDeR9m7ikFlASVri5a8vmNoo,2698
22
23
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/.gitignore,sha256=kCpRPdl3S_jqYYZaOrc0-xa6-l3KqVjNRXc6jCkd_-Q,12
23
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/spec.yaml,sha256=jTYvu-Iayl-bxc917Y7ejcC9KyvH-LSq4-bdYZCYsuM,457
24
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CHANGELOG.md,sha256=nzAmB0Bjnd2eZo79OjrlyVOdpTBHTmTxvO7c2C8Q-VQ,292
24
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/blueprints.json,sha256=9kf5gY4YjP78vEPfd9j7347sV6wiqeHzmBz7UJkvmDg,1187
25
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/resources/port-app-config.yml,sha256=pErf4_7-Be2C40JTDJHMywtizUTaQbqyn-SBhCB2ies,507
26
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/.port/spec.yaml,sha256=ie8bI_QOZnJJVG-N1e4KlMebdYts4LUNO_kKw8nGdhA,531
27
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CHANGELOG.md,sha256=XVSgyxfXJZoZmtwaGbQ8XmCapIthe4E7flfuJub-m_s,338
28
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/CONTRIBUTING.md,sha256=ZQwD3K35q0wugHZmb1z5wnynmn0uuzwGFSpjm7GieZU,259
25
29
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Dockerfile,sha256=LsH3vZqqEJkzeQG44cE7JkvPAuh_WPSqYam4YoMvG3M,328
26
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Makefile,sha256=kTa72qEp8pi-joOH6zl8oeIgjEHSCF628p2074yHHNA,1779
30
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/Makefile,sha256=2eoJjrQj_zxapvuhX3ohVSgDGgWIF-VwgGvrWPfl5vw,1783
27
31
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/README.md,sha256=5VZmgDRW9gO4d8UuzkujslOIDfIDBiAGL2Hd74HK770,468
28
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/changelog/.gitignore,sha256=kCpRPdl3S_jqYYZaOrc0-xa6-l3KqVjNRXc6jCkd_-Q,12
32
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/changelog/.gitignore,sha256=JAo-DTfS6GthQGP1NH6wLU-ZymwlTea4KHH_jZVTKn0,14
29
33
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/debug.py,sha256=_TRsA2s6GV2E3CTI8CHcsH-ZuH4_Eh5-juDXWaET0ho,65
30
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/main.py,sha256=KxxtBrRygYOP0bulXySVYwX0fm_mm3QHqeEqwDwgXgY,1669
34
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/main.py,sha256=XUwo9yroqSKxAdwVrTKGNGSWvec9n1Rh9Cqvep4HIuE,2257
31
35
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/poetry.toml,sha256=kENq8nNmFPIzw9vySheyG4xHxAPuBSpZO1CYGD6G2NE,46
32
- port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/pyproject.toml,sha256=oR-M7hj8eYit_EzaJeEDSNn4fDCqLJkF3NdKo0L4viM,1999
36
+ port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/pyproject.toml,sha256=3DvCdbagz9RczLtBJlmec9zZ5jOepGZ_0SwUE_Xr2ZA,2206
33
37
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/sonar-project.properties,sha256=timmRpoSd50BdxLf45OcFUk2qs855z610kzz3yLAqJw,124
34
38
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
39
  port_ocean/cli/cookiecutter/{{cookiecutter.integration_slug}}/tests/test_sample.py,sha256=Ew5LA_G1k6DC5a2ygU2FoyjZQa0fRmPy73N0bio0d14,46
@@ -49,7 +53,7 @@ port_ocean/clients/port/utils.py,sha256=O9mBu6zp4TfpS4SQ3qCPpn9ZVyYF8GKnji4UnYhM
49
53
  port_ocean/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
54
  port_ocean/config/base.py,sha256=x1gFbzujrxn7EJudRT81C6eN9WsYAb3vOHwcpcpX8Tc,6370
51
55
  port_ocean/config/dynamic.py,sha256=qOFkRoJsn_BW7581omi_AoMxoHqasf_foxDQ_G11_SI,2030
52
- port_ocean/config/settings.py,sha256=EguKa8idZWylil_dQucip6W_q4_WzfTr4_XQjtyE4ds,4187
56
+ port_ocean/config/settings.py,sha256=ULv_n7Al94Vyw7Qo4pfbAay6_0sc56s9eAUoOPqVlPo,4274
53
57
  port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
58
  port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
55
59
  port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -128,8 +132,8 @@ port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,32
128
132
  port_ocean/utils/signal.py,sha256=K-6kKFQTltcmKDhtyZAcn0IMa3sUpOHGOAUdWKgx0_E,1369
129
133
  port_ocean/utils/time.py,sha256=pufAOH5ZQI7gXvOvJoQXZXZJV-Dqktoj9Qp9eiRwmJ4,1939
130
134
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
131
- port_ocean-0.10.0.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
132
- port_ocean-0.10.0.dist-info/METADATA,sha256=1T_SKzgGSYS3uiNJ6B29dszAsryEHYt0lm4r6TmyFng,6616
133
- port_ocean-0.10.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
134
- port_ocean-0.10.0.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
135
- port_ocean-0.10.0.dist-info/RECORD,,
135
+ port_ocean-0.10.2.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
136
+ port_ocean-0.10.2.dist-info/METADATA,sha256=L5Aa6v-KJXAUJ_z2X3GbpGaWBk0_8MO7YbPfzaWg4Io,6616
137
+ port_ocean-0.10.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
138
+ port_ocean-0.10.2.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
139
+ port_ocean-0.10.2.dist-info/RECORD,,