Skip to content

Commit 30f02f8

Browse files
committed
Merge branch 'main' into lucy/readme-update
2 parents d540eba + 34d0198 commit 30f02f8

27 files changed

+369
-73
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "🐛 Bug Report"
2+
description: Something isn't working as expected.
3+
labels: ["bug"]
4+
body:
5+
- type: textarea
6+
id: scenario
7+
attributes:
8+
label: Scenario & Reproduction Steps
9+
description: When do you encounter this problem?
10+
placeholder: "Please share as much context as you can about when you encounter this problem. If possible, sharing the steps to reproduce is immensely helpful."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: actual
15+
attributes:
16+
label: Actual Behavior
17+
description: What is happening?
18+
placeholder: "Please tell us about the problem you're encountering. e.g. an error you're encountering or an unexpected return value"
19+
validations:
20+
required: true
21+
- type: textarea
22+
id: expected
23+
attributes:
24+
label: Expected Behavior
25+
description: What would you have expected happened instead?
26+
placeholder: "Please share what you had expected to happen. How should this have behaved?"
27+
- type: input
28+
id: version
29+
attributes:
30+
label: SDK version
31+
description: "You can find the version you're using by running `npm list @1password/sdk`."
32+
- type: textarea
33+
id: info
34+
attributes:
35+
label: Additional information
36+
description: Any additional information that's relevant to add?
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "↗️ Improvement"
2+
description: Something works but can be made better.
3+
labels: ["improvement"]
4+
body:
5+
- type: textarea
6+
id: current
7+
attributes:
8+
label: Current Behavior
9+
description: How does this currently work?
10+
placeholder: "Please tell us what you're currently doing and what hurdles you're running into with this."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: desired
15+
attributes:
16+
label: Desired Behavior
17+
description: How would you prefer for this to work?
18+
placeholder: "Please share how you'd prefer for this to work."
19+
- type: textarea
20+
id: value
21+
attributes:
22+
label: Benefits & Value
23+
description: What is better about the new behavior? How will this help you?
24+
placeholder: "Please share what benefits you'd like to get out of this improvement. What would you use this for? How does that improve with this change? Why should this change be made?"
25+
- type: textarea
26+
id: info
27+
attributes:
28+
label: Additional information
29+
description: Any additional information that's relevant to add?
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "✨ Feature request"
2+
description: I'd like to request new functionality.
3+
labels: ["feature-request"]
4+
body:
5+
- type: textarea
6+
id: usecase
7+
attributes:
8+
label: Use Case
9+
description: What are you trying to achieve?
10+
placeholder: "Tell us about the problem you're trying to solve. The more context you add, the better we can align a solution with your problem."
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: requirements
15+
attributes:
16+
label: Requirements and desired behavior
17+
description: What should the SDK do?
18+
placeholder: If you already have an idea for what you'd like to be available in the SDK to solve your problem, feel free to share that here. How would you expect this to behave?
19+
- type: textarea
20+
id: info
21+
attributes:
22+
label: Additional information
23+
description: Any additional information that's relevant to add?

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: "💬 Chat with us on Slack"
4+
url: https://developer.1password.com/joinslack
5+
about: Chat with us about SDKs in our Developer Slack workspace.
6+
- name: "❓ General 1Password questions"
7+
url: https://1password.community
8+
about: I have a question about 1Password that's not directly related to SDKs.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check signed commits in PR
2+
on: pull_request_target
3+
4+
jobs:
5+
build:
6+
name: Check signed commits in PR
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check signed commits in PR
13+
uses: 1Password/check-signed-commits-action@main

.github/workflows/validate.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ on:
1212
jobs:
1313

1414
validate:
15-
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
runs-on: ${{ matrix.os }}
1619
steps:
1720
- uses: actions/checkout@v3
1821

@@ -21,17 +24,28 @@ jobs:
2124
with:
2225
python-version: '3.x'
2326

