Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pyprojectize

This helps you convert a Fedora RPM spec file from %py3_build etc. to %pyproject macros. This program only operates on the spec file itself, and hence has limited knowledge. The resulting spec file is not guaranteed to be buildable and manual verification and completion of the transition is strongly advised.

$ python pyprojectize.py --help
usage: pyprojectize [-h] [-l] [-i MODIFIER] [-x MODIFIER [MODIFIER ...] | -o MODIFIER] [-s SOURCEDIR]
                    [SPECFILE]

positional arguments:
  SPECFILE              path to the spec file to convert

options:
  -h, --help            show this help message and exit
  -l, --list-modifiers  list all available modifiers and exit
  -i MODIFIER, --info MODIFIER
                        display documentation for given modifier
  -x MODIFIER [MODIFIER ...], --exclude MODIFIER [MODIFIER ...]
                        exclude given modifier
  -o MODIFIER, --only MODIFIER
                        run only one given modifier
  -s SOURCEDIR, --sourcedir SOURCEDIR
                        path to the source directory, relevant for %include etc. (default: spec's parent)

If you wish to process multiple specfiles at a time, run this tool via parallel, etc. If you wish to
inspect/commit result of each modififer separatelly, you can loop over pyprojectize -l calling pyprojectize -o
$modifer each time.

$ python pyprojectize.py ampy.spec  # 16a7deeb
✅ add_pyproject_buildrequires: %generate_buildrequires with %pyproject_buildrequires added
✅ remove_setuptools_br: removed BuildRequires for setuptools
✅ py3_build_to_pyproject_wheel: replaced %py3_build with %pyproject_wheel in %build
✅ py3_install_to_pyproject_install: replaced %py3_install with %pyproject_install in %install
✅ egginfo_to_distinfo: replaced .egg-info with .dist-info in %files
✅ add_pyproject_files: %{python3_sitelib}/%{python3_sitearch} lines replaced with %{pyproject_files}
👌 update_extras_subpkg: %{?python_extras_subpkg:%python_extras_subpkg ...} not found
✅ remove_python_provide: %python_provide removed or replaced with %py_provides
✅ remove_python_enable_dependency_generator: %python_enable_dependency_generator removed
✅ remove_pyp2rpm_comment: # Created by pyp2rpm-X.Y.Z comment removed
👌 remove_remove_bundled_egginfo: no removal of bundled .egg-info

Demo

https://github.com/hroncok/pyprojectize/compare/originals..specfiles

Installation

This is a pip-installable package.

pip install pyprojectize

Or use uv, pipx etc.

Available modifiers

add_pyproject_buildrequires

If there is no %generate_buildrequires section, add it after %prep.

Insert %pyproject_buildrequires to the end of %generate_buildrequires.

remove_setuptools_br

Remove BuildRequires for setuptools, they should be generated.

py3_build_to_pyproject_wheel

In the %build section, replace %py3_build with %pyproject_wheel. Arguments (if any) are passed to -C--global-option.

py3_install_to_pyproject_install

In the %install section, replace %py3_install with %pyproject_install. Any arguments are discarded. Installing a wheel does not need arguments.

egginfo_to_distinfo

In all the %files sections, replace .egg-info with .dist-info. The .dist-info filename is updated if possible (e.g. to use canonical name and version). Works reasonably well even with macronized filenames.

add_pyproject_files

If there is only one %files section with %{python3_sitelib} or %{python3_sitearch}, replace the manually listed files with %pyproject_save_files and -f %{pyproject_files}.

In case the %license files match patterns recognized by setuptools' defaults, uses %pyproject_save_files with -l and removes them.

update_extras_subpkg

Replace %python_extras_subpkg -i ... with %pyproject_extras_subpkg, preserve other arguments.

remove_python_provide

Remove %python_provide or replace it with %py_provides if the package name isn't the same.

This does not detect packages without files yet. Packages without files need %py_provides even when the package name is the same.

remove_python_enable_dependency_generator

Remove %python_enable_dependency_generator, as the generator is enabled by default.

remove_pyp2rpm_comment

Remove the # Created by pyp2rpm-X.Y.Z comment. The spec file is changed enough for this to no longer matter.

remove_remove_bundled_egginfo

Remove the # Remove bundled egg-info comment and the followup rm ...egg-info. There is no such thing as "bundled egg-info".

License

MIT-0, see LICENSE.

Metadata

Release files for pyprojectize 1a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyprojectize 1a2
File Size Uploaded Provenance
pyprojectize-1a2.tar.gz 12.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyprojectize 1a2
File Interpreter ABI Platform
pyprojectize-1a2-py3-none-any.whl Python 3 none any Details

Total release size: 22.8 kB

Release files / pyprojectize-1a2.tar.gz

Download URL pyprojectize-1a2.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
290d1fe553f88d81bea0155e95231988ab961124a1d2b62d9de1fd4cde93b768
BLAKE2b-256 checksum
How to use checksums
8fa37bf1cf16ff5dd3b555561fbb9b58bae9d3b162b446753075a70644f47008
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pyprojectize-1a2-py3-none-any.whl

Download URL pyprojectize-1a2-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2b267567bc9e3ab5e50eb54a8b2e5832b1f36ca6b7b43526fc84bbc9eb139c5
BLAKE2b-256 checksum
How to use checksums
cc03821756b849a5710e4c54976023e1bf64f74470a341cfec1b7653faee5f7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Security for pyprojectize 1a2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page