external-systems 0.3.0__tar.gz → 0.101.0rc1__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 external-systems might be problematic. Click here for more details.

@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.3
2
+ Name: external-systems
3
+ Version: 0.101.0rc1
4
+ Summary: A Python library for interacting with Foundry Sources
5
+ License: Apache-2.0
6
+ Keywords: Palantir,Foundry,Sources,Compute Modules,Python Functions,Transforms
7
+ Author: Palantir Technologies, Inc.
8
+ Requires-Python: >=3.9,<4.0
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Dist: frozendict (>=2.4.6,<3.0.0)
17
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
18
+ Project-URL: Repository, https://github.com/palantir/external-systems
19
+ Description-Content-Type: text/markdown
20
+
21
+ # External Systems
22
+
23
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/external-systems)
24
+ [![PyPI](https://img.shields.io/pypi/v/external-systems)](https://pypi.org/project/external-systems/)
25
+ [![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0)
26
+ <a href="https://autorelease.general.dmz.palantir.tech/palantir/external-systems"><img src="https://img.shields.io/badge/Perform%20an-Autorelease-success.svg" alt="Autorelease"></a>
27
+
28
+ > [!WARNING]
29
+ > This SDK is incubating and subject to change.
30
+
31
+ ## About Foundry Sources
32
+
33
+ The External Systems library is Python SDK built as an interface to reference [Foundry Sources](https://www.palantir.com/docs/foundry/data-connection/set-up-source) from code.
34
+
35
+ ## Installation
36
+
37
+ You can install the Python package using `pip`:
38
+
39
+ ```sh
40
+ pip install external-systems
41
+ ```
42
+
43
+ ## Basic Source Usage
44
+
45
+ ### HTTP Client
46
+
47
+ For REST based sources, a preconfigured HTTP client is provided built on top of the Python requests library. For on-prem systems using [Agent Proxy](https://www.palantir.com/docs/foundry/data-connection/agent-proxy-runtime) the client will be pre-configured with the corresponding proxy
48
+
49
+ ```python
50
+ from external_systems.sources import Source, HttpsConnection
51
+ from requests import Session
52
+
53
+ my_source: Source = ...
54
+
55
+ https_connection: HttpsConnection = my_source.get_https_connection()
56
+
57
+ source_url: str = https_connection.url
58
+ http_client: Session = https_connection.get_client()
59
+
60
+ response = http_client.get(source_url + "/api/v1/example/", timeout=10)
61
+ ```
62
+
63
+ ### Secrets
64
+
65
+ Source secrets can be referenced using `get_secret("<secret_name>")` on the source.
66
+
67
+ ```python
68
+ from external_systems.sources import Source
69
+
70
+ my_source: Source = ...
71
+
72
+ some_secret: str = my_source.get_secret("SECRET_NAME")
73
+ ```
74
+
75
+ For sources using session credentials we support credentials generation and refresh management. Currently on an S3 source you can access session credentials using `get_aws_credentials()`. This method will throw if the source is not pre-configured with `AwsCredentials`
76
+
77
+ _Session credentials may not be available in all Foundry runtime environments_
78
+
79
+ ```python
80
+ from external_systems.sources import Source, Refreshable, AwsCredentials
81
+
82
+ s3_source: Source = ...
83
+
84
+ refreshable_credentials: Refreshable[AwsCredentials] = s3_source.get_aws_credentials()
85
+
86
+ session_credentials: AwsCredentials = refreshable_credentials.get()
87
+ ```
88
+
89
+ ## On-prem Connectivity with [Foundry Agent Proxy](https://www.palantir.com/docs/foundry/data-connection/agent-proxy-runtime)
90
+
91
+ ### Socket
92
+
93
+ For non-HTTP connections to external systems that require connections through Foundry's agent proxy, a pre-configured socket is provided.
94
+
95
+ #### On-Prem SFTP Server Example
96
+
97
+ For this example we'll be using the [fabric](https://docs.fabfile.org/en/latest/) library
98
+
99
+ ```python
100
+ import fabric
101
+
102
+ from external_systems.sources import Source
103
+ from socket import socket
104
+
105
+ SFTP_HOST = <sftp_host>
106
+ SFTP_PORT = <sftp_port>
107
+
108
+ on_prem_proxied_source: Source = ...
109
+
110
+ username: str = on_prem_sftp_server.get_secret("username")
111
+ password: str = on_prem_sftp_server.get_secret("password")
112
+
113
+ proxy_socket: socket = source.create_socket(SFTP_HOST, SFTP_PORT)
114
+
115
+ with fabric.Connection(
116
+ SFTP_HOST,
117
+ user=username,
118
+ port=SFTP_PORT,
119
+ connect_kwargs={
120
+ "password": password,
121
+ "sock": proxy_socket,
122
+ },
123
+ ) as conn:
124
+ sftp = conn.sftp()
125
+ file_list = sftp.listdir(".")
126
+ ```
127
+
128
+ ### Authenticated Proxy URI
129
+
130
+ For more granular use cases a pre-authenticated proxy URI is provided to allow connections to on-prem external systems.
131
+
132
+ #### Example
133
+
134
+ We'll be using the [httpx](https://www.python-httpx.org/) library.
135
+
136
+ ```python
137
+ import httpx
138
+
139
+ from external_systems.sources import Source
140
+
141
+ on_prem_system: Source = ...
142
+
143
+ authenticated_proxy_uri: str = on_prem_system.get_https_proxy_uri()
144
+
145
+ with httpx.Client(proxy=authenticated_proxy_uri) as client:
146
+ ...
147
+ ```
148
+
@@ -0,0 +1,127 @@
1
+ # External Systems
2
+
3
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/external-systems)
4
+ [![PyPI](https://img.shields.io/pypi/v/external-systems)](https://pypi.org/project/external-systems/)
5
+ [![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0)
6
+ <a href="https://autorelease.general.dmz.palantir.tech/palantir/external-systems"><img src="https://img.shields.io/badge/Perform%20an-Autorelease-success.svg" alt="Autorelease"></a>
7
+
8
+ > [!WARNING]
9
+ > This SDK is incubating and subject to change.
10
+
11
+ ## About Foundry Sources
12
+
13
+ The External Systems library is Python SDK built as an interface to reference [Foundry Sources](https://www.palantir.com/docs/foundry/data-connection/set-up-source) from code.
14
+
15
+ ## Installation
16
+
17
+ You can install the Python package using `pip`:
18
+
19
+ ```sh
20
+ pip install external-systems
21
+ ```
22
+
23
+ ## Basic Source Usage
24
+
25
+ ### HTTP Client
26
+
27
+ For REST based sources, a preconfigured HTTP client is provided built on top of the Python requests library. For on-prem systems using [Agent Proxy](https://www.palantir.com/docs/foundry/data-connection/agent-proxy-runtime) the client will be pre-configured with the corresponding proxy
28
+
29
+ ```python
30
+ from external_systems.sources import Source, HttpsConnection
31
+ from requests import Session
32
+
33
+ my_source: Source = ...
34
+
35
+ https_connection: HttpsConnection = my_source.get_https_connection()
36
+
37
+ source_url: str = https_connection.url
38
+ http_client: Session = https_connection.get_client()
39
+
40
+ response = http_client.get(source_url + "/api/v1/example/", timeout=10)
41
+ ```
42
+
43
+ ### Secrets
44
+
45
+ Source secrets can be referenced using `get_secret("<secret_name>")` on the source.
46
+
47
+ ```python
48
+ from external_systems.sources import Source
49
+
50
+ my_source: Source = ...
51
+
52
+ some_secret: str = my_source.get_secret("SECRET_NAME")
53
+ ```
54
+
55
+ For sources using session credentials we support credentials generation and refresh management. Currently on an S3 source you can access session credentials using `get_aws_credentials()`. This method will throw if the source is not pre-configured with `AwsCredentials`
56
+
57
+ _Session credentials may not be available in all Foundry runtime environments_
58
+
59
+ ```python
60
+ from external_systems.sources import Source, Refreshable, AwsCredentials
61
+
62
+ s3_source: Source = ...
63
+
64
+ refreshable_credentials: Refreshable[AwsCredentials] = s3_source.get_aws_credentials()
65
+
66
+ session_credentials: AwsCredentials = refreshable_credentials.get()
67
+ ```
68
+
69
+ ## On-prem Connectivity with [Foundry Agent Proxy](https://www.palantir.com/docs/foundry/data-connection/agent-proxy-runtime)
70
+
71
+ ### Socket
72
+
73
+ For non-HTTP connections to external systems that require connections through Foundry's agent proxy, a pre-configured socket is provided.
74
+
75
+ #### On-Prem SFTP Server Example
76
+
77
+ For this example we'll be using the [fabric](https://docs.fabfile.org/en/latest/) library
78
+
79
+ ```python
80
+ import fabric
81
+
82
+ from external_systems.sources import Source
83
+ from socket import socket
84
+
85
+ SFTP_HOST = <sftp_host>
86
+ SFTP_PORT = <sftp_port>
87
+
88
+ on_prem_proxied_source: Source = ...
89
+
90
+ username: str = on_prem_sftp_server.get_secret("username")
91
+ password: str = on_prem_sftp_server.get_secret("password")
92
+
93
+ proxy_socket: socket = source.create_socket(SFTP_HOST, SFTP_PORT)
94
+
95
+ with fabric.Connection(
96
+ SFTP_HOST,
97
+ user=username,
98
+ port=SFTP_PORT,
99
+ connect_kwargs={
100
+ "password": password,
101
+ "sock": proxy_socket,
102
+ },
103
+ ) as conn:
104
+ sftp = conn.sftp()
105
+ file_list = sftp.listdir(".")
106
+ ```
107
+
108
+ ### Authenticated Proxy URI
109
+
110
+ For more granular use cases a pre-authenticated proxy URI is provided to allow connections to on-prem external systems.
111
+
112
+ #### Example
113
+
114
+ We'll be using the [httpx](https://www.python-httpx.org/) library.
115
+
116
+ ```python
117
+ import httpx
118
+
119
+ from external_systems.sources import Source
120
+
121
+ on_prem_system: Source = ...
122
+
123
+ authenticated_proxy_uri: str = on_prem_system.get_https_proxy_uri()
124
+
125
+ with httpx.Client(proxy=authenticated_proxy_uri) as client:
126
+ ...
127
+ ```
@@ -16,4 +16,4 @@
16
16
  # The version is set during the publishing step (since we can't know the version in advance)
17
17
  # using the autorelease bot
18
18
 
19
- __version__ = "0.3.0"
19
+ __version__ = "0.101.0-rc1"
@@ -104,7 +104,7 @@ class Source:
104
104
  new_ca_contents.append(required_ca)
105
105
 
106
106
  with NamedTemporaryFile(delete=False, mode="w") as ca_bundle_file:
107
- ca_bundle_file.write(os.linesep.join(new_ca_contents) + os.linesep)
107
+ ca_bundle_file.write("".join(new_ca_contents) + os.linesep)
108
108
  return ca_bundle_file.name
109
109
 
110
110
  @cached_property
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "external-systems"
3
- version = "0.3.0"
3
+ version = "0.101.0-rc1"
4
4
  description = "A Python library for interacting with Foundry Sources"
5
5
  authors = ["Palantir Technologies, Inc."]
6
6
  license = "Apache-2.0"
@@ -1,75 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: external-systems
3
- Version: 0.3.0
4
- Summary: A Python library for interacting with Foundry Sources
5
- License: Apache-2.0
6
- Keywords: Palantir,Foundry,Sources,Compute Modules,Python Functions,Transforms
7
- Author: Palantir Technologies, Inc.
8
- Requires-Python: >=3.9,<4.0
9
- Classifier: License :: OSI Approved :: Apache Software License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Requires-Dist: frozendict (>=2.4.6,<3.0.0)
17
- Requires-Dist: requests (>=2.32.3,<3.0.0)
18
- Project-URL: Repository, https://github.com/palantir/external-systems
19
- Description-Content-Type: text/markdown
20
-
21
- # External Systems
22
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/external-systems)
23
- [![PyPI](https://img.shields.io/pypi/v/external-systems)](https://pypi.org/project/external-systems/)
24
- [![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0)
25
- <a href="https://autorelease.general.dmz.palantir.tech/palantir/external-systems"><img src="https://img.shields.io/badge/Perform%20an-Autorelease-success.svg" alt="Autorelease"></a>
26
-
27
- > [!WARNING]
28
- > This SDK is incubating and subject to change.
29
-
30
-
31
- ## About Foundry Sources
32
-
33
- The External Systems library is Python SDK built as an interface to reference [Foundry Sources](https://www.palantir.com/docs/foundry/data-connection/set-up-source) from code.
34
-
35
- <a id="installation"></a>
36
- ## Installation
37
- You can install the Python package using `pip`:
38
-
39
- ```sh
40
- pip install external-systems
41
- ```
42
-
43
- <a id="basic-usage"></a>
44
- ## Basic Source Usage
45
-
46
- ### Credentials
47
-
48
- Long lived credentials can be referenced using `get_secret()` on the source.
49
-
50
- ```python
51
- my_source: Source = ...
52
-
53
- some_secret = my_source.get_secret("SECRET_NAME")
54
- ```
55
-
56
- For sources using session credentials we support credentials generation and refresh management. Currently on an S3 source you can access session credentials using `get_aws_credentials()`.
57
-
58
- ```python
59
- s3_source: Source = ...
60
-
61
- refreshable_credentials: Refreshable[AwsCredentials] = s3_source.get_aws_credentials()
62
-
63
- session_credentials: AwsCredentials = refreshable_credentials.get()
64
- ```
65
-
66
- ### HTTP Client
67
- For REST based sources, a preconfigured HTTP client is provided built on top of the Python requests library.
68
-
69
- ```python
70
- source_url = my_source.get_https_connection().url
71
- http_client = my_source.get_https_connection().get_client()
72
-
73
- response = http_client.get(source_url + "/api/v1/example/", timeout=10)
74
- ```
75
-
@@ -1,54 +0,0 @@
1
- # External Systems
2
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/external-systems)
3
- [![PyPI](https://img.shields.io/pypi/v/external-systems)](https://pypi.org/project/external-systems/)
4
- [![License](https://img.shields.io/badge/License-Apache%202.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0)
5
- <a href="https://autorelease.general.dmz.palantir.tech/palantir/external-systems"><img src="https://img.shields.io/badge/Perform%20an-Autorelease-success.svg" alt="Autorelease"></a>
6
-
7
- > [!WARNING]
8
- > This SDK is incubating and subject to change.
9
-
10
-
11
- ## About Foundry Sources
12
-
13
- The External Systems library is Python SDK built as an interface to reference [Foundry Sources](https://www.palantir.com/docs/foundry/data-connection/set-up-source) from code.
14
-
15
- <a id="installation"></a>
16
- ## Installation
17
- You can install the Python package using `pip`:
18
-
19
- ```sh
20
- pip install external-systems
21
- ```
22
-
23
- <a id="basic-usage"></a>
24
- ## Basic Source Usage
25
-
26
- ### Credentials
27
-
28
- Long lived credentials can be referenced using `get_secret()` on the source.
29
-
30
- ```python
31
- my_source: Source = ...
32
-
33
- some_secret = my_source.get_secret("SECRET_NAME")
34
- ```
35
-
36
- For sources using session credentials we support credentials generation and refresh management. Currently on an S3 source you can access session credentials using `get_aws_credentials()`.
37
-
38
- ```python
39
- s3_source: Source = ...
40
-
41
- refreshable_credentials: Refreshable[AwsCredentials] = s3_source.get_aws_credentials()
42
-
43
- session_credentials: AwsCredentials = refreshable_credentials.get()
44
- ```
45
-
46
- ### HTTP Client
47
- For REST based sources, a preconfigured HTTP client is provided built on top of the Python requests library.
48
-
49
- ```python
50
- source_url = my_source.get_https_connection().url
51
- http_client = my_source.get_https_connection().get_client()
52
-
53
- response = http_client.get(source_url + "/api/v1/example/", timeout=10)
54
- ```