Skip to content

Commit fe1a257

Browse files
author
Julian Vanden Broeck
committed
Add python packaging
1 parent c399caa commit fe1a257

File tree

5 files changed

+54
-7
lines changed

5 files changed

+54
-7
lines changed

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ RUN apk add --no-cache python3 python3-dev py3-pip gcc jq \
66

77
RUN python3 -m venv --upgrade-deps /opt/venv
88

9-
COPY requirements.txt /opt
10-
COPY ansible_collection_helper.py /opt/
11-
COPY templates /opt/templates/
12-
13-
RUN /opt/venv/bin/pip install -r /opt/requirements.txt
9+
COPY . /usr/local/src/ansible_collection_helper
10+
RUN /opt/venv/bin/pip install --no-cache-dir /usr/local/src/ansible_collection_helper &&\
11+
rm -rf /usr/local/src/ansible_collection_helper

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-FileCopyrightText: 2024 Dalibo
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
[build-system]
5+
requires = ["setuptools >= 61.0", "setuptools-scm>=8"]
6+
build-backend = "setuptools.build_meta"
7+
8+
[project]
9+
name = "ansible_collection_helper"
10+
description = "Helper to manage Ansible collection"
11+
readme = "README.md"
12+
requires-python = ">=3.11, <4"
13+
license = { text = "GPLv3" }
14+
authors = [{ name = "Dalibo SCOP", email = "contact@dalibo.com" }]
15+
keywords = [
16+
"ansible",
17+
"command-line",
18+
]
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Environment :: Console",
22+
"Intended Audience :: Developers",
23+
"Intended Audience :: System Administrators",
24+
"Topic :: System :: Systems Administration",
25+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3 :: Only",
29+
]
30+
dynamic = ["version", "dependencies"]
31+
32+
[tool.setuptools.dynamic]
33+
dependencies = {file = ["requirements.txt"]}
34+
35+
[project.urls]
36+
Source = "https://github.com/dalibo/docker-dind-molecule/"
37+
Tracker = "https://github.com/dalibo/docker-dind-molecule/"
38+
39+
40+
[project.scripts]
41+
ansible_collection_helper = "ansible_collection_helper:helper.main"
42+
43+
[tool.setuptools_scm]

src/ansible_collection_helper/__init__.py

Whitespace-only changes.

ansible_collection_helper.py renamed to src/ansible_collection_helper/helper.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@
99

1010
import yaml
1111
from ansible.cli.doc import DocCLI
12-
from jinja2 import Environment, FileSystemLoader
12+
from jinja2 import Environment, PackageLoader
1313

14-
env = Environment(loader=FileSystemLoader((Path(__file__).parent / "templates")))
14+
from . import __name__ as pkgname
15+
16+
env = Environment(
17+
loader=PackageLoader(package_name=pkgname, package_path="templates"),
18+
trim_blocks=True,
19+
lstrip_blocks=True,
20+
)
1521
template = env.get_template("readme.jinja2")
1622

1723

0 commit comments

Comments
 (0)