Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[build-system]
requires = ["setuptools>=66", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "onepassword-sdk"
dynamic = ["version"]
description = "The 1Password Python SDK offers programmatic read access to your secrets in 1Password in an interface native to Python."
authors = [{ name = "1Password" }]
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"pydantic>=2.5",
]

[project.urls]
Homepage = "https://github.com/1Password/onepassword-sdk-python"

[tool.setuptools.dynamic]
version = {file = "./version.txt"}
30 changes: 2 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from pathlib import Path
from setuptools import Distribution, setup, find_packages
from setuptools import setup, find_packages, Distribution
from sysconfig import get_platform
from version import SDK_VERSION
import platform
import os

Expand All @@ -22,7 +20,7 @@ def finalize_options(self):
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True

def get_shared_library_data_to_include():
# Return the correct uniffi C shared library extension for the given platform
include_path = "lib"
Expand All @@ -49,35 +47,11 @@ def get_shared_library_data_to_include():


setup(
name="onepassword-sdk",
version=SDK_VERSION,
author="1Password",
long_description=(Path(__file__).parent / "README.md").read_text(),
long_description_content_type="text/markdown",
description="The 1Password Python SDK offers programmatic read access to your secrets in 1Password in an interface native to Python.",
url="https://github.com/1Password/onepassword-sdk-python",
packages=find_packages(
where="src",
),
license="MIT",
license_files="LICENSE",
distclass=BinaryDistribution,
package_dir={"": "src"},
python_requires=">=3.9",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
],
cmdclass={"bdist_wheel": bdist_wheel},
package_data={"": get_shared_library_data_to_include()},
install_requires=[
"pydantic>=2.5", # Minimum Pydantic version to run the Python SDK
],
)
11 changes: 5 additions & 6 deletions src/release/scripts/prep-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

# Helper script to prepare a release for the Python SDK.

output_version_file="version.py"
output_version_file="version.txt"
output_build_file="src/onepassword/build_number.py"
version_template_file="src/release/templates/version.tpl.py"
build_number_template_file="src/release/templates/build_number.tpl.py"


# Extracts the current build/version number for comparison and backup
current_version=$(awk -F "['\"]" '/SDK_VERSION =/{print $2}' "$output_version_file")
current_version=$(cat "$output_version_file" 2>/dev/null || echo "")
current_build=$(awk -F "['\"]" '/SDK_BUILD_NUMBER =/{print $2}' "$output_build_file")

# Function to execute upon exit
cleanup() {
echo "Performing cleanup tasks..."
# Revert changes to file if any
sed -e "s/{{ version }}/$current_version/" "$version_template_file" > "$output_version_file"
echo -n "$current_version" > "$output_version_file"
sed -e "s/{{ build }}/$current_build/" "$build_number_template_file" > "$output_build_file"
exit 1
}
Expand Down Expand Up @@ -86,8 +85,8 @@ update_and_validate_version
# Update and validate the build number
update_and_validate_build

# Update version & build number in version.py and build_number.py respectively
sed -e "s/{{ version }}/$version/" "$version_template_file" > "$output_version_file"
# Update version & build number in version.txt and build_number.py respectively
echo -n "$version" > "$output_version_file"
sed -e "s/{{ build }}/$build/" "$build_number_template_file" > "$output_build_file"


Expand Down
2 changes: 1 addition & 1 deletion src/release/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e

# Read the contents of the files into variables
version=$(awk -F "['\"]" '/SDK_VERSION =/{print $2}' "version.py")
version=$(cat "version.txt")
build=$(awk -F "['\"]" '/SDK_BUILD_NUMBER =/{print $2}' "src/onepassword/build_number.py")
release_notes=$(< src/release/RELEASE-NOTES)

Expand Down
1 change: 0 additions & 1 deletion src/release/templates/version.tpl.py

This file was deleted.

1 change: 0 additions & 1 deletion version.py

This file was deleted.

1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.0
Loading