Skip to content

Commit cdb1c4d

Browse files
committed
Merge main
2 parents e95d4f7 + b8c5e74 commit cdb1c4d

File tree

12 files changed

+23
-28
lines changed

12 files changed

+23
-28
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Lint with Ruff
5252
run: |
5353
pip install ruff
54-
ruff --output-format=github --exclude=src/onepassword/lib/ .
54+
ruff check --output-format=github --exclude=src/onepassword/lib/ .
5555
continue-on-error: true
5656

5757
# This action is called by the /ok-to-test command, once the forked PR's code has been security reviewed.

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To use the 1Password Python SDK in your project:
5151
2. Install the 1Password Python SDK in your project:
5252

5353
```bash
54-
pip install git+ssh://[email protected]/1Password/[email protected].7
54+
pip install git+ssh://[email protected]/1Password/[email protected].9
5555
```
5656

5757
3. Use the Python SDK in your project:
@@ -65,7 +65,7 @@ async def main():
6565
# Gets your service account token from the OP_SERVICE_ACCOUNT_TOKEN environment variable.
6666
token = os.getenv("OP_SERVICE_ACCOUNT_TOKEN")
6767

68-
# Connects to 1Password.
68+
# Connects to 1Password. Fill in your own integration name and version.
6969
client = await Client.authenticate(auth=token, integration_name="My 1Password Integration", integration_version="v1.0.0")
7070

7171
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
@@ -79,8 +79,6 @@ if __name__ == '__main__':
7979

8080
Make sure to use [secret reference URIs](https://developer.1password.com/docs/cli/secrets-reference-syntax/) with the syntax `op://vault/item/field` to securely load secrets from 1Password into your code.
8181

82-
Inside `Client.authenticate(...)`, set `integration_name` to the name of your application and `integration_version` to the version of your application.
83-
8482
## 📖 Learn more
8583

8684
- [Load secrets with 1Password SDKs](https://developer.1password.com/docs/sdks/load-secrets)

example/example.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ async def main():
1111
# Connects to 1Password.
1212
client = await Client.authenticate(
1313
auth=token,
14+
# Set the following to your own integration name and version.
1415
integration_name="My 1Password Integration",
1516
integration_version="v1.0.0",
1617
)

setup.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,19 @@ def finalize_options(self):
2020
def get_shared_library_data_to_include():
2121
# Return the correct uniffi C shared library extension for the given platform
2222
include_path = "lib"
23-
if platform.machine().lower() == "x86_64" or platform.machine().lower() == "amd64":
23+
machine_type = platform.machine().lower()
24+
if machine_type in ["x86_64", "amd64"]:
2425
include_path = os.path.join(include_path, "x86_64")
25-
elif (
26-
platform.machine().lower() == "aarch64" or platform.machine().lower() == "arm64"
27-
):
26+
elif machine_type in ["aarch64", "arm64"]:
2827
include_path = os.path.join(include_path, "aarch64")
2928

30-
c_shared_library_file_name = ""
31-
if platform.system() == "Darwin":
32-
c_shared_library_file_name = "libop_uniffi_core.dylib"
33-
elif platform.system() == "Linux":
34-
c_shared_library_file_name = "libop_uniffi_core.so"
35-
elif platform.system() == "Windows":
36-
c_shared_library_file_name = "op_uniffi_core.dll"
37-
29+
# Map current platform to the correct shared library file name
30+
platform_to_lib = {
31+
"Darwin": "libop_uniffi_core.dylib",
32+
"Linux": "libop_uniffi_core.so",
33+
"Windows": "op_uniffi_core.dll"
34+
}
35+
c_shared_library_file_name = platform_to_lib.get(platform.system(), "")
3836
c_shared_library_file_name = os.path.join(include_path, c_shared_library_file_name)
3937

4038
uniffi_bindings_file_name = "op_uniffi_core.py"
@@ -45,7 +43,7 @@ def get_shared_library_data_to_include():
4543

4644
setup(
4745
name="onepassword",
48-
version="0.1.0-beta.1",
46+
version="0.1.0-beta.10",
4947
author="1Password",
5048
description="The 1Password Python SDK offers programmatic read access to your secrets in 1Password in an interface native to Python.",
5149
url="https://github.com/1Password/onepassword-sdk-python",

src/onepassword/core.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
import platform
33

44

5-
if platform.machine().lower() == "x86_64" or platform.machine().lower() == "amd64":
5+
machine_arch = platform.machine().lower()
6+
7+
if machine_arch in ["x86_64", "amd64"]:
68
import onepassword.lib.x86_64.op_uniffi_core as core
7-
elif platform.machine().lower() == "aarch64" or platform.machine().lower() == "arm64":
9+
elif machine_arch in ["aarch64", "arm64"]:
810
import onepassword.lib.aarch64.op_uniffi_core as core
911
else:
10-
raise ImportError(
11-
"your machine's architecture is not currently supported: {}".format(
12-
platform.machine()
13-
)
14-
)
12+
raise ImportError(f"Your machine's architecture is not currently supported: {machine_arch}")
1513

1614

1715
# InitClient creates a client instance in the current core module and returns its unique ID.

src/onepassword/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import platform
22

33
SDK_LANGUAGE = "Python"
4-
SDK_VERSION = "0010001" # v0.1.0
4+
SDK_VERSION = "0010010" # v0.1.0-beta.10
55
DEFAULT_INTEGRATION_NAME = "Unknown"
66
DEFAULT_INTEGRATION_VERSION = "Unknown"
77
DEFAULT_REQUEST_LIBRARY = "net/http"

src/onepassword/items.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def get(self, vault_id, item_id):
4343
return result
4444

4545
async def update(self, item):
46-
"""Update an existing item. Warning: Only text and concealed fields are currently supported. Other fields will be permanently lost when you update an item."""
46+
"""Update an existing item. You can currently only edit text and concealed fields."""
4747
response = await _invoke(
4848
{
4949
"clientId": self.client_id,
@@ -59,7 +59,7 @@ async def update(self, item):
5959
return result
6060

6161
async def delete(self, vault_id, item_id):
62-
"""Delete an item. Warning: Information saved in fields other than text and concealed fields will be permanently lost."""
62+
"""Delete an item. """
6363
await _invoke(
6464
{
6565
"clientId": self.client_id,
34.2 KB
Binary file not shown.
62 KB
Binary file not shown.
15.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)