simple_aws_ssm_parameter_store 0.3.0__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.
- simple_aws_ssm_parameter_store-0.3.0/AUTHORS.rst +15 -0
- simple_aws_ssm_parameter_store-0.3.0/LICENSE.txt +21 -0
- simple_aws_ssm_parameter_store-0.3.0/PKG-INFO +238 -0
- simple_aws_ssm_parameter_store-0.3.0/README.rst +184 -0
- simple_aws_ssm_parameter_store-0.3.0/pyproject.toml +128 -0
- simple_aws_ssm_parameter_store-0.3.0/setup.cfg +4 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/__init__.py +1 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/api.py +16 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/client.py +590 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/constants.py +44 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/model.py +210 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/paths.py +60 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/utils.py +30 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/vendor/__init__.py +2 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store/vendor/pytest_cov_helper.py +148 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store.egg-info/PKG-INFO +238 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store.egg-info/SOURCES.txt +23 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store.egg-info/dependency_links.txt +1 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store.egg-info/requires.txt +28 -0
- simple_aws_ssm_parameter_store-0.3.0/simple_aws_ssm_parameter_store.egg-info/top_level.txt +1 -0
- simple_aws_ssm_parameter_store-0.3.0/tests/test_api.py +31 -0
- simple_aws_ssm_parameter_store-0.3.0/tests/test_client.py +542 -0
- simple_aws_ssm_parameter_store-0.3.0/tests/test_constants.py +30 -0
- simple_aws_ssm_parameter_store-0.3.0/tests/test_model.py +53 -0
- simple_aws_ssm_parameter_store-0.3.0/tests/test_utils.py +26 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.. _about_author:
|
|
2
|
+
|
|
3
|
+
About the Author
|
|
4
|
+
------------------------------------------------------------------------------
|
|
5
|
+
::
|
|
6
|
+
|
|
7
|
+
(\ (\
|
|
8
|
+
( -.-)o
|
|
9
|
+
o_(")(")
|
|
10
|
+
|
|
11
|
+
**Sanhe Hu** is a seasoned software engineer with a deep passion for Python development since 2010. As an author and maintainer of `150+ open-source Python projects <https://pypi.org/user/machugwu/>`_, with over `15 million monthly downloads <https://github.com/MacHu-GWU>`_, I bring a wealth of experience to the table. As a Senior Solution Architect and Subject Matter Expert in AI, Data, Amazon Web Services, Cloud Engineering, DevOps, I thrive on helping clients with platform design, enterprise architecture, and strategic roadmaps.
|
|
12
|
+
|
|
13
|
+
Talk is cheap, show me the code:
|
|
14
|
+
|
|
15
|
+
- My Github: https://github.com/MacHu-GWU
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sanhe Hu <husanhe@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simple_aws_ssm_parameter_store
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A Pythonic wrapper library for AWS SSM Parameter Store with enhanced error handling, existence testing, idempotent operations, and comprehensive tag management.
|
|
5
|
+
Author-email: Sanhe Hu <husanhe@gmail.com>
|
|
6
|
+
Maintainer-email: Sanhe Hu <husanhe@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
9
|
+
Project-URL: Documentation, https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/
|
|
10
|
+
Project-URL: Repository, https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
11
|
+
Project-URL: Issues, https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/blob/main/release-history.rst
|
|
13
|
+
Project-URL: Download, https://pypi.org/pypi/simple-aws-ssm-parameter-store#files
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: MacOS
|
|
19
|
+
Classifier: Operating System :: Unix
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Requires-Python: <4.0,>=3.11
|
|
26
|
+
Description-Content-Type: text/x-rst
|
|
27
|
+
License-File: LICENSE.txt
|
|
28
|
+
License-File: AUTHORS.rst
|
|
29
|
+
Requires-Dist: boto3<2.0.0,>=1.35.99
|
|
30
|
+
Requires-Dist: func-args<2.0.0,>=1.0.2
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: rich<15.0.0,>=14.3.4; extra == "dev"
|
|
33
|
+
Requires-Dist: boto3-stubs[ssm]<2.0.0,>=1.35.99; extra == "dev"
|
|
34
|
+
Provides-Extra: test
|
|
35
|
+
Requires-Dist: pytest<10.0.0,>=9.1.1; extra == "test"
|
|
36
|
+
Requires-Dist: pytest-cov<8.0.0,>=7.1.0; extra == "test"
|
|
37
|
+
Requires-Dist: moto<6.0.0,>=5.0.0; extra == "test"
|
|
38
|
+
Provides-Extra: doc
|
|
39
|
+
Requires-Dist: Sphinx<9.0.0,>=8.2.3; extra == "doc"
|
|
40
|
+
Requires-Dist: sphinx-copybutton<1.0.0,>=0.5.2; extra == "doc"
|
|
41
|
+
Requires-Dist: sphinx-design<1.0.0,>=0.7.0; extra == "doc"
|
|
42
|
+
Requires-Dist: sphinx-jinja<3.0.0,>=2.0.2; extra == "doc"
|
|
43
|
+
Requires-Dist: furo==2025.12.19; extra == "doc"
|
|
44
|
+
Requires-Dist: pygments<3.0.0,>=2.18.0; extra == "doc"
|
|
45
|
+
Requires-Dist: ipython<8.19.0,>=8.18.1; extra == "doc"
|
|
46
|
+
Requires-Dist: ipykernel<8.0.0,>=7.3.0; extra == "doc"
|
|
47
|
+
Requires-Dist: nbsphinx<1.0.0,>=0.9.8; extra == "doc"
|
|
48
|
+
Requires-Dist: rstobj<3.0.0,>=2.0.0; extra == "doc"
|
|
49
|
+
Requires-Dist: docfly<4.0.0,>=3.0.3; extra == "doc"
|
|
50
|
+
Provides-Extra: mise
|
|
51
|
+
Requires-Dist: PyGithub<3.0.0,>=2.8.0; extra == "mise"
|
|
52
|
+
Requires-Dist: httpx2<3.0.0,>=2.13.1; extra == "mise"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
.. image:: https://readthedocs.org/projects/simple-aws-ssm-parameter-store/badge/?version=latest
|
|
57
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/
|
|
58
|
+
:alt: Documentation Status
|
|
59
|
+
|
|
60
|
+
.. image:: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/actions/workflows/main.yml/badge.svg
|
|
61
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/actions?query=workflow:CI
|
|
62
|
+
|
|
63
|
+
.. image:: https://codecov.io/gh/MacHu-GWU/simple_aws_ssm_parameter_store-project/branch/main/graph/badge.svg
|
|
64
|
+
:target: https://codecov.io/gh/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
65
|
+
|
|
66
|
+
.. image:: https://img.shields.io/pypi/v/simple-aws-ssm-parameter-store.svg
|
|
67
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
68
|
+
|
|
69
|
+
.. image:: https://img.shields.io/pypi/l/simple-aws-ssm-parameter-store.svg
|
|
70
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
71
|
+
|
|
72
|
+
.. image:: https://img.shields.io/pypi/pyversions/simple-aws-ssm-parameter-store.svg
|
|
73
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
74
|
+
|
|
75
|
+
.. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
|
|
76
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/blob/main/release-history.rst
|
|
77
|
+
|
|
78
|
+
.. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
|
|
79
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
80
|
+
|
|
81
|
+
------
|
|
82
|
+
|
|
83
|
+
.. image:: https://img.shields.io/badge/Link-API-blue.svg
|
|
84
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/py-modindex.html
|
|
85
|
+
|
|
86
|
+
.. image:: https://img.shields.io/badge/Link-Install-blue.svg
|
|
87
|
+
:target: `install`_
|
|
88
|
+
|
|
89
|
+
.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
|
|
90
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
91
|
+
|
|
92
|
+
.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
|
|
93
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues
|
|
94
|
+
|
|
95
|
+
.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
|
|
96
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues
|
|
97
|
+
|
|
98
|
+
.. image:: https://img.shields.io/badge/Link-Download-blue.svg
|
|
99
|
+
:target: https://pypi.org/pypi/simple-aws-ssm-parameter-store#files
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Welcome to ``simple_aws_ssm_parameter_store`` Documentation
|
|
103
|
+
==============================================================================
|
|
104
|
+
.. image:: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/_static/simple_aws_ssm_parameter_store-logo.png
|
|
105
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/
|
|
106
|
+
|
|
107
|
+
``simple_aws_ssm_parameter_store`` is a small, Pythonic layer over the boto3 SSM client for `AWS Systems Manager Parameter Store <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html>`_. It does not replace boto3: every function takes your own ``ssm_client`` and smooths over the parts of the raw API that are awkward to use.
|
|
108
|
+
|
|
109
|
+
What it gives you over the raw client:
|
|
110
|
+
|
|
111
|
+
- **Existence check without exceptions:** ``get_parameter`` returns ``None`` instead of raising ``ParameterNotFound``.
|
|
112
|
+
- **Idempotent delete:** ``delete_parameter`` returns ``True`` or ``False`` and is safe to call twice.
|
|
113
|
+
- **Writes only on change:** ``put_parameter_if_changed`` skips the write when the parameter already matches, so re-running a script does not use up the 100 versions SSM keeps per parameter.
|
|
114
|
+
- **Tags as a dict:** get, add, replace, or remove tags with plain ``dict[str, str]`` instead of ``[{"Key": ..., "Value": ...}]`` lists.
|
|
115
|
+
- **A typed result:** a ``Parameter`` object with properties such as ``value``, ``version``, ``arn``, and ``aws_account_id``.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
Quick Tour
|
|
119
|
+
------------------------------------------------------------------------------
|
|
120
|
+
Every public name is imported from ``simple_aws_ssm_parameter_store.api``:
|
|
121
|
+
|
|
122
|
+
.. code-block:: python
|
|
123
|
+
|
|
124
|
+
import boto3
|
|
125
|
+
from simple_aws_ssm_parameter_store.api import ParameterType
|
|
126
|
+
from simple_aws_ssm_parameter_store.api import get_parameter
|
|
127
|
+
from simple_aws_ssm_parameter_store.api import put_parameter_if_changed
|
|
128
|
+
from simple_aws_ssm_parameter_store.api import delete_parameter
|
|
129
|
+
|
|
130
|
+
ssm_client = boto3.client("ssm")
|
|
131
|
+
|
|
132
|
+
**Read a parameter, or learn that it does not exist**
|
|
133
|
+
|
|
134
|
+
.. code-block:: python
|
|
135
|
+
|
|
136
|
+
param = get_parameter(ssm_client, "/app/database/password", with_decryption=True)
|
|
137
|
+
if param is None:
|
|
138
|
+
print("not found")
|
|
139
|
+
else:
|
|
140
|
+
print(param.value, param.version, param.is_secure_string_type)
|
|
141
|
+
|
|
142
|
+
**Write only when the value changed**
|
|
143
|
+
|
|
144
|
+
.. code-block:: python
|
|
145
|
+
|
|
146
|
+
before, after = put_parameter_if_changed(
|
|
147
|
+
ssm_client=ssm_client,
|
|
148
|
+
name="/app/database/host",
|
|
149
|
+
value="prod-db.example.com",
|
|
150
|
+
type=ParameterType.STRING,
|
|
151
|
+
tags={"Team": "platform"}, # the full tag set, synced on every call
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
The result tells you what happened:
|
|
155
|
+
|
|
156
|
+
========================== =========================================
|
|
157
|
+
``(before, after)`` Meaning
|
|
158
|
+
========================== =========================================
|
|
159
|
+
``(None, Parameter)`` Created, ``after.version == 1``
|
|
160
|
+
``(Parameter, None)`` Already matched, nothing written
|
|
161
|
+
``(Parameter, Parameter)`` Changed, from ``before.version`` to ``after.version``
|
|
162
|
+
========================== =========================================
|
|
163
|
+
|
|
164
|
+
Every argument you pass is compared, not only the value, and a ``SecureString`` is compared by its decrypted value. Running the same call again writes nothing.
|
|
165
|
+
|
|
166
|
+
**Delete, whether or not it exists**
|
|
167
|
+
|
|
168
|
+
.. code-block:: python
|
|
169
|
+
|
|
170
|
+
delete_parameter(ssm_client, "/app/temp/config") # True: it was deleted
|
|
171
|
+
delete_parameter(ssm_client, "/app/temp/config") # False: it was already gone
|
|
172
|
+
|
|
173
|
+
**Manage tags as a dict**
|
|
174
|
+
|
|
175
|
+
.. code-block:: python
|
|
176
|
+
|
|
177
|
+
from simple_aws_ssm_parameter_store.api import get_parameter_tags
|
|
178
|
+
from simple_aws_ssm_parameter_store.api import update_parameter_tags
|
|
179
|
+
from simple_aws_ssm_parameter_store.api import put_parameter_tags
|
|
180
|
+
from simple_aws_ssm_parameter_store.api import remove_parameter_tags
|
|
181
|
+
|
|
182
|
+
name = "/app/config"
|
|
183
|
+
|
|
184
|
+
update_parameter_tags(ssm_client, name, {"Env": "prod", "Team": "platform"})
|
|
185
|
+
# tags are now {"Env": "prod", "Team": "platform"}
|
|
186
|
+
|
|
187
|
+
put_parameter_tags(ssm_client, name, {"Env": "prod", "Owner": "alice"})
|
|
188
|
+
# tags are now {"Env": "prod", "Owner": "alice"}
|
|
189
|
+
|
|
190
|
+
remove_parameter_tags(ssm_client, name, ["Owner"])
|
|
191
|
+
# tags are now {"Env": "prod"}
|
|
192
|
+
|
|
193
|
+
put_parameter_tags(ssm_client, name, {})
|
|
194
|
+
# tags are now {}
|
|
195
|
+
|
|
196
|
+
get_parameter_tags(ssm_client, name) # read them back as a dict
|
|
197
|
+
|
|
198
|
+
- ``update_parameter_tags`` adds or overwrites the given keys and keeps the others.
|
|
199
|
+
- ``put_parameter_tags`` makes the given dict the full tag set; ``{}`` removes every tag.
|
|
200
|
+
- ``remove_parameter_tags`` removes only the given keys.
|
|
201
|
+
|
|
202
|
+
Learn more:
|
|
203
|
+
|
|
204
|
+
- `Getting Started <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/01-Getting-Started/index.html>`_: every function, run step by step with real output.
|
|
205
|
+
- `Design Notes <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/02-Design-Notes/index.html>`_: why the functions behave this way, and the cases to watch for.
|
|
206
|
+
- `API reference <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/py-modindex.html>`_: every argument.
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
.. _install:
|
|
210
|
+
|
|
211
|
+
Install
|
|
212
|
+
------------------------------------------------------------------------------
|
|
213
|
+
|
|
214
|
+
``simple_aws_ssm_parameter_store`` is released on PyPI and needs Python 3.11 or newer:
|
|
215
|
+
|
|
216
|
+
.. code-block:: console
|
|
217
|
+
|
|
218
|
+
$ pip install simple-aws-ssm-parameter-store
|
|
219
|
+
|
|
220
|
+
To upgrade to latest version:
|
|
221
|
+
|
|
222
|
+
.. code-block:: console
|
|
223
|
+
|
|
224
|
+
$ pip install --upgrade simple-aws-ssm-parameter-store
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
.. _use-with-ai-coding-agents:
|
|
228
|
+
|
|
229
|
+
Use with AI Coding Agents
|
|
230
|
+
------------------------------------------------------------------------------
|
|
231
|
+
|
|
232
|
+
This repo ships an `Agent Skill <https://code.claude.com/docs/en/skills>`_ that documents the public API of ``simple_aws_ssm_parameter_store``, so an AI coding agent such as Claude Code can use the library without reading its source. It lives in `.claude/skills/pypi-simple_aws_ssm_parameter_store <https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/tree/main/.claude/skills/pypi-simple_aws_ssm_parameter_store>`_. To use it in your project, copy it into your project's ``.claude/skills/`` folder. Run this from your project's root:
|
|
233
|
+
|
|
234
|
+
.. code-block:: console
|
|
235
|
+
|
|
236
|
+
$ git clone --depth 1 https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project.git /tmp/simple_aws_ssm_parameter_store-project
|
|
237
|
+
$ mkdir -p .claude/skills
|
|
238
|
+
$ cp -R /tmp/simple_aws_ssm_parameter_store-project/.claude/skills/pypi-simple_aws_ssm_parameter_store .claude/skills/
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
|
|
2
|
+
.. image:: https://readthedocs.org/projects/simple-aws-ssm-parameter-store/badge/?version=latest
|
|
3
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/
|
|
4
|
+
:alt: Documentation Status
|
|
5
|
+
|
|
6
|
+
.. image:: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/actions/workflows/main.yml/badge.svg
|
|
7
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/actions?query=workflow:CI
|
|
8
|
+
|
|
9
|
+
.. image:: https://codecov.io/gh/MacHu-GWU/simple_aws_ssm_parameter_store-project/branch/main/graph/badge.svg
|
|
10
|
+
:target: https://codecov.io/gh/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
11
|
+
|
|
12
|
+
.. image:: https://img.shields.io/pypi/v/simple-aws-ssm-parameter-store.svg
|
|
13
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
14
|
+
|
|
15
|
+
.. image:: https://img.shields.io/pypi/l/simple-aws-ssm-parameter-store.svg
|
|
16
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
17
|
+
|
|
18
|
+
.. image:: https://img.shields.io/pypi/pyversions/simple-aws-ssm-parameter-store.svg
|
|
19
|
+
:target: https://pypi.python.org/pypi/simple-aws-ssm-parameter-store
|
|
20
|
+
|
|
21
|
+
.. image:: https://img.shields.io/badge/✍️_Release_History!--None.svg?style=social&logo=github
|
|
22
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/blob/main/release-history.rst
|
|
23
|
+
|
|
24
|
+
.. image:: https://img.shields.io/badge/⭐_Star_me_on_GitHub!--None.svg?style=social&logo=github
|
|
25
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
26
|
+
|
|
27
|
+
------
|
|
28
|
+
|
|
29
|
+
.. image:: https://img.shields.io/badge/Link-API-blue.svg
|
|
30
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/py-modindex.html
|
|
31
|
+
|
|
32
|
+
.. image:: https://img.shields.io/badge/Link-Install-blue.svg
|
|
33
|
+
:target: `install`_
|
|
34
|
+
|
|
35
|
+
.. image:: https://img.shields.io/badge/Link-GitHub-blue.svg
|
|
36
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project
|
|
37
|
+
|
|
38
|
+
.. image:: https://img.shields.io/badge/Link-Submit_Issue-blue.svg
|
|
39
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues
|
|
40
|
+
|
|
41
|
+
.. image:: https://img.shields.io/badge/Link-Request_Feature-blue.svg
|
|
42
|
+
:target: https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues
|
|
43
|
+
|
|
44
|
+
.. image:: https://img.shields.io/badge/Link-Download-blue.svg
|
|
45
|
+
:target: https://pypi.org/pypi/simple-aws-ssm-parameter-store#files
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
Welcome to ``simple_aws_ssm_parameter_store`` Documentation
|
|
49
|
+
==============================================================================
|
|
50
|
+
.. image:: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/_static/simple_aws_ssm_parameter_store-logo.png
|
|
51
|
+
:target: https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/
|
|
52
|
+
|
|
53
|
+
``simple_aws_ssm_parameter_store`` is a small, Pythonic layer over the boto3 SSM client for `AWS Systems Manager Parameter Store <https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html>`_. It does not replace boto3: every function takes your own ``ssm_client`` and smooths over the parts of the raw API that are awkward to use.
|
|
54
|
+
|
|
55
|
+
What it gives you over the raw client:
|
|
56
|
+
|
|
57
|
+
- **Existence check without exceptions:** ``get_parameter`` returns ``None`` instead of raising ``ParameterNotFound``.
|
|
58
|
+
- **Idempotent delete:** ``delete_parameter`` returns ``True`` or ``False`` and is safe to call twice.
|
|
59
|
+
- **Writes only on change:** ``put_parameter_if_changed`` skips the write when the parameter already matches, so re-running a script does not use up the 100 versions SSM keeps per parameter.
|
|
60
|
+
- **Tags as a dict:** get, add, replace, or remove tags with plain ``dict[str, str]`` instead of ``[{"Key": ..., "Value": ...}]`` lists.
|
|
61
|
+
- **A typed result:** a ``Parameter`` object with properties such as ``value``, ``version``, ``arn``, and ``aws_account_id``.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
Quick Tour
|
|
65
|
+
------------------------------------------------------------------------------
|
|
66
|
+
Every public name is imported from ``simple_aws_ssm_parameter_store.api``:
|
|
67
|
+
|
|
68
|
+
.. code-block:: python
|
|
69
|
+
|
|
70
|
+
import boto3
|
|
71
|
+
from simple_aws_ssm_parameter_store.api import ParameterType
|
|
72
|
+
from simple_aws_ssm_parameter_store.api import get_parameter
|
|
73
|
+
from simple_aws_ssm_parameter_store.api import put_parameter_if_changed
|
|
74
|
+
from simple_aws_ssm_parameter_store.api import delete_parameter
|
|
75
|
+
|
|
76
|
+
ssm_client = boto3.client("ssm")
|
|
77
|
+
|
|
78
|
+
**Read a parameter, or learn that it does not exist**
|
|
79
|
+
|
|
80
|
+
.. code-block:: python
|
|
81
|
+
|
|
82
|
+
param = get_parameter(ssm_client, "/app/database/password", with_decryption=True)
|
|
83
|
+
if param is None:
|
|
84
|
+
print("not found")
|
|
85
|
+
else:
|
|
86
|
+
print(param.value, param.version, param.is_secure_string_type)
|
|
87
|
+
|
|
88
|
+
**Write only when the value changed**
|
|
89
|
+
|
|
90
|
+
.. code-block:: python
|
|
91
|
+
|
|
92
|
+
before, after = put_parameter_if_changed(
|
|
93
|
+
ssm_client=ssm_client,
|
|
94
|
+
name="/app/database/host",
|
|
95
|
+
value="prod-db.example.com",
|
|
96
|
+
type=ParameterType.STRING,
|
|
97
|
+
tags={"Team": "platform"}, # the full tag set, synced on every call
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
The result tells you what happened:
|
|
101
|
+
|
|
102
|
+
========================== =========================================
|
|
103
|
+
``(before, after)`` Meaning
|
|
104
|
+
========================== =========================================
|
|
105
|
+
``(None, Parameter)`` Created, ``after.version == 1``
|
|
106
|
+
``(Parameter, None)`` Already matched, nothing written
|
|
107
|
+
``(Parameter, Parameter)`` Changed, from ``before.version`` to ``after.version``
|
|
108
|
+
========================== =========================================
|
|
109
|
+
|
|
110
|
+
Every argument you pass is compared, not only the value, and a ``SecureString`` is compared by its decrypted value. Running the same call again writes nothing.
|
|
111
|
+
|
|
112
|
+
**Delete, whether or not it exists**
|
|
113
|
+
|
|
114
|
+
.. code-block:: python
|
|
115
|
+
|
|
116
|
+
delete_parameter(ssm_client, "/app/temp/config") # True: it was deleted
|
|
117
|
+
delete_parameter(ssm_client, "/app/temp/config") # False: it was already gone
|
|
118
|
+
|
|
119
|
+
**Manage tags as a dict**
|
|
120
|
+
|
|
121
|
+
.. code-block:: python
|
|
122
|
+
|
|
123
|
+
from simple_aws_ssm_parameter_store.api import get_parameter_tags
|
|
124
|
+
from simple_aws_ssm_parameter_store.api import update_parameter_tags
|
|
125
|
+
from simple_aws_ssm_parameter_store.api import put_parameter_tags
|
|
126
|
+
from simple_aws_ssm_parameter_store.api import remove_parameter_tags
|
|
127
|
+
|
|
128
|
+
name = "/app/config"
|
|
129
|
+
|
|
130
|
+
update_parameter_tags(ssm_client, name, {"Env": "prod", "Team": "platform"})
|
|
131
|
+
# tags are now {"Env": "prod", "Team": "platform"}
|
|
132
|
+
|
|
133
|
+
put_parameter_tags(ssm_client, name, {"Env": "prod", "Owner": "alice"})
|
|
134
|
+
# tags are now {"Env": "prod", "Owner": "alice"}
|
|
135
|
+
|
|
136
|
+
remove_parameter_tags(ssm_client, name, ["Owner"])
|
|
137
|
+
# tags are now {"Env": "prod"}
|
|
138
|
+
|
|
139
|
+
put_parameter_tags(ssm_client, name, {})
|
|
140
|
+
# tags are now {}
|
|
141
|
+
|
|
142
|
+
get_parameter_tags(ssm_client, name) # read them back as a dict
|
|
143
|
+
|
|
144
|
+
- ``update_parameter_tags`` adds or overwrites the given keys and keeps the others.
|
|
145
|
+
- ``put_parameter_tags`` makes the given dict the full tag set; ``{}`` removes every tag.
|
|
146
|
+
- ``remove_parameter_tags`` removes only the given keys.
|
|
147
|
+
|
|
148
|
+
Learn more:
|
|
149
|
+
|
|
150
|
+
- `Getting Started <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/01-Getting-Started/index.html>`_: every function, run step by step with real output.
|
|
151
|
+
- `Design Notes <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/02-Design-Notes/index.html>`_: why the functions behave this way, and the cases to watch for.
|
|
152
|
+
- `API reference <https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/py-modindex.html>`_: every argument.
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
.. _install:
|
|
156
|
+
|
|
157
|
+
Install
|
|
158
|
+
------------------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
``simple_aws_ssm_parameter_store`` is released on PyPI and needs Python 3.11 or newer:
|
|
161
|
+
|
|
162
|
+
.. code-block:: console
|
|
163
|
+
|
|
164
|
+
$ pip install simple-aws-ssm-parameter-store
|
|
165
|
+
|
|
166
|
+
To upgrade to latest version:
|
|
167
|
+
|
|
168
|
+
.. code-block:: console
|
|
169
|
+
|
|
170
|
+
$ pip install --upgrade simple-aws-ssm-parameter-store
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
.. _use-with-ai-coding-agents:
|
|
174
|
+
|
|
175
|
+
Use with AI Coding Agents
|
|
176
|
+
------------------------------------------------------------------------------
|
|
177
|
+
|
|
178
|
+
This repo ships an `Agent Skill <https://code.claude.com/docs/en/skills>`_ that documents the public API of ``simple_aws_ssm_parameter_store``, so an AI coding agent such as Claude Code can use the library without reading its source. It lives in `.claude/skills/pypi-simple_aws_ssm_parameter_store <https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/tree/main/.claude/skills/pypi-simple_aws_ssm_parameter_store>`_. To use it in your project, copy it into your project's ``.claude/skills/`` folder. Run this from your project's root:
|
|
179
|
+
|
|
180
|
+
.. code-block:: console
|
|
181
|
+
|
|
182
|
+
$ git clone --depth 1 https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project.git /tmp/simple_aws_ssm_parameter_store-project
|
|
183
|
+
$ mkdir -p .claude/skills
|
|
184
|
+
$ cp -R /tmp/simple_aws_ssm_parameter_store-project/.claude/skills/pypi-simple_aws_ssm_parameter_store .claude/skills/
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# [project] table: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
|
|
2
|
+
[project]
|
|
3
|
+
name = "simple_aws_ssm_parameter_store"
|
|
4
|
+
# Bump before each release (https://semver.org/), then ``mise run inst`` to update ``uv.lock``.
|
|
5
|
+
version = "0.3.0"
|
|
6
|
+
description = "A Pythonic wrapper library for AWS SSM Parameter Store with enhanced error handling, existence testing, idempotent operations, and comprehensive tag management."
|
|
7
|
+
# An SPDX license expression (PEP 639); keep ``LICENSE.txt`` in sync.
|
|
8
|
+
# Read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license-and-license-files
|
|
9
|
+
# Valid identifiers: https://spdx.org/licenses/
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE.txt", "AUTHORS.rst"]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Sanhe Hu", email = "husanhe@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "Sanhe Hu", email = "husanhe@gmail.com" },
|
|
17
|
+
]
|
|
18
|
+
keywords = []
|
|
19
|
+
readme = "README.rst"
|
|
20
|
+
requires-python = ">=3.11,<4.0"
|
|
21
|
+
# Read: https://pypi.org/classifiers/
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Natural Language :: English",
|
|
26
|
+
"Operating System :: Microsoft :: Windows",
|
|
27
|
+
"Operating System :: MacOS",
|
|
28
|
+
"Operating System :: Unix",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Programming Language :: Python :: 3.14",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
# --- Dependencies ---
|
|
37
|
+
# Edit these lists, then ``mise run inst`` to update ``uv.lock`` and ``.venv``.
|
|
38
|
+
dependencies = [
|
|
39
|
+
"boto3>=1.35.99,<2.0.0", # AWS SDK for Python
|
|
40
|
+
"func-args>=1.0.2,<2.0.0", # Pythonic API helpers
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
# --- Optional dependencies (extras) ---
|
|
44
|
+
# Read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#dependencies-optional-dependencies
|
|
45
|
+
# Each one must support every Python version in ``requires-python``.
|
|
46
|
+
[project.optional-dependencies]
|
|
47
|
+
|
|
48
|
+
# local development
|
|
49
|
+
dev = [
|
|
50
|
+
"rich>=14.3.4,<15.0.0",
|
|
51
|
+
"boto3-stubs[ssm]>=1.35.99,<2.0.0", # type stubs for the SSM client
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
# tests and coverage
|
|
55
|
+
test = [
|
|
56
|
+
"pytest>=9.1.1,<10.0.0",
|
|
57
|
+
"pytest-cov>=7.1.0,<8.0.0",
|
|
58
|
+
"moto>=5.0.0,<6.0.0", # mock AWS services in unit tests
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
# docs build
|
|
62
|
+
doc = [
|
|
63
|
+
"Sphinx>=8.2.3,<9.0.0", # held below 9 until its autodoc rewrite is verified
|
|
64
|
+
"sphinx-copybutton>=0.5.2,<1.0.0", # copy button on code blocks
|
|
65
|
+
"sphinx-design>=0.7.0,<1.0.0", # cards, tabs, grids
|
|
66
|
+
"sphinx-jinja>=2.0.2,<3.0.0", # jinja in reST
|
|
67
|
+
"furo==2025.12.19", # theme
|
|
68
|
+
"pygments>=2.18.0,<3.0.0", # syntax highlighting
|
|
69
|
+
"ipython>=8.18.1,<8.19.0", # notebook execution
|
|
70
|
+
"ipykernel>=7.3.0,<8.0.0", # notebook kernel
|
|
71
|
+
"nbsphinx>=0.9.8,<1.0.0", # notebooks as doc pages
|
|
72
|
+
"rstobj>=2.0.0,<3.0.0", # reST from Python
|
|
73
|
+
"docfly>=3.0.3,<4.0.0", # toctree and API reference
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
# mise tasks
|
|
77
|
+
mise = [
|
|
78
|
+
"PyGithub>=2.8.0,<3.0.0", # GitHub API client
|
|
79
|
+
"httpx2>=2.13.1,<3.0.0", # Codecov and Read the Docs APIs
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[project.urls]
|
|
83
|
+
Homepage = "https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project"
|
|
84
|
+
Documentation = "https://simple-aws-ssm-parameter-store.readthedocs.io/en/latest/"
|
|
85
|
+
Repository = "https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project"
|
|
86
|
+
Issues = "https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/issues"
|
|
87
|
+
Changelog = "https://github.com/MacHu-GWU/simple_aws_ssm_parameter_store-project/blob/main/release-history.rst"
|
|
88
|
+
Download = "https://pypi.org/pypi/simple-aws-ssm-parameter-store#files"
|
|
89
|
+
|
|
90
|
+
# Read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#creating-executable-scripts
|
|
91
|
+
[project.scripts]
|
|
92
|
+
|
|
93
|
+
[tool.setuptools.packages.find]
|
|
94
|
+
where = ["."]
|
|
95
|
+
include = [
|
|
96
|
+
"simple_aws_ssm_parameter_store*",
|
|
97
|
+
]
|
|
98
|
+
exclude = [
|
|
99
|
+
"simple_aws_ssm_parameter_store.tests",
|
|
100
|
+
"simple_aws_ssm_parameter_store.tests.*",
|
|
101
|
+
"simple_aws_ssm_parameter_store.docs",
|
|
102
|
+
"simple_aws_ssm_parameter_store.docs.*",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
# --- ruff: ``mise run format`` / ``mise run lint`` ---
|
|
106
|
+
[tool.ruff]
|
|
107
|
+
extend-exclude = [
|
|
108
|
+
"simple_aws_ssm_parameter_store/vendor",
|
|
109
|
+
".claude/skills/*/assets", # templates, not valid Python
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint.per-file-ignores]
|
|
113
|
+
# re-export modules
|
|
114
|
+
"**/__init__.py" = ["F401"]
|
|
115
|
+
"**/api.py" = ["F401"]
|
|
116
|
+
|
|
117
|
+
# --- pytest 9+ native table ---
|
|
118
|
+
# Read: https://docs.pytest.org/en/stable/reference/customize.html#pyproject-toml
|
|
119
|
+
[tool.pytest]
|
|
120
|
+
testpaths = ["tests"]
|
|
121
|
+
# strict = true # only with a pinned pytest
|
|
122
|
+
# filterwarnings = ["error"]
|
|
123
|
+
# markers = ["slow: tests that take more than a few seconds"]
|
|
124
|
+
|
|
125
|
+
# --- Build (``mise run build``); setuptools 77+ for PEP 639 ``license`` ---
|
|
126
|
+
[build-system]
|
|
127
|
+
requires = ["setuptools>=77.0"]
|
|
128
|
+
build-backend = "setuptools.build_meta"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
from .constants import ParameterType
|
|
4
|
+
from .constants import ParameterTier
|
|
5
|
+
from .constants import ResourceType
|
|
6
|
+
from .constants import DEFAULT_KMS_KEY
|
|
7
|
+
from .utils import encode_tags
|
|
8
|
+
from .utils import decode_tags
|
|
9
|
+
from .model import Parameter
|
|
10
|
+
from .client import get_parameter
|
|
11
|
+
from .client import put_parameter_if_changed
|
|
12
|
+
from .client import delete_parameter
|
|
13
|
+
from .client import get_parameter_tags
|
|
14
|
+
from .client import remove_parameter_tags
|
|
15
|
+
from .client import update_parameter_tags
|
|
16
|
+
from .client import put_parameter_tags
|