spec-cleaner
spec-cleaner is a tool that cleans the given RPM spec file according to the style guide and returns the result.
It's used for openSUSE, where it's planned to be a replacement for osc service localrun format_spec_file and it is intended to provide the same or better features in order to be able to unify all the spec files in OBS.
Table of contents
Installation and usage
Installation
The latest version is available on PyPI. It can be installed by running pip install spec_cleaner.
spec-cleaner is also provided as an RPM package for openSUSE Tumbleweed (openSUSE:Factory) and all maintained openSUSE Leap codestreams. When a new version of spec-cleaner is released, updates are submitted for all maintained codestreams.
Usage
Simply run spec-cleaner -i <specfile> to clean your specfile up.
License conversions come from SPDX data plus SUSE additions; the full tag list is in SPDX-LICENSES.md.
Tests
Running the tests
spec-cleaner provides quite an extensive testsuite. You can run these tests locally directly via pytest.
pytest
Just install python3-pytest, python3-pytest-cov and python3-pytest-sugar (for a nice progress bar) and then run all tests via:
pytest
Contributing
You are more than welcome to contribute to this project. If you are not sure about your changes, feel free to create an issue where you can discuss it before the implementation.
Contribution Guidelines
When changing anything in the code, make sure that you don't forget to:
- Follow pep8.
- Install pre-commit framework and run
pre-commit installto installpre-commitinto your git hooks. - Add proper comments and docstrings (follow pep257 and Google Python Style Guide for docstrings and comments)
- Add tests (mainly if you implement a new feature).
- Add
mypysupport for the new code. - Run and pass all tests,
ruffandmypychecks.
See below for more details.
pre-commit
spec-cleaner project adopted pre-commit framework for managing and maintaining pre-commit hooks. After you clone the spec-cleaner repository, please install pre-commit framework (pip install pre-commit) and run pre-commit install to install pre-commit into your git hooks. Then pre-commit will run automatically on git commit and it will check your contribution with ruff and mypy.
Please note that similar checks run in CI when you submit a PR and it won't pass code review without passing these checks.
mypy
Optional static type checker support was implemented for the most important parts of the code. If you want to run it on your own, just install python3-mypy and run
mypy spec_cleaner
Ruff
The code of spec-cleaner is formatted with Ruff. We use single quotes and --line-length 100. Ruff runs automatically in the pre-commit hook and is enforced in CI.
Adding new tests
When a new feature is added to spec-cleaner then a test for this piece of code must be added. See how to write tests for spec-cleaner.
Versioning and releasing
For the versions available, see the tags on this repository.
If you have proper permissions you can find handy how to do a new release.
Authors
- See the list of contributors who participated in this project
Metadata
Release files for spec-cleaner 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spec_cleaner-1.3.1.tar.gz | 968.1 kB | With provenance | Details for spec_cleaner-1.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spec_cleaner-1.3.1-py3-none-any.whl | Python 3 | none | any | Details for spec_cleaner-1.3.1-py3-none-any.whl |
Total release size: 2.3 MB
Release files / spec_cleaner-1.3.1.tar.gz
| Download URL | spec_cleaner-1.3.1.tar.gz |
|---|---|
| Size | 968.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
987c41b2c4640a1aa2b2aa8ca3ff256324b513ef08d9663ee645af6939543953
|
|
BLAKE2b-256 checksum How to use checksums |
897f827e44e7ad80c953c5964789e04d31fed748e70fd74487a194fc19c3e5e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logRelease files / spec_cleaner-1.3.1-py3-none-any.whl
| Download URL | spec_cleaner-1.3.1-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66c14082c2bce9e89b06a7a252f37debfb5c6b229f0c01c6d5c16fe1803e74ae
|
|
BLAKE2b-256 checksum How to use checksums |
828bf56beb08c9a1b4de64902ed20f01b20993c7d038183ba65292bddf3036ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logSecurity for spec-cleaner 1.3.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for spec_cleaner-1.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.