24-
- name: Test with pytest
27+
- name: Integration Test
2528
env:
2629
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
2730
run: |
2831
pip install pytest &&
2932
pip install pytest-asyncio &&
3033
pip install pydantic &&
31-
python -m pytest src/onepassword/*.py
34+
python -m pytest src/onepassword/test_client.py
35+
36+
lint:
37+
name: Lint
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v3
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: '3.x'
3246

3347
- name: Lint with Ruff
3448
run: |
3549
pip install ruff
36-
ruff --output-format=github --exclude=src/onepassword/lib/ .
50+
ruff check --output-format=github --exclude=src/onepassword/lib/,example/ .
3751
continue-on-error: true

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
release:
2+
src/release/scripts/release.sh
3+
4+
prep-release:
5+
src/release/scripts/prep-release.sh
6+
7+

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@
1616

1717
The 1Password Python SDK offers programmatic access to your secrets in 1Password with Python. During the beta, you can create, retrieve, update, and delete items and resolve secret references.
1818

19-
1Password SDKs support authentication with [1Password Service Accounts](https://developer.1password.com/docs/service-accounts/get-started/).
19+
## Requirements
2020

21+
The 1Password Python SDK requires:
22+
23+
- `libssl` 3
24+
- `glibc` 2.32 or later
25+
26+
If you're running a Linux distribution that still uses `libssl` version 1.1.1, such as Debian 11 or Ubuntu 20.04, you'll need to update to a later version of Linux or install the required dependencies.
2127

2228
## ❗ Limitations
2329

@@ -49,7 +55,7 @@ To use the 1Password Python SDK in your project:
4955
3. Install the 1Password Python SDK in your project:
5056

5157
```bash
52-
pip install git+ssh://[email protected]/1Password/[email protected].5
58+
pip install git+ssh://[email protected]/1Password/[email protected].9
5359
```
5460

5561
4. Use the Python SDK in your project:
@@ -63,7 +69,7 @@ async def main():
6369
# Gets your service account token from the OP_SERVICE_ACCOUNT_TOKEN environment variable.
6470
token = os.getenv("OP_SERVICE_ACCOUNT_TOKEN")
6571

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

6975
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
@@ -77,12 +83,8 @@ if __name__ == '__main__':
7783

7884
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.
7985

80-
Inside `Client.authenticate(...)`, set `integration_name` to the name of your application and `integration_version` to the version of your application.
81-
82-
8386
## 📖 Learn more
8487

8588
- [Load secrets with 1Password SDKs](https://developer.1password.com/docs/sdks/load-secrets)
8689
- [Manage items with 1Password SDKs](https://developer.1password.com/docs/sdks/manage-items)
8790
- [1Password SDK concepts](https://developer.1password.com/docs/sdks/concepts)
88-

example/example.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import asyncio
22
import os
3-
from onepassword.client import Client
4-
from onepassword.types import Item, ItemField, ItemSection
5-
3+
from onepassword import *
64

75
async def main():
86
# Gets your service account token from the OP_SERVICE_ACCOUNT_TOKEN environment variable.
@@ -11,6 +9,7 @@ async def main():
119
# Connects to 1Password.
1210
client = await Client.authenticate(
1311
auth=token,
12+
# Set the following to your own integration name and version.
1413
integration_name="My 1Password Integration",
1514
integration_version="v1.0.0",
1615
)
@@ -24,7 +23,7 @@ async def main():
2423
id="",
2524
title="MyName",
2625
category="Login",
27-
vault_id="vault_id",
26+
vault_id="q73bqltug6xoegr3wkk2zkenoq",
2827
fields=[
2928
ItemField(
3029
id="username",
@@ -48,7 +47,7 @@ async def main():
4847
print(dict(created_item))
4948

5049
# Retrieve an item from your vault.
51-
item = await client.items.get("vault_id", created_item.id)
50+
item = await client.items.get(created_item.vault_id, created_item.id)
5251

5352
print(dict(item))
5453

@@ -59,7 +58,7 @@ async def main():
5958
print(dict(updated_item))
6059

6160
# Delete a item from your vault.
62-
await client.items.delete("vault_id", updated_item.id)
61+
await client.items.delete(created_item.vault_id, updated_item.id)
6362

6463

6564
if __name__ == "__main__":

setup.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from sysconfig import get_platform
33
import platform
44
import os
5+
from src.release.version import SDK_VERSION
56

67
try:
78
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
@@ -20,21 +21,19 @@ def finalize_options(self):
2021
def get_shared_library_data_to_include():
2122
# Return the correct uniffi C shared library extension for the given platform
2223
include_path = "lib"
23-
if platform.machine().lower() == "x86_64" or platform.machine().lower() == "amd64":
24+
machine_type = platform.machine().lower()
25+
if machine_type in ["x86_64", "amd64"]:
2426
include_path = os.path.join(include_path, "x86_64")
25-
elif (
26-
platform.machine().lower() == "aarch64" or platform.machine().lower() == "arm64"
27-
):
27+
elif machine_type in ["aarch64", "arm64"]:
2828
include_path = os.path.join(include_path, "aarch64")
2929

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-
30+
# Map current platform to the correct shared library file name
31+
platform_to_lib = {
32+
"Darwin": "libop_uniffi_core.dylib",
33+
"Linux": "libop_uniffi_core.so",
34+
"Windows": "op_uniffi_core.dll"
35+
}
36+
c_shared_library_file_name = platform_to_lib.get(platform.system(), "")
3837
c_shared_library_file_name = os.path.join(include_path, c_shared_library_file_name)
3938

4039
uniffi_bindings_file_name = "op_uniffi_core.py"
@@ -45,7 +44,7 @@ def get_shared_library_data_to_include():
4544

4645
setup(
4746
name="onepassword",
48-
version="0.1.0-beta.1",
47+
version=SDK_VERSION,
4948
author="1Password",
5049
description="The 1Password Python SDK offers programmatic read access to your secrets in 1Password in an interface native to Python.",
5150
url="https://github.com/1Password/onepassword-sdk-python",

0 commit comments

Comments
 (0)