From ff596d721a840a8da7de275b7286052ab49bbb8e Mon Sep 17 00:00:00 2001 From: Thomas BAUDIER Date: Mon, 18 May 2026 17:33:49 +0200 Subject: [PATCH] Create the folder jdev2026_python_wheel_thomas_baudier containing the code to create the wheel Add .github folder containg the automatization of the creation of the wheel --- .github/workflows/create_wheel.yml | 60 ++++++++++++++++++ MANIFEST.in | 3 + .../__init__.py | 0 .../data/__init__.py | 0 .../data/primes.npz | Bin .../decrypt_rsa.py | 5 +- .../helpers.py | 0 pyproject.toml | 23 +++++++ 8 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create_wheel.yml create mode 100644 MANIFEST.in create mode 100644 jdev2026_python_wheel_thomas_baudier/__init__.py create mode 100644 jdev2026_python_wheel_thomas_baudier/data/__init__.py rename primes.npz => jdev2026_python_wheel_thomas_baudier/data/primes.npz (100%) rename decrypt_rsa.py => jdev2026_python_wheel_thomas_baudier/decrypt_rsa.py (86%) rename helpers.py => jdev2026_python_wheel_thomas_baudier/helpers.py (100%) create mode 100644 pyproject.toml diff --git a/.github/workflows/create_wheel.yml b/.github/workflows/create_wheel.yml new file mode 100644 index 0000000..ae022f9 --- /dev/null +++ b/.github/workflows/create_wheel.yml @@ -0,0 +1,60 @@ + +name: Publish package + +on: + push: + branches: [ master, github_actions ] + tags: + - '*' + pull_request: + branches: + - '*' + + +jobs: + build-wheel: + runs-on: ubuntu-latest + + steps: + - name: Clone github repository + uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.14" + + - run: pip install build + - run: python -m build + + - name: Upload wheels to GH artifacts + uses: actions/upload-artifact@v7 + with: + name: wheel + path: dist/ + + upload-wheel: + runs-on: ubuntu-latest + needs: [build-wheel] + + steps: + - name: Clone github repository + uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.14" + + - uses: actions/download-artifact@v8 + with: + pattern: wheel* + path: dist/ + + - name: Publish to test PyPI + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + packages-dir: dist/ + skip-existing: true + repository-url: https://test.pypi.org/legacy/ diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..0e4d1b1 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE +include README.md +include jdev2026_python_wheel_thomas_baudier/data/*.npz diff --git a/jdev2026_python_wheel_thomas_baudier/__init__.py b/jdev2026_python_wheel_thomas_baudier/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jdev2026_python_wheel_thomas_baudier/data/__init__.py b/jdev2026_python_wheel_thomas_baudier/data/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/primes.npz b/jdev2026_python_wheel_thomas_baudier/data/primes.npz similarity index 100% rename from primes.npz rename to jdev2026_python_wheel_thomas_baudier/data/primes.npz diff --git a/decrypt_rsa.py b/jdev2026_python_wheel_thomas_baudier/decrypt_rsa.py similarity index 86% rename from decrypt_rsa.py rename to jdev2026_python_wheel_thomas_baudier/decrypt_rsa.py index 0b9a3d3..f2a938a 100644 --- a/decrypt_rsa.py +++ b/jdev2026_python_wheel_thomas_baudier/decrypt_rsa.py @@ -1,3 +1,5 @@ +from importlib.resources import files + import numpy as np from .helpers import ( @@ -31,7 +33,8 @@ def run_decrypt_rsa(): show_text_gui(str(c), title="Encrypted message", label="Encrypted message:") # Load the list of primes and break RSA to find d - primes = np.load("primes.npz").tolist() + data_path = files("jdev2026_python_wheel_thomas_baudier.data") / "primes.npz" + primes = np.load(data_path).tolist() d = break_rsa_with_primes(n, e, primes) # Decrypting the message diff --git a/helpers.py b/jdev2026_python_wheel_thomas_baudier/helpers.py similarity index 100% rename from helpers.py rename to jdev2026_python_wheel_thomas_baudier/helpers.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5c84e21 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ + +[project] +name = "jdev2026-python-wheel-thomas-baudier" +version = "0.1.0" +description = "Demo package" +authors = [{name="Thomas"}] +readme = "README.md" +requires-python = ">=3.10" + +dependencies = [ + "numpy", +] + +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + + +[tool.setuptools.package-data] +"jdev2026_python_wheel_thomas_baudier" = ["data/*.npz"] + +[project.scripts] +decrypt-tool = "jdev2026_python_wheel_thomas_baudier.decrypt_rsa:main"