Package: pyp2spec
pyp2specThis project is a thought descendant ofspecfile_generator.It generates working Fedora RPM spec file for Python projects.
The produced spec files must be compliant with the currentPython Packaging Guidelines(in effect since 2021).
It utilizes the benefits ofpyproject-rpm-macros.This project's maturity state is alpha.
Its API may be a subject of change.What it doespyp2specgathers all the necessary information from PyPI to produce a valid
Fedora spec file and stores it in the current directory alongside with
the config file used to produce the spec file.Inside, there are two parts:pyp2conf: gathers of all the necessary information to produce a spec file and stores it in a configuration fileconf2spec: produces working spec file using all the information from configuration fileHow to runTo run whatever this project offers at this point,
install packagepyp2specfrom PyPI with the command:pip install pyp2specThen you can run:pyp2spec <pypi_package_name>or those two commands which will together produce the same result aspyp2spec:pyp2conf <pypi_package_name>
conf2spec <config_file>To see all available command-line options, run--helpwith the respective commands.DevelopmentAlternatively, you can clone the project from GitHub and install
the dependencies to you virtual environment:python -m pip install -r requirements.txtTo run the script and generate both the config and spec file, type:python -m pyp2spec.pyp2spec <pypi_package_name>You can run either of the tools separately to generate partial results:python -m pyp2spec.pyp2conf <pypi_package_name>
python -m pyp2spec.conf2spec <config_file>TestsTo run the tests, runtox:toxYou can installtoxfrom your OS repository or PyPI.
Test dependencies are defined in the project's[test]extra.Configuration file specificationConfiguration data is stored in a TOML file.Mandatory fieldsGenerated by pyp2confFieldDescriptionTypepypi_namepackage name as stored in PyPIstringpython_namepypi_name prepended withpython-stringarchive_namesource tarball name, stripped of version and file extensionstringversionpackage version to create spec file for (RPM format)stringpypi_versionpackage version string as in PyPI, '%{version}' if the same as versionstringsummaryshort package summarystringlicenselicense namestringurlproject URLstringsource%{pypi_source} macro with optional arguments (tarball URL can be used instead)stringdescriptionlong package descriptionmultiline stringextrasextra subpackages nameslist of stringsarchfulpackage contains compiled extensions, implies not usingBuildArch: noarchand addingBuildRequires: gccboolOptional fieldsNot generated by pyp2confCan be also added to config files generated by pyp2confFieldDescriptionTypetest_methodpytest,toxstringtest_top_levelfilter and test only top-level modules in %checkboolunwanted_teststest names to skip with pytestlistbinary_fileslist binary files from the packagelistlicense_fileslist license files from the packagelistdoc_fileslist doc files from the packagelistExample config file generated by pyp2specdescription = "This is package 'aionotion' generated automatically by pyp2spec."
summary = "A simple Python 3 library for Notion Home Monitoring"
version = "2.0.3"
license = "MIT"
pypi_name = "aionotion"
pypi_version = %{version}
python_name = "python-aionotion"
url = "https://github.com/bachya/aionotion"
source = "%{pypi_source aionotion}"
archive_name = "aionotion"
extras = []
archful = falseSpec file generated using the example configName:           python-aionotion
Version:        3.0.2
Release:        %autorelease
Summary:        A simple Python 3 library for Notion Home Monitoring

# Check if the automatically generated License and its spelling is correct for Fedora
# https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
License:        MIT
URL:            https://github.com/bachya/aionotion
Source:         %{pypi_source aionotion}

BuildArch:      noarch
BuildRequires:  python3-devel

%global _description %{expand:
This is package 'aionotion' generated automatically by pyp2spec.}


%description %_description

%package -n     python3-aionotion
Summary:        %{summary}

%description -n python3-aionotion %_description


%prep
%autosetup -p1 -n aionotion-%{version}


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
# For official Fedora packages, including files with '*' +auto is not allowed
# Replace it with a list of relevant Python modules/globs and list extra files in %%files
%pyproject_save_files '*' +auto


%check
%pyproject_check_import


%files -n python3-aionotion -f %{pyproject_files}


%changelog
%autochangelogLicenseThe code is licensed underMIT.The spec file template -template.specand the files generated by the tool are licensed underMIT-0 (No Attribution).