rndc-python 0.1.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.
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 David Groves
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.
22
+
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: rndc-python
3
+ Version: 0.1.0
4
+ Summary: Python client for ISC BIND's RNDC
5
+ Project-URL: Homepage, https://github.com/davidgroves/rndc-python
6
+ Project-URL: Repository, https://github.com/davidgroves/rndc-python
7
+ Project-URL: Issues, https://github.com/davidgroves/rndc-python/issues
8
+ Author-email: David Groves <dave@fibrecat.org>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: bind,dns,named,rndc,tsig
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Internet :: Name Service (DNS)
24
+ Classifier: Topic :: System :: Systems Administration
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.10
27
+ Requires-Dist: click>=8.1.0
28
+ Requires-Dist: dnspython>=2.6.1
29
+ Requires-Dist: python-dotenv>=1.0.1
30
+ Provides-Extra: dev
31
+ Requires-Dist: pre-commit>=4.0.0; extra == 'dev'
32
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
33
+ Requires-Dist: ty>=0.0.3; extra == 'dev'
34
+ Provides-Extra: test
35
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'test'
36
+ Requires-Dist: pytest-mock>=3.14.0; extra == 'test'
37
+ Requires-Dist: pytest>=8.3.0; extra == 'test'
38
+ Requires-Dist: testcontainers>=4.9.0; extra == 'test'
39
+ Description-Content-Type: text/markdown
40
+
41
+ # rndc-python
42
+
43
+ Python client library for talking to ISC BIND's RNDC service.
44
+
45
+ ## Requirements
46
+
47
+ - Python 3.10+
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install rndc-python
53
+ ```
54
+
55
+ Or using uv:
56
+
57
+ ```bash
58
+ uv add rndc-python
59
+ ```
60
+
61
+ ### Command-line Interface
62
+
63
+ The package includes a CLI tool `rndc-python-cli`:
64
+
65
+ ```bash
66
+ # Using CLI options
67
+ rndc-python-cli -s 127.0.0.1 -p 953 -a sha256 -k <base64-secret> status
68
+
69
+ # Using environment variables
70
+ export ZPAPI_RNDC_HOST=127.0.0.1
71
+ export ZPAPI_RNDC_PORT=953
72
+ export ZPAPI_RNDC_ALGORITHM=sha256
73
+ export ZPAPI_RNDC_SECRET=<base64-secret>
74
+ rndc-python-cli status
75
+
76
+ # Mix of both (CLI options override env vars)
77
+ rndc-python-cli --port 954 reload
78
+ ```
79
+
80
+ ## Configuration
81
+
82
+ The client can read its settings from environment variables (or a `.env` file):
83
+
84
+ - `ZPAPI_RNDC_HOST`
85
+ - `ZPAPI_RNDC_PORT`
86
+ - `ZPAPI_RNDC_ALGORITHM` (e.g. `hmac-sha256`)
87
+ - `ZPAPI_RNDC_SECRET`
88
+ - `ZPAPI_RNDC_TIMEOUT`
89
+ - `ZPAPI_RNDC_MAX_RETRIES`
90
+ - `ZPAPI_RNDC_RETRY_DELAY`
91
+
92
+ You can also configure the client directly in Python:
93
+
94
+ ```python
95
+ from rndc_python import RNDCClient, TSIGAlgorithm
96
+
97
+ client = RNDCClient(
98
+ host="127.0.0.1",
99
+ port=953,
100
+ algorithm=TSIGAlgorithm.SHA256,
101
+ secret="your-base64-secret-here",
102
+ timeout=10,
103
+ max_retries=3,
104
+ retry_delay=2,
105
+ )
106
+ ```
107
+
108
+ All parameters are optional if you have configured environment variables or a `.env` file.
109
+
110
+ ## Usage
111
+
112
+ ### Python API
113
+
114
+ ```python
115
+ from rndc_python import RNDCClient
116
+
117
+ with RNDCClient() as rndc_client:
118
+ print(rndc_client.call("status"))
119
+ ```
120
+
121
+ ## Development
122
+
123
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for development setup, building, and testing instructions.
@@ -0,0 +1,83 @@
1
+ # rndc-python
2
+
3
+ Python client library for talking to ISC BIND's RNDC service.
4
+
5
+ ## Requirements
6
+
7
+ - Python 3.10+
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install rndc-python
13
+ ```
14
+
15
+ Or using uv:
16
+
17
+ ```bash
18
+ uv add rndc-python
19
+ ```
20
+
21
+ ### Command-line Interface
22
+
23
+ The package includes a CLI tool `rndc-python-cli`:
24
+
25
+ ```bash
26
+ # Using CLI options
27
+ rndc-python-cli -s 127.0.0.1 -p 953 -a sha256 -k <base64-secret> status
28
+
29
+ # Using environment variables
30
+ export ZPAPI_RNDC_HOST=127.0.0.1
31
+ export ZPAPI_RNDC_PORT=953
32
+ export ZPAPI_RNDC_ALGORITHM=sha256
33
+ export ZPAPI_RNDC_SECRET=<base64-secret>
34
+ rndc-python-cli status
35
+
36
+ # Mix of both (CLI options override env vars)
37
+ rndc-python-cli --port 954 reload
38
+ ```
39
+
40
+ ## Configuration
41
+
42
+ The client can read its settings from environment variables (or a `.env` file):
43
+
44
+ - `ZPAPI_RNDC_HOST`
45
+ - `ZPAPI_RNDC_PORT`
46
+ - `ZPAPI_RNDC_ALGORITHM` (e.g. `hmac-sha256`)
47
+ - `ZPAPI_RNDC_SECRET`
48
+ - `ZPAPI_RNDC_TIMEOUT`
49
+ - `ZPAPI_RNDC_MAX_RETRIES`
50
+ - `ZPAPI_RNDC_RETRY_DELAY`
51
+
52
+ You can also configure the client directly in Python:
53
+
54
+ ```python
55
+ from rndc_python import RNDCClient, TSIGAlgorithm
56
+
57
+ client = RNDCClient(
58
+ host="127.0.0.1",
59
+ port=953,
60
+ algorithm=TSIGAlgorithm.SHA256,
61
+ secret="your-base64-secret-here",
62
+ timeout=10,
63
+ max_retries=3,
64
+ retry_delay=2,
65
+ )
66
+ ```
67
+
68
+ All parameters are optional if you have configured environment variables or a `.env` file.
69
+
70
+ ## Usage
71
+
72
+ ### Python API
73
+
74
+ ```python
75
+ from rndc_python import RNDCClient
76
+
77
+ with RNDCClient() as rndc_client:
78
+ print(rndc_client.call("status"))
79
+ ```
80
+
81
+ ## Development
82
+
83
+ See [DEVELOPMENT.md](DEVELOPMENT.md) for development setup, building, and testing instructions.
@@ -0,0 +1,123 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "rndc-python"
7
+ version = "0.1.0"
8
+ description = "Python client for ISC BIND's RNDC"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "David Groves", email = "dave@fibrecat.org" }]
13
+ keywords = ["dns", "bind", "rndc", "tsig", "named"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "Intended Audience :: System Administrators",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Internet :: Name Service (DNS)",
27
+ "Topic :: System :: Systems Administration",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = [
31
+ "click>=8.1.0",
32
+ "dnspython>=2.6.1",
33
+ "python-dotenv>=1.0.1",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ test = [
38
+ "pytest>=8.3.0",
39
+ "pytest-cov>=6.0.0",
40
+ "pytest-mock>=3.14.0",
41
+ "testcontainers>=4.9.0",
42
+ ]
43
+ dev = [
44
+ "pre-commit>=4.0.0",
45
+ "ruff>=0.8.0",
46
+ "ty>=0.0.3",
47
+ ]
48
+
49
+ [project.scripts]
50
+ rndc-python-cli = "rndc_python.cli:main"
51
+
52
+ [project.urls]
53
+ Homepage = "https://github.com/davidgroves/rndc-python"
54
+ Repository = "https://github.com/davidgroves/rndc-python"
55
+ Issues = "https://github.com/davidgroves/rndc-python/issues"
56
+
57
+ [tool.hatch.build.targets.wheel]
58
+ packages = ["src/rndc_python"]
59
+
60
+ [tool.hatch.build.targets.sdist]
61
+ include = [
62
+ "src/rndc_python",
63
+ "README.md",
64
+ "LICENSE",
65
+ "pyproject.toml",
66
+ ]
67
+
68
+ [tool.uv]
69
+ package = true
70
+
71
+ [tool.pytest.ini_options]
72
+ markers = [
73
+ "integration: marks tests as integration tests (require Docker)",
74
+ ]
75
+ filterwarnings = [
76
+ "ignore::DeprecationWarning:testcontainers.core.waiting_utils",
77
+ ]
78
+ addopts = "--cov=rndc_python --cov-report=term-missing"
79
+
80
+ [tool.coverage.run]
81
+ source = ["src/rndc_python"]
82
+ branch = true
83
+
84
+ [tool.coverage.report]
85
+ exclude_lines = [
86
+ "pragma: no cover",
87
+ "if __name__ == .__main__.:",
88
+ "raise NotImplementedError",
89
+ ]
90
+ show_missing = true
91
+
92
+ [tool.ruff]
93
+ target-version = "py310"
94
+ line-length = 100
95
+ src = ["src", "tests"]
96
+
97
+ [tool.ruff.lint]
98
+ select = [
99
+ "E", # pycodestyle errors
100
+ "W", # pycodestyle warnings
101
+ "F", # Pyflakes
102
+ "I", # isort
103
+ "B", # flake8-bugbear
104
+ "C4", # flake8-comprehensions
105
+ "UP", # pyupgrade
106
+ "SIM", # flake8-simplify
107
+ ]
108
+ ignore = [
109
+ "E501", # line too long (handled by formatter)
110
+ "SIM108", # ternary operator suggestion (less readable for long expressions)
111
+ ]
112
+
113
+ [tool.ruff.format]
114
+ quote-style = "double"
115
+
116
+ [tool.ty.environment]
117
+ python-version = "3.10"
118
+
119
+ [dependency-groups]
120
+ dev = [
121
+ "ruff>=0.14.9",
122
+ "ty>=0.0.3",
123
+ ]
@@ -0,0 +1,36 @@
1
+ """
2
+ rndc-python - A Python client library for ISC BIND's RNDC
3
+
4
+ This library provides a Python interface to ISC BIND's Remote Name Daemon Control (RNDC).
5
+ """
6
+
7
+ __version__ = "0.1.0"
8
+ __author__ = "David Groves"
9
+ __email__ = "dave@fibrecat.org"
10
+
11
+ # Import main classes and enums
12
+
13
+ from .enums import RNDCDataType, TSIGAlgorithm
14
+ from .exceptions import (
15
+ RNDCAuthenticationError,
16
+ RNDCConnectionError,
17
+ RNDCError,
18
+ RNDCZoneAlreadyExistsError,
19
+ RNDCZoneNotFoundError,
20
+ )
21
+ from .rndc_client import RNDCClient
22
+ from .rndc_config import RNDCConfig, rndc_config
23
+
24
+ __all__ = [
25
+ "__version__",
26
+ "RNDCClient",
27
+ "TSIGAlgorithm",
28
+ "RNDCDataType",
29
+ "RNDCError",
30
+ "RNDCAuthenticationError",
31
+ "RNDCConnectionError",
32
+ "RNDCZoneNotFoundError",
33
+ "RNDCZoneAlreadyExistsError",
34
+ "RNDCConfig",
35
+ "rndc_config",
36
+ ]