Skip to content

Clean up setup.py - #137

Open
roberthdevries wants to merge 2 commits into
wolfSSL:masterfrom
roberthdevries:cleanup-setup-py
Open

roberthdevries wants to merge 2 commits into
wolfSSL:masterfrom
roberthdevries:cleanup-setup-py

Conversation

@roberthdevries

@roberthdevries roberthdevries commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor
  • remove obsolete merging of LICENSING.rst in description as the include is not there anymore
  • put setuptools configuration in pyproject.toml
  • the setup_requires setting in setup.py is deprecated and is covered by pyproject.toml [build-system] - requires
  • keep *.dll in [tool.setuptools.package-data] so the Windows FIPS DLL that build_ffi.py copies next to the extension stays in the wheel; py.typed and the .pyi stubs are included by setuptools itself
  • packages.find includes only wolfcrypt; wolfcrypt/_ffi holds only stubs, which ship as package data

@dgarske
dgarske self-requested a review July 8, 2026 15:28

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve merge conflicts. Thanks!

@roberthdevries

Copy link
Copy Markdown
Contributor Author

Rebased on master, conflicts are resolved.

Comment thread setup.py Resolved
dgarske
dgarske previously approved these changes Aug 6, 2026

@sebastian-carpenter sebastian-carpenter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem to strip the portion that copies the .dll. The .dll is only copied on FIPS builds and non-FIPS builds will statically link the library.

Before approving I would like to see the Windows workflow in #140 validate the existence of the .dll in the build.

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skoll Code Review

Scan type: reviewOverall recommendation: REQUEST_CHANGES
Findings: 4 total — 1 posted, 3 skipped
1 finding(s) not tied to a diff line (full detail below)

Findings not tied to a diff line

package_data removed with no pyproject.toml replacement - py.typed, .pyi stubs and wolfssl-fips.dll are dropped from…

File: setup.py:56 (removed line) / pyproject.toml:49-50
Function: setup
Severity: High

The PR deletes package_data={"wolfcrypt": ["*.dll", "**/*.pyi", "py.typed"]} from setup.py but adds only [tool.setuptools.packages.find] to pyproject.toml. There is no [tool.setuptools.package-data] (or include-package-data + MANIFEST.in) replacement anywhere in the repo - I grepped the whole tree and the only remaining packaging config is the 2-line packages.find block.

The consequences are concrete, because all three glob patterns match real files that exist in the tree:

  1. wolfcrypt/py.typed (0-byte PEP 561 marker, added by commit fda2869 "Add py.typed file to indicate that this library has typing annotations") will no longer be installed. Every downstream consumer running mypy/pyright/ty against an installed wolfcrypt silently loses all type information - the package reverts to being untyped. This directly undoes fda2869.

  2. wolfcrypt/_ffi/__init__.pyi and wolfcrypt/_ffi/lib.pyi (the hand-written CFFI stubs, 913 B and 23 KB) were matched by **/*.pyi and will no longer ship. Note the new include = [..., "wolfcrypt._ffi"] line does not save them: wolfcrypt/_ffi/ contains no .py files at all, so declaring it as a (PEP 420 namespace) package produces an empty directory, and wheels do not archive empty directories. Without package-data the include entry is a no-op.

  3. wolfcrypt/wolfssl-fips.dll - scripts/build_ffi.py:419-423 copies this DLL into wolfcrypt/ at build time specifically so it lands "alongside the .pyd created by CFFI". *.dll was the pattern that carried it into the wheel. Windows FIPS wheels will now…

Recommendation: Add a [tool.setuptools.package-data] table to pyproject.toml before merging. The two-key form above is clearest now that wolfcrypt._ffi is an explicitly declared package; the single-key equivalent wolfcrypt = ["*.dll", "**/*.pyi", "py.typed"] also works and is a byte-for-byte port of the deleted setup.py value. Verify with uv build --wheel && unzip -l dist/*.whl | grep -E 'py.typed|\.pyi' and confirm all three stub/marker files are present.

Referenced code: setup.py:56 (removed line) / pyproject.toml:49-60 (12 lines)


Skipped findings

  • [Medium] long_description block in setup.py is now dead code - pyproject.toml's [project] readme takes precedence
  • [Medium] packages.find include list uses exact names, so any future wolfcrypt subpackage is silently omitted from the wheel
  • [Medium] No test or CI check verifies that built wheels contain py.typed, the .pyi stubs, or the FIPS DLL

Review generated by Skoll

@dgarske dgarske self-assigned this Nov 2, 2026
roberthdevries and others added 2 commits November 30, 2026 14:37
- remove obsolete merging of LICENSING.rst in description as the
  include is not there anymore
- put setuptools configuration in pyproject.toml
- the setup_requires setting in setup.py is deprecated and is covered
  by pyproject.toml [build-system] - requires
Copilot AI balanced review requested due to automatic review settings December 1, 2026 00:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clean distribution builds omit the native extension’s typing stubs because package discovery is restricted to wolfcrypt without explicitly retaining **/*.pyi.

1 open issue
What changed in this PR

This PR simplifies Python packaging by moving setuptools configuration into pyproject.toml and removing obsolete setup logic.

Changes:

  • Move package discovery and DLL package-data configuration into pyproject.toml.
  • Remove deprecated setup_requires, relying on existing build-system requirements.
  • Remove obsolete licensing-file substitution from the README-based package description.
File Description
setup.py Removes migrated configuration, deprecated dependency setup, and obsolete description processing.
pyproject.toml Adds package discovery and package-data settings for DLL inclusion.

Review effort: Balanced

Comment thread pyproject.toml
Comment on lines +57 to +58
# FIPS builds; .pyi stubs and py.typed are included by setuptools itself.
wolfcrypt = ["*.dll"]
@dgarske

dgarske commented Dec 1, 2026

Copy link
Copy Markdown
Member

Re the Skoll finding not tied to a diff line (package_data removed): *.dll is kept via [tool.setuptools.package-data]; py.typed and the .pyi stubs are included by setuptools itself (verified in a built wheel). packages.find now lists only wolfcrypt, since wolfcrypt._ffi holds only stubs and the entry had no effect.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants