From 75fcd537de30a34fb962071e2f9e387f837b9796 Mon Sep 17 00:00:00 2001 From: Alex Christy Date: Mon, 25 Nov 2024 13:58:31 -0500 Subject: [PATCH 1/2] Move library to src/ dir --- main.py | 2 +- {pyopn => src/pyopn}/__init__.py | 0 {pyopn => src/pyopn}/api.py | 0 {pyopn => src/pyopn}/base_namespace.py | 0 {pyopn => src/pyopn}/client.py | 0 {pyopn => src/pyopn}/constants.py | 0 {pyopn => src/pyopn}/core/dhcpv4.py | 0 {pyopn => src/pyopn}/core/dhcpv4_namespace.py | 0 {pyopn => src/pyopn}/core/kea.py | 0 {pyopn => src/pyopn}/core/kea_namespace.py | 0 {pyopn => src/pyopn}/exceptions.py | 0 {pyopn => src/pyopn}/tests/__init__.py | 0 {pyopn => src/pyopn}/tests/base.py | 0 {pyopn => src/pyopn}/tests/test_client.py | 0 14 files changed, 1 insertion(+), 1 deletion(-) rename {pyopn => src/pyopn}/__init__.py (100%) rename {pyopn => src/pyopn}/api.py (100%) rename {pyopn => src/pyopn}/base_namespace.py (100%) rename {pyopn => src/pyopn}/client.py (100%) rename {pyopn => src/pyopn}/constants.py (100%) rename {pyopn => src/pyopn}/core/dhcpv4.py (100%) rename {pyopn => src/pyopn}/core/dhcpv4_namespace.py (100%) rename {pyopn => src/pyopn}/core/kea.py (100%) rename {pyopn => src/pyopn}/core/kea_namespace.py (100%) rename {pyopn => src/pyopn}/exceptions.py (100%) rename {pyopn => src/pyopn}/tests/__init__.py (100%) rename {pyopn => src/pyopn}/tests/base.py (100%) rename {pyopn => src/pyopn}/tests/test_client.py (100%) diff --git a/main.py b/main.py index 5ddbb51..5d70300 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from pyopn import OPNsenseAPI +from src.pyopn import OPNsenseAPI opn = OPNsenseAPI( "https://192.168.199.1", api_key_file="OPNsense.localdomain_apikey.txt" diff --git a/pyopn/__init__.py b/src/pyopn/__init__.py similarity index 100% rename from pyopn/__init__.py rename to src/pyopn/__init__.py diff --git a/pyopn/api.py b/src/pyopn/api.py similarity index 100% rename from pyopn/api.py rename to src/pyopn/api.py diff --git a/pyopn/base_namespace.py b/src/pyopn/base_namespace.py similarity index 100% rename from pyopn/base_namespace.py rename to src/pyopn/base_namespace.py diff --git a/pyopn/client.py b/src/pyopn/client.py similarity index 100% rename from pyopn/client.py rename to src/pyopn/client.py diff --git a/pyopn/constants.py b/src/pyopn/constants.py similarity index 100% rename from pyopn/constants.py rename to src/pyopn/constants.py diff --git a/pyopn/core/dhcpv4.py b/src/pyopn/core/dhcpv4.py similarity index 100% rename from pyopn/core/dhcpv4.py rename to src/pyopn/core/dhcpv4.py diff --git a/pyopn/core/dhcpv4_namespace.py b/src/pyopn/core/dhcpv4_namespace.py similarity index 100% rename from pyopn/core/dhcpv4_namespace.py rename to src/pyopn/core/dhcpv4_namespace.py diff --git a/pyopn/core/kea.py b/src/pyopn/core/kea.py similarity index 100% rename from pyopn/core/kea.py rename to src/pyopn/core/kea.py diff --git a/pyopn/core/kea_namespace.py b/src/pyopn/core/kea_namespace.py similarity index 100% rename from pyopn/core/kea_namespace.py rename to src/pyopn/core/kea_namespace.py diff --git a/pyopn/exceptions.py b/src/pyopn/exceptions.py similarity index 100% rename from pyopn/exceptions.py rename to src/pyopn/exceptions.py diff --git a/pyopn/tests/__init__.py b/src/pyopn/tests/__init__.py similarity index 100% rename from pyopn/tests/__init__.py rename to src/pyopn/tests/__init__.py diff --git a/pyopn/tests/base.py b/src/pyopn/tests/base.py similarity index 100% rename from pyopn/tests/base.py rename to src/pyopn/tests/base.py diff --git a/pyopn/tests/test_client.py b/src/pyopn/tests/test_client.py similarity index 100% rename from pyopn/tests/test_client.py rename to src/pyopn/tests/test_client.py From bbad66a75a769a5f44ee7866d65ca8c0f47d9464 Mon Sep 17 00:00:00 2001 From: Alex Christy Date: Mon, 25 Nov 2024 15:09:32 -0500 Subject: [PATCH 2/2] Add packaging --- pyproject.toml | 54 ++++++++++++++++++++++++++++++++++++++++++- requirements.txt | 4 ++-- src/pyopn/_version.py | 17 ++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 src/pyopn/_version.py diff --git a/pyproject.toml b/pyproject.toml index 37f028c..9cb8506 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,4 +60,56 @@ indent-style = "space" skip-magic-trailing-comma = false # Like Black, automatically detect the appropriate line ending. -line-ending = "auto" \ No newline at end of file +line-ending = "auto" + +[build-system] +requires = ["hatchling>=1.24.2", "hatch-vcs>=0.3.0"] +build-backend = "hatchling.build" + +[tool.hatch.build] +build-targets = ["sdist", "wheel"] + +[tool.hatch.version] +source = "vcs" +tag-pattern = "^v(?P.+)$" + +[tool.hatch.build.hooks.vcs] +version-file = "src/pyopn/_version.py" + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", +] + +[project] +name = "pyopn" +authors = [ + { name="Alex Christy", email="a.christy@ufl.edu" }, +] +description = " A simple Python wrapper for the OPNsense REST API." +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.10" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Networking", + "Topic :: System :: Systems Administration" +] +dependencies = [ + "pbr>=1.6", + "requests>=2.14.2", + "validators>=0.34", +] +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/alexchristy/PyOPN" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2b03c80..bc6e034 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr>=1.6 # Apache-2.0 -requests>=2.14.2 # Apache-2.0 +pbr>=1.6 +requests>=2.14.2 validators>=0.34 diff --git a/src/pyopn/_version.py b/src/pyopn/_version.py new file mode 100644 index 0000000..0854d9b --- /dev/null +++ b/src/pyopn/_version.py @@ -0,0 +1,17 @@ +# file generated by setuptools_scm +# don't change, don't track in version control +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple, Union + + VERSION_TUPLE = Tuple[Union[int, str], ...] +else: + VERSION_TUPLE = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE + +__version__ = version = "0.1.1.dev1+g75fcd53.d20241125" +__version_tuple__ = version_tuple = (0, 1, 1, "dev1", "g75fcd53.d20241125")