Skip to content

A module is never hidden behind a function of its own name, and every public module says what it publishes - #973

Merged
jmrplens merged 1 commit into
fix/acronyms-and-spelled-out-wordsfrom
fix/no-module-behind-a-function
Oct 21, 2026
Merged

jmrplens merged 1 commit into
fix/acronyms-and-spelled-out-wordsfrom
fix/no-module-behind-a-function

Conversation

@jmrplens

@jmrplens jmrplens commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Thirty-one modules shared their name with a function their package publishes. signals/correlation.py sat beside signals.correlation(), so the package attribute signals.correlation was the function: import phonometry.signals.correlation as m bound the function, signals.correlation.time_delay raised AttributeError, and only a from import of the file path reached the module, while the API reference had a page titled with that address. The same held for room.impulse_response, fluids.air, the eight sound power modules of emission and twenty more. And 119 public modules had no __all__, so a constant one of them kept for itself looked as public as its functions; some of those constants had reached guides and scripts through the full module path, where nothing could rename them without breaking a reader.

What changes

Each of the 31 modules is private now (signals/_correlation.py), the convention PEP 8 sets for internal interfaces and the one NumPy (numpy._core) and SciPy follow for their implementation modules. The function keeps its name, and every name the package published from the module keeps its address: signals.correlation(...) and signals.time_delay read as before, and from phonometry.signals import time_delay is the import. Every importer moved: the package __init__ files, sibling modules, _plot and _report, the tests, the conformance domains, figure, diagram and report scripts, api_taxonomy.py, the errata, the docstrings and the guides.

The API reference keeps one page per topic at the URL it had, so no link breaks, but no page claims a module address that does not import any more. A private module's page is titled by its domain and subject (signals: correlation), opens by naming the package its names are imported from, and names the other package where one of its names is published elsewhere (plot_junction_geometry, drawn beside the vibration junctions, is published by building). The subject is words and never a standard's designation, because the site search weighs a title above the standards a guide declares: titled tonality (ECMA-418-2), the reference page came within 1.6 times of the guides written to ECMA-418-2 on a search for it, where the site check asks for twice. The three ECMA-418-2 pages are psychoacoustics: tonality (Sottek model), roughness (Sottek model) and fluctuation strength (Sottek model), and their summaries still name the standard. The index lists such a page by its domain, and the guides link to it by that title (signals: correlation) instead of a signals.correlation label that reads as a module path.

Every public module now declares an __all__ that lists what it defines and its package publishes, and anything else it defines takes a leading underscore. hearing.hearing_protectors and noise_control.valves now list the constants their packages publish from them. The three NC tables a guide drew by hand are published by room with their unit: room.NC_OCTAVE_BANDS_HZ, room.NC_RATINGS and room.NC_CURVES_DB, each with a curated row. The SII band importances, band centres and vocal efforts are read from speech.sii_procedure(...) and speech.standard_speech_spectra(), the NIPTS frequencies from the hearing.nipts(...) result, the ISO 1683 references from the .value of the metrology.ISO1683_REFERENCE_VALUES records, and the guides now read them there. The coefficients, limits and defaults of environment.assessment.impulsive_sound, vibration.human.multiple_shock, building.prediction.detailed_model and the rest are private, each applied by the function that reads it or taken as the default of a parameter; two constants nothing read, electroacoustics.piston.J1_FIRST_ZERO and noise_control.duct_modes.PLANE_WAVE_EIGENVALUE, are deleted. Type aliases, TypeVars and Protocols stay PascalCase and unlisted, as the rest of the tree has them.

Four of the values that went private are criteria no function applies, and the migration guide now says so instead of the opposite: the ECMA-418-2 prominence thresholds of tonality (0.4 tu_HMS, clause 6.3), roughness (0.2 asper, clause 7.2) and fluctuation strength (0.2 vacil_HMS, clause 9.2), and its 0.01 sone_HMS audibility criterion (clause 5.1.9). The guide gives each with its clause and the result field to compare against it. The sound quality guide said the standard attaches no limit to the single tonality value T; clause 6.3 gives two criteria, 0.4 tu_HMS on the specific tonality at a local maximum for a stationary sound and 0.4 tu_HMS on T for a non-stationary one, and the guide now states both and that tonality_ecma() applies neither.

What breaks

The 31 leaf import paths are gone, with no alias: importlib.import_module("phonometry.signals.correlation") raises ModuleNotFoundError. The names those modules defined and their packages never published go private with their module: the gates and block lengths of broadcast.program_loudness, the ECMA-418-2 prominence thresholds, the uncertainty defaults of the tone audibility module, the duct path self-noise floor, and the type aliases of four emission modules (PrecisionSurface, PrecisionArray, PrecisionRoom, MicrophoneShield, Grade, BandType, DeterminationGrade), whose Literal is what to annotate with now. The migration guide, in its three copies, has a new section with the 23 leaf paths that shipped in 4.0.0rc1 and what to write instead, and a table of every constant withdrawn from a module that shipped in 3.3.0 or 4.0.0rc1, under its 3.3.0 module and spelling where those differ (DEFAULT_AIR_CONDITION became PUBLISHED_AIR_CONDITION in rc1), with where its value lives now: metrology.ISO1683_REFERENCE_VALUES["solid"]["velocity_alternative"].value for the 50 nm/s free-velocity reference, the 1 m/(N s) reference mobility of EN 15657 that the functions apply, the 25 mm microphone spacing of IEC 61043 Table 2 that spacing_m= defaults to, and, for reference_sound of the DIN 45692 module, how to build the clause 6 test signal from signals.noise_signal. The eight modules newer than rc1 are in the CHANGELOG only, and the CHANGELOG entries written since rc1 now name the package instead of the file or a constant that went private. CONTRIBUTING has a section on the rule and why. The counts at the top of the migration guide do not move: no name the 3.3.0 top level exported changes here.

How it was verified

No number moves. The conformance report runs 1893 of 1893 checks and docs/CONFORMANCE.md comes out byte for byte the same; the figures whose generators changed re-render byte-identical; make reports reproduces every committed fiche; the API reference covers all 3062 public names and its pages keep their URLs (check:redirects green). The clip fingerprints do not move except anim_epnl_flyover, which was already stale on the base with the same fingerprint. The full suite passes on Python 3.13 (28358 passed, 69 skipped), every documentation code block runs (7535 blocks over 731 pages), and the site builds and validates (astro check with no error or warning, html-validate clean, and check:search green for all 306 designations in both languages, the worst margin 2.4 times on ISO 3744).

Every value the migration guide now gives was read on the printed page: ECMA-418-2:2025 clause 6.3 (PDF page 34, printed page 24), clause 7.2 (PDF page 46, printed page 36), clause 9.2 (PDF page 61, printed page 51) and clause 5.1.9 (PDF page 23, printed page 13); DIN 45692:2009-08 clause 6 (PDF page 9), whose 920 to 1080 Hz noise at 60 dB built from signals.noise_signal gives 1.0004 acum through psychoacoustics.sharpness_din; UNE-EN ISO 1683:2016 Table 3 and its note b (PDF page 9, printed page 9); UNE-EN 15657:2018 clause 5 for the 1 m/(N s) reference mobility (PDF page 11, printed page 11). room.NC_CURVES_DB is now compared cell by cell with ANSI/ASA S12.2-2019 Table 1, typed from the printed page (PDF page 18, printed page 6); a one-decibel change to any cell fails the test, where before only the NC-30 row and a few cells through the SIL were held.

The guard

scripts/check_api_reference.py holds the modules to both rules, through module_problems, which walks every public module of every domain package (the packages themselves included):

  • a public module whose name its package gives to something else (a function, a class, a constant) is reported, with the private name it should take. Importing a submodule for the first time replaces the package attribute of its name, so the walk reads that attribute before it imports the module and puts back whatever the import replaced; and it reads the package's __init__, where any statement but from . import <module> that binds the module's name hides it, so a module another import reached first is found as well;
  • a public module without __all__ is reported;
  • a module that declares __all__ and leaves out a name it defines and its package publishes is reported;
  • a public-looking name a module defines and does not list is reported unless it is a typing construct (a type alias, a TypeVar, a Protocol). An exception is keyed by location in UNLISTED_EXEMPTIONS with its reason, and an entry that no longer applies is reported, so the table cannot go stale. The table is empty: the reference spacing of emission.intensity_compliance carries its unit now, and with it its underscore (_REFERENCE_SPACING_M).

tests/test_check_api_reference.py pins each rule on fake packages (a module hidden behind a function and one behind a string, a module beside the function its package publishes from another file that nothing imports, the same module imported before the walk, a domain package without __all__, a list that leaves out a published name and an unpublished constant, an alias, a TypeVar, a Protocol, an import and a private module that all stay quiet), the statements of an __init__ that do and do not hide a module, the stale exemption, and the AST walk that reads what a module binds; it also runs the rules over the library. The two new fake-package cases and the statement table fail against the guard without these reads. A copy of signals/_correlation.py dropped beside it as signals/correlation.py makes the script exit 1 with the hidden-module message. tests/test_removed_names.py pins the 31 leaf paths as gone, a sample of the withdrawn constants, and the NC tables at their new address. tests/test_api_docs_generator.py holds every page title to an address that imports, every private page to its domain, and every name on a private page to the package its opening names; it refuses a title with a number in it, which is how a designation would reach one (red on the three (ECMA-418-2) titles), and a title too long for the 70 characters html-validate allows the browser title.

Red on the base (c719ff6), with this guard copied in (trimmed; the full output is 166 lines):

165 public module problem(s); a module is never hidden behind a name of its package, and every public module says what it publishes:
  - phonometry.aircraft.airport_noise declares no __all__, so nothing says which of its names are public
  - phonometry.aircraft.anp_fleet declares no __all__, so nothing says which of its names are public
  ...
  - phonometry.broadcast.program_loudness is hidden behind phonometry.broadcast.program_loudness, a function: `import phonometry.broadcast.program_loudness` binds the function, so the module is private (_program_loudness) and its names are reached through phonometry.broadcast
  ...
  - phonometry.building.measurement.rainfall_sound is hidden behind phonometry.building.measurement.rainfall_sound, a function: `import phonometry.building.measurement.rainfall_sound` binds the function, so the module is private (_rainfall_sound) and its names are reached through phonometry.building.measurement
  ...
  - phonometry.emission.intensity_compliance defines 'REFERENCE_SPACING_M' and its __all__ does not list it; a name its package does not publish is private (_REFERENCE_SPACING_M)
  ...
  - phonometry.hearing.hearing_protectors defines 'PROTECTOR_OCTAVE_BANDS_HZ', which phonometry.hearing publishes, and its __all__ does not list it
  ...

That is 31 hidden modules, 119 modules without __all__ and 15 names left out of a list. Green on this branch:

docs/reference/api/index.md covers all 3062 public names, says what each of them is, and shows version 4.0.0rc1; every public name has one address and none is a type alias, and every public module is reached by its name and lists all it publishes.

@sourcery-ai sourcery-ai Bot 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.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 300 files, and this pull request has 430

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 429 files, which is 329 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

⚙️ Run configuration
  • Configuration used: Repository: jmrplens/phonometry/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef6a25e4-d24c-4e5f-a150-7d4c122efa82
📥 Commits

Reviewing files that changed from the base of the PR and between c719ff6 and 0bc8fbe.

⛔ Files ignored due to path filters: 1
  • scripts/boundary_comparison_exemptions.tsv is excluded by !**/*.tsv
📒 Files selected for processing: 429
  • CHANGELOG.md
  • CONTRIBUTING.md
  • docs/ERRATA.es.md
  • docs/ERRATA.md
  • docs/buildings/design/panel-sound-insulation.md
  • docs/buildings/insulation/lab-application-rules.md
  • docs/buildings/rooms/room-impulse-response.md
  • docs/buildings/rooms/room-noise.md
  • docs/devices/emission/sound-power-in-duct.md
  • docs/devices/emission/sound-power-intensity.md
  • docs/devices/emission/sound-power-reverberation.md
  • docs/devices/emission/sound-power.md
  • docs/devices/noise-control/duct-path.md
  • docs/devices/noise-control/enclosure-cabin-insulation.md
  • docs/environment/sources/road-surface-pass-by.md
  • docs/materials/absorbers/airflow-resistance.md
  • docs/perception/hearing/hearing-protectors.md
  • docs/perception/hearing/noise-induced-hearing-loss.md
  • docs/perception/psychoacoustics/psychoacoustic-annoyance.md
  • docs/perception/psychoacoustics/sound-quality.md
  • docs/perception/psychoacoustics/tone-audibility.md
  • docs/perception/speech/speech-intelligibility.md
  • docs/reference/api/index.md
  • docs/signals/spectra/cepstrum-echoes.md
  • docs/signals/spectra/correlation-delay.md
  • docs/start/upgrading.md
  • docs/vibration/structural/impact-mobility.md
  • llms-full.txt
  • scripts/api_taxonomy.py
  • scripts/check_api_reference.py
  • scripts/check_parameter_units.py
  • scripts/check_published_sources.py
  • scripts/check_reference_values.py
  • scripts/conformance/domains/assessment.py
  • scripts/conformance/domains/environmental_sources.py
  • scripts/conformance/domains/intelligibility.py
  • scripts/conformance/domains/intensity.py
  • scripts/conformance/domains/noise_control.py
  • scripts/conformance/domains/psychoacoustics.py
  • scripts/figures/devices.py
  • scripts/figures/environment.py
  • scripts/figures/perception.py
  • scripts/figures/room.py
  • scripts/figures/vibration.py
  • scripts/generate_api_docs.py
  • scripts/generate_catalogue_data.py
  • scripts/reports/noise_control.py
  • scripts/reports/vibration.py
  • site/public/llms/llms-buildings-design.txt
  • site/public/llms/llms-buildings-insulation-laboratory.txt
  • site/public/llms/llms-buildings-rooms.txt
  • site/public/llms/llms-devices-emission-intensity.txt
  • site/public/llms/llms-devices-emission-reverberant.txt
  • site/public/llms/llms-devices-emission.txt
  • site/public/llms/llms-devices-noise-control-measured.txt
  • site/public/llms/llms-devices-noise-control.txt
  • site/public/llms/llms-environment-sources.txt
  • site/public/llms/llms-materials-absorbers.txt
  • site/public/llms/llms-perception-hearing.txt
  • site/public/llms/llms-perception-psychoacoustics.txt
  • site/public/llms/llms-perception-speech.txt
  • site/public/llms/llms-signals-spectra.txt
  • site/public/llms/llms-start.txt
  • site/public/llms/llms-vibration-structural.txt
  • site/src/content/docs/buildings/design/panel-sound-insulation.mdx
  • site/src/content/docs/buildings/insulation/lab-application-rules.mdx
  • site/src/content/docs/buildings/rooms/room-impulse-response.mdx
  • site/src/content/docs/buildings/rooms/room-noise.mdx
  • site/src/content/docs/devices/emission/sound-power-in-duct.mdx
  • site/src/content/docs/devices/emission/sound-power-in-situ.mdx
  • site/src/content/docs/devices/emission/sound-power-intensity.mdx
  • site/src/content/docs/devices/emission/sound-power-reverberation.mdx
  • site/src/content/docs/devices/emission/sound-power-test-rooms.mdx
  • site/src/content/docs/devices/emission/sound-power.mdx
  • site/src/content/docs/devices/noise-control/duct-path.mdx
  • site/src/content/docs/environment/sources/road-surface-pass-by.mdx
  • site/src/content/docs/es/buildings/design/panel-sound-insulation.mdx
  • site/src/content/docs/es/buildings/insulation/lab-application-rules.mdx
  • site/src/content/docs/es/buildings/rooms/room-impulse-response.mdx
  • site/src/content/docs/es/buildings/rooms/room-noise.mdx
  • site/src/content/docs/es/devices/emission/sound-power-in-duct.mdx
  • site/src/content/docs/es/devices/emission/sound-power-in-situ.mdx
  • site/src/content/docs/es/devices/emission/sound-power-intensity.mdx
  • site/src/content/docs/es/devices/emission/sound-power-reverberation.mdx
  • site/src/content/docs/es/devices/emission/sound-power-test-rooms.mdx
  • site/src/content/docs/es/devices/emission/sound-power.mdx
  • site/src/content/docs/es/devices/noise-control/duct-path.mdx
  • site/src/content/docs/es/environment/sources/road-surface-pass-by.mdx
  • site/src/content/docs/es/materials/absorbers/airflow-resistance.mdx
  • site/src/content/docs/es/perception/hearing/hearing-protectors.mdx
  • site/src/content/docs/es/perception/hearing/noise-induced-hearing-loss.mdx
  • site/src/content/docs/es/perception/psychoacoustics/psychoacoustic-annoyance.mdx
  • site/src/content/docs/es/perception/psychoacoustics/sound-quality.mdx
  • site/src/content/docs/es/perception/psychoacoustics/tone-audibility.mdx
  • site/src/content/docs/es/perception/speech/speech-intelligibility.mdx
  • site/src/content/docs/es/reference/errata.md
  • site/src/content/docs/es/signals/spectra/cepstrum-echoes.mdx
  • site/src/content/docs/es/signals/spectra/correlation-delay.mdx
  • site/src/content/docs/es/start/upgrading.mdx
  • site/src/content/docs/es/vibration/structural/impact-mobility.mdx
  • site/src/content/docs/es/vibration/structural/junction-transmission.mdx
  • site/src/content/docs/materials/absorbers/airflow-resistance.mdx
  • site/src/content/docs/perception/hearing/hearing-protectors.mdx
  • site/src/content/docs/perception/hearing/noise-induced-hearing-loss.mdx
  • site/src/content/docs/perception/psychoacoustics/psychoacoustic-annoyance.mdx
  • site/src/content/docs/perception/psychoacoustics/sound-quality.mdx
  • site/src/content/docs/perception/psychoacoustics/tone-audibility.mdx
  • site/src/content/docs/perception/speech/speech-intelligibility.mdx
  • site/src/content/docs/reference/api/broadcast/program-loudness.md
  • site/src/content/docs/reference/api/building/rainfall-sound.md
  • site/src/content/docs/reference/api/electroacoustics/headphones.md
  • site/src/content/docs/reference/api/electroacoustics/swept-sine.md
  • site/src/content/docs/reference/api/environment/impulsive-sound.md
  • site/src/content/docs/reference/api/environment/statistical-pass-by.md
  • site/src/content/docs/reference/api/environment/wind-turbine.md
  • site/src/content/docs/reference/api/fluids/air.md
  • site/src/content/docs/reference/api/fluids/catalogue.md
  • site/src/content/docs/reference/api/fluids/water.md
  • site/src/content/docs/reference/api/hearing/active-noise-reduction.md
  • site/src/content/docs/reference/api/hearing/earmuff-insertion-loss.md
  • site/src/content/docs/reference/api/hearing/noise-induced-hearing-loss.md
  • site/src/content/docs/reference/api/hearing/real-ear-attenuation.md
  • site/src/content/docs/reference/api/index.md
  • site/src/content/docs/reference/api/materials/airflow-resistance.md
  • site/src/content/docs/reference/api/materials/dynamic-stiffness.md
  • site/src/content/docs/reference/api/metrology/comparison-calibration.md
  • site/src/content/docs/reference/api/metrology/reciprocity-coupler.md
  • site/src/content/docs/reference/api/metrology/reciprocity-free-field.md
  • site/src/content/docs/reference/api/noise_control/cabin-insulation.md
  • site/src/content/docs/reference/api/noise_control/duct-modes.md
  • site/src/content/docs/reference/api/noise_control/duct-path.md
  • site/src/content/docs/reference/api/noise_control/hvac.md
  • site/src/content/docs/reference/api/noise_control/room-to-room.md
  • site/src/content/docs/reference/api/power/reference-sound-source.md
  • site/src/content/docs/reference/api/power/sound-power-anechoic.md
  • site/src/content/docs/reference/api/power/sound-power-hard-walled.md
  • site/src/content/docs/reference/api/power/sound-power-in-duct.md
  • site/src/content/docs/reference/api/power/sound-power-in-situ.md
  • site/src/content/docs/reference/api/power/sound-power-intensity-points.md
  • site/src/content/docs/reference/api/power/sound-power-intensity.md
  • site/src/content/docs/reference/api/power/sound-power-reverberation.md
  • site/src/content/docs/reference/api/power/sound-power-special-room.md
  • site/src/content/docs/reference/api/psychoacoustics/annoyance.md
  • site/src/content/docs/reference/api/psychoacoustics/fluctuation-strength-ecma.md
  • site/src/content/docs/reference/api/psychoacoustics/fluctuation-strength.md
  • site/src/content/docs/reference/api/psychoacoustics/roughness-ecma.md
  • site/src/content/docs/reference/api/psychoacoustics/tonality-ecma.md
  • site/src/content/docs/reference/api/psychoacoustics/tone-audibility.md
  • site/src/content/docs/reference/api/rooms/acoustics.md
  • site/src/content/docs/reference/api/rooms/crowd-noise.md
  • site/src/content/docs/reference/api/rooms/enclosed-space-absorption.md
  • site/src/content/docs/reference/api/rooms/image-source.md
  • site/src/content/docs/reference/api/rooms/impulse-response.md
  • site/src/content/docs/reference/api/rooms/noise-criteria.md
  • site/src/content/docs/reference/api/signals/cepstrum.md
  • site/src/content/docs/reference/api/signals/correlation.md
  • site/src/content/docs/reference/api/signals/envelope.md
  • site/src/content/docs/reference/api/signals/inversion.md
  • site/src/content/docs/reference/api/signals/phase.md
  • site/src/content/docs/reference/api/underwater/seabed-reflection.md
  • site/src/content/docs/reference/api/vibration/impact-mobility.md
  • site/src/content/docs/reference/api/vibration/junction-transmission.md
  • site/src/content/docs/reference/api/vibration/multiple-shock.md
  • site/src/content/docs/reference/api/vibration/point-mobility.md
  • site/src/content/docs/reference/api/vibration/radiation-efficiency.md
  • site/src/content/docs/reference/errata.md
  • site/src/content/docs/signals/spectra/cepstrum-echoes.mdx
  • site/src/content/docs/signals/spectra/correlation-delay.mdx
  • site/src/content/docs/start/upgrading.mdx
  • site/src/content/docs/vibration/structural/impact-mobility.mdx
  • site/src/content/docs/vibration/structural/junction-transmission.mdx
  • src/phonometry/_plot/audiometry.py
  • src/phonometry/_plot/broadcast.py
  • src/phonometry/_plot/building.py
  • src/phonometry/_plot/common.py
  • src/phonometry/_plot/emission.py
  • src/phonometry/_plot/environment.py
  • src/phonometry/_plot/geometry/vibration.py
  • src/phonometry/_plot/hearing.py
  • src/phonometry/_plot/materials.py
  • src/phonometry/_plot/noise_control.py
  • src/phonometry/_plot/psychoacoustics.py
  • src/phonometry/_plot/room.py
  • src/phonometry/_plot/signals.py
  • src/phonometry/_plot/underwater.py
  • src/phonometry/_plot/vibration.py
  • src/phonometry/_report/_frf_fiche.py
  • src/phonometry/_report/ansi_s12_2.py
  • src/phonometry/_report/broadcast.py
  • src/phonometry/_report/duct_path.py
  • src/phonometry/_report/iso1996_tone.py
  • src/phonometry/_report/iso1999.py
  • src/phonometry/_report/iso3741.py
  • src/phonometry/_report/iso3743.py
  • src/phonometry/_report/iso3744.py
  • src/phonometry/_report/iso7626.py
  • src/phonometry/_report/iso9053.py
  • src/phonometry/_report/iso9614.py
  • src/phonometry/aircraft/airport_noise.py
  • src/phonometry/aircraft/anp_fleet.py
  • src/phonometry/aircraft/atmospheric_absorption.py
  • src/phonometry/aircraft/certification.py
  • src/phonometry/aircraft/flight_performance.py
  • src/phonometry/aircraft/npd_atmosphere.py
  • src/phonometry/aircraft/rotorcraft_noise.py
  • src/phonometry/aircraft/rotorcraft_propagation.py
  • src/phonometry/broadcast/__init__.py
  • src/phonometry/broadcast/_program_loudness.py
  • src/phonometry/broadcast/quasi_peak.py
  • src/phonometry/building/measurement/__init__.py
  • src/phonometry/building/measurement/_rainfall_sound.py
  • src/phonometry/building/measurement/flanking_transmission.py
  • src/phonometry/building/measurement/intensity_insulation.py
  • src/phonometry/building/measurement/laboratory_insulation.py
  • src/phonometry/building/measurement/structure_borne_power.py
  • src/phonometry/building/measurement/survey_insulation.py
  • src/phonometry/building/measurement/uncertainty.py
  • src/phonometry/building/prediction/detailed_model.py
  • src/phonometry/building/prediction/facade.py
  • src/phonometry/building/prediction/installed_structure_borne.py
  • src/phonometry/building/prediction/panel_transmission.py
  • src/phonometry/building/prediction/simplified_model.py
  • src/phonometry/electroacoustics/distortion.py
  • src/phonometry/electroacoustics/frequency_response.py
  • src/phonometry/electroacoustics/intermodulation.py
  • src/phonometry/electroacoustics/loudspeaker.py
  • src/phonometry/electroacoustics/microphone.py
  • src/phonometry/electroacoustics/noise_measurements.py
  • src/phonometry/electroacoustics/piston.py
  • src/phonometry/electroacoustics/sound_reinforcement.py
  • src/phonometry/electroacoustics/swept_sine.py
  • src/phonometry/emission/__init__.py
  • src/phonometry/emission/_sound_power_anechoic.py
  • src/phonometry/emission/_sound_power_hard_walled.py
  • src/phonometry/emission/_sound_power_in_duct.py
  • src/phonometry/emission/_sound_power_in_situ.py
  • src/phonometry/emission/_sound_power_intensity.py
  • src/phonometry/emission/_sound_power_intensity_points.py
  • src/phonometry/emission/_sound_power_reverberation.py
  • src/phonometry/emission/_sound_power_special_room.py
  • src/phonometry/emission/declaration.py
  • src/phonometry/emission/intensity.py
  • src/phonometry/emission/intensity_compliance.py
  • src/phonometry/emission/reference_sound_source.py
  • src/phonometry/emission/sound_power_high_frequency.py
  • src/phonometry/emission/workstation.py
  • src/phonometry/environment/assessment/impulsive_sound.py
  • src/phonometry/environment/assessment/measurement.py
  • src/phonometry/environment/assessment/rating.py
  • src/phonometry/environment/assessment/soundscape_binaural.py
  • src/phonometry/environment/propagation/air_absorption.py
  • src/phonometry/environment/propagation/ground_barriers.py
  • src/phonometry/environment/propagation/noise_reducing_devices.py
  • src/phonometry/environment/propagation/outdoor_propagation.py
  • src/phonometry/environment/propagation/refraction.py
  • src/phonometry/environment/sources/__init__.py
  • src/phonometry/environment/sources/_statistical_pass_by.py
  • src/phonometry/environment/sources/wind_turbine.py
  • src/phonometry/filters/core.py
  • src/phonometry/filters/design.py
  • src/phonometry/filters/frequencies.py
  • src/phonometry/filters/weighting.py
  • src/phonometry/fluids/__init__.py
  • src/phonometry/fluids/_air.py
  • src/phonometry/fluids/gas.py
  • src/phonometry/fluids/water.py
  • src/phonometry/hearing/__init__.py
  • src/phonometry/hearing/_earmuff_insertion_loss.py
  • src/phonometry/hearing/_real_ear_attenuation.py
  • src/phonometry/hearing/active_noise_reduction.py
  • src/phonometry/hearing/hearing_protectors.py
  • src/phonometry/hearing/noise_induced_hearing_loss.py
  • src/phonometry/hearing/occupational_exposure.py
  • src/phonometry/hearing/sound_field_audiometry.py
  • src/phonometry/hearing/threshold.py
  • src/phonometry/io/_signal.py
  • src/phonometry/materials/absorbers/__init__.py
  • src/phonometry/materials/absorbers/_airflow_resistance.py
  • src/phonometry/materials/absorbers/sound_absorption.py
  • src/phonometry/materials/resilient/dynamic_stiffness.py
  • src/phonometry/metrology/calibration.py
  • src/phonometry/metrology/comparison_calibration.py
  • src/phonometry/metrology/uncertainty.py
  • src/phonometry/noise_control/__init__.py
  • src/phonometry/noise_control/_cabin_insulation.py
  • src/phonometry/noise_control/_criterion.py
  • src/phonometry/noise_control/_duct_path.py
  • src/phonometry/noise_control/duct_modes.py
  • src/phonometry/noise_control/enclosures.py
  • src/phonometry/noise_control/hvac.py
  • src/phonometry/noise_control/room_to_room.py
  • src/phonometry/noise_control/silencers.py
  • src/phonometry/noise_control/valves.py
  • src/phonometry/psychoacoustics/erb_scale.py
  • src/phonometry/psychoacoustics/loudness/contours.py
  • src/phonometry/psychoacoustics/loudness/ecma.py
  • src/phonometry/psychoacoustics/loudness/moore_glasberg.py
  • src/phonometry/psychoacoustics/loudness/moore_glasberg_time.py
  • src/phonometry/psychoacoustics/loudness/zwicker.py
  • src/phonometry/psychoacoustics/quality/__init__.py
  • src/phonometry/psychoacoustics/quality/_fluctuation_strength.py
  • src/phonometry/psychoacoustics/quality/_fluctuation_strength_ecma.py
  • src/phonometry/psychoacoustics/quality/_roughness_ecma.py
  • src/phonometry/psychoacoustics/quality/_tonality_ecma.py
  • src/phonometry/psychoacoustics/quality/_tone_audibility.py
  • src/phonometry/psychoacoustics/quality/annoyance.py
  • src/phonometry/psychoacoustics/quality/sharpness.py
  • src/phonometry/psychoacoustics/quality/tonality.py
  • src/phonometry/room/__init__.py
  • src/phonometry/room/_crowd_noise.py
  • src/phonometry/room/_impulse_response.py
  • src/phonometry/room/acoustics.py
  • src/phonometry/room/auditorium.py
  • src/phonometry/room/enclosed_space_absorption.py
  • src/phonometry/room/image_source.py
  • src/phonometry/room/modes.py
  • src/phonometry/room/noise_criteria.py
  • src/phonometry/room/open_plan.py
  • src/phonometry/room/reverberation_prediction.py
  • src/phonometry/room/steady_field.py
  • src/phonometry/signals/__init__.py
  • src/phonometry/signals/_cepstrum.py
  • src/phonometry/signals/_correlation.py
  • src/phonometry/signals/_envelope.py
  • src/phonometry/signals/levels.py
  • src/phonometry/signals/phase.py
  • src/phonometry/signals/test_signals.py
  • src/phonometry/simulation/elastic_fdtd.py
  • src/phonometry/simulation/fdtd.py
  • src/phonometry/solids/elastic.py
  • src/phonometry/speech/objective_intelligibility.py
  • src/phonometry/speech/sii.py
  • src/phonometry/speech/sti.py
  • src/phonometry/underwater/acoustics.py
  • src/phonometry/underwater/bioacoustics/audiograms.py
  • src/phonometry/underwater/bioacoustics/weighting.py
  • src/phonometry/underwater/propagation/__init__.py
  • src/phonometry/underwater/propagation/_seabed_reflection.py
  • src/phonometry/underwater/propagation/closed_form.py
  • src/phonometry/underwater/propagation/numerical.py
  • src/phonometry/underwater/propagation/sound_speed.py
  • src/phonometry/underwater/propagation/weston_regimes.py
  • src/phonometry/underwater/sonar_equation.py
  • src/phonometry/underwater/sources/ambient_noise.py
  • src/phonometry/underwater/sources/pile_driving_noise.py
  • src/phonometry/underwater/sources/ship_radiated_noise.py
  • src/phonometry/underwater/sources/ship_traffic_noise.py
  • src/phonometry/vibration/human/exposure.py
  • src/phonometry/vibration/human/instrumentation.py
  • src/phonometry/vibration/human/multiple_shock.py
  • src/phonometry/vibration/human/seat_vibration.py
  • src/phonometry/vibration/human/signal_burst.py
  • src/phonometry/vibration/machinery/diagnostics.py
  • src/phonometry/vibration/machinery/evaluation.py
  • src/phonometry/vibration/structural/__init__.py
  • src/phonometry/vibration/structural/_impact_mobility.py
  • src/phonometry/vibration/structural/_junction_transmission.py
  • src/phonometry/vibration/structural/_radiation_efficiency.py
  • src/phonometry/vibration/structural/building_damage.py
  • src/phonometry/vibration/structural/building_response.py
  • src/phonometry/vibration/structural/experimental_sea.py
  • src/phonometry/vibration/structural/mechanical_mobility.py
  • src/phonometry/vibration/structural/point_mobility.py
  • src/phonometry/vibration/structural/transfer_stiffness.py
  • tests/broadcast/test_broadcast_frequency_axis_language.py
  • tests/broadcast/test_ebu_material_oracle.py
  • tests/broadcast/test_program_loudness.py
  • tests/building/measurement/test_rainfall_sound.py
  • tests/building/measurement/test_structure_borne_power.py
  • tests/electroacoustics/test_piston.py
  • tests/emission/test_sound_power_in_duct.py
  • tests/emission/test_sound_power_intensity_points.py
  • tests/emission/test_sound_power_precision.py
  • tests/emission/test_sound_power_special_room.py
  • tests/environment/assessment/test_impulse_prominence.py
  • tests/environment/assessment/test_impulsive_sound.py
  • tests/environment/sources/test_statistical_pass_by.py
  • tests/environment/sources/test_wind_turbine.py
  • tests/fluids/test_fluid_catalogue.py
  • tests/materials/absorbers/test_airflow_resistance.py
  • tests/materials/test_materials_plot_i18n.py
  • tests/metrology/test_reference_values.py
  • tests/noise_control/test_cabin_insulation.py
  • tests/noise_control/test_duct_modes.py
  • tests/noise_control/test_duct_path.py
  • tests/noise_control/test_duct_path_report.py
  • tests/noise_control/test_duct_path_report_language.py
  • tests/noise_control/test_hvac_long.py
  • tests/noise_control/test_hvac_vdi2081.py
  • tests/noise_control/test_noise_control_frequency_axis_language.py
  • tests/noise_control/test_screen_in_situ.py
  • tests/psychoacoustics/quality/test_fluctuation_strength_ecma.py
  • tests/psychoacoustics/quality/test_roughness_ecma.py
  • tests/psychoacoustics/quality/test_sharpness.py
  • tests/psychoacoustics/quality/test_tonality_ecma.py
  • tests/psychoacoustics/quality/test_tone_audibility.py
  • tests/psychoacoustics/test_psychoacoustics_frequency_axis_language.py
  • tests/reference_data/__init__.py
  • tests/reference_data/room.py
  • tests/room/test_enclosed_space_absorption.py
  • tests/room/test_golay.py
  • tests/room/test_image_source.py
  • tests/room/test_impulse_response.py
  • tests/room/test_noise_criteria.py
  • tests/room/test_room_frequency_axis_language.py
  • tests/room/test_room_plot_i18n.py
  • tests/signals/test_correlation.py
  • tests/signals/test_signal_toolbox.py
  • tests/speech/test_objective_intelligibility.py
  • tests/speech/test_sii.py
  • tests/test_api_docs_generator.py
  • tests/test_boundary_verdicts.py
  • tests/test_check_api_reference.py
  • tests/test_check_boundary_comparisons.py
  • tests/test_mutually_required_groups.py
  • tests/test_package_architecture.py
  • tests/test_printed_limits.py
  • tests/test_removed_names.py
  • tests/test_scalar_guards.py
  • tests/test_signal_return_contract.py
  • tests/underwater/propagation/test_eigenrays.py
  • tests/underwater/propagation/test_gaussian_beams.py
  • tests/underwater/propagation/test_seabed_reflection.py
  • tests/vibration/human/test_multiple_shock_report.py
  • tests/vibration/human/test_multiple_shock_vibration.py
  • tests/vibration/machinery/test_diagnostics.py
  • tests/vibration/structural/test_impact_mobility.py
  • tests/vibration/test_vibration_frequency_axis_language.py
  • tests/vibration/test_vibration_plot_i18n.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jmrplens
jmrplens added this pull request to stack #984 October 17, 2026 17:11
@jmrplens jmrplens changed the title fix/no module behind a function A module is never hidden behind a function of its own name, and every public module says what it publishes Oct 17, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation conformance Standard clause coverage, reference values or errata errata Confirmed defect in a published standard, tracked in docs/ERRATA.md validation Reference data and oracles used to check results against normative values api Public API surface, naming and deprecations figures Generated plots, diagrams and animations reports Accredited-format .report() fiches and their rendering site Documentation website i18n English and Spanish translations area: aircraft Aircraft and rotorcraft noise area: broadcast Programme loudness and broadcast levels area: building Sound insulation and building acoustics area: electroacoustics Transducers, arrays and electroacoustic devices area: emission Sound power and source emission area: environment Outdoor propagation, environmental sources and noise assessment area: hearing Audiometric thresholds, hearing loss and noise exposure area: materials Absorption, impedance and material properties area: metrology Calibration, uncertainty and measurement quality area: noise control Silencers, barriers and noise control treatments area: psychoacoustics Loudness, sharpness, roughness and annoyance area: room Room acoustics and reverberation area: simulation FDTD and other numerical solvers area: underwater Underwater acoustics and propagation area: vibration Human vibration and structure-borne sound area: core Shared internals and cross-cutting code every domain depends on area: filters Octave filter banks, weightings and instrument class verification labels Oct 17, 2026
@github-actions github-actions Bot added area: signals Levels, spectra, generators and general signal analysis area: speech Speech intelligibility: STI, SII and STOI labels Oct 17, 2026
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (fix/acronyms-and-spelled-out-words@c719ff6). Learn more about missing BASE report.

Additional details and impacted files
@@                          Coverage Diff                          @@
##             fix/acronyms-and-spelled-out-words     #973   +/-   ##
=====================================================================
  Coverage                                      ?   96.86%           
=====================================================================
  Files                                         ?      444           
  Lines                                         ?    89874           
  Branches                                      ?        0           
=====================================================================
  Hits                                          ?    87058           
  Misses                                        ?     2816           
  Partials                                      ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Numerical conformance

All 1893 conformance checks pass, across 111 domains and 523 standards

1893/1893 checks pass across 111 domains and 523 standards (227 normative designations, 125 further published sources).

Used in the tables below is how much of that clause's published tolerance the deviation consumes: 100 % sits exactly on the limit, 5 % uses a twentieth of the allowance, and a dash means the clause states no two-sided tolerance for the quantity, so there is no budget to spend. It is reported and never used to decide a verdict, which is settled at full precision before any rounding.

Renamed (3)

Standard Base quantity Head quantity
ISO 8297:1994 Table 2 Background correction at differences of 6 to 10 dB and at 12 dB, read through plant_background_correction_db Background correction at differences of 6 to 10 dB and at 12 dB, read through plant_background_correction
Wenz wind noise (rule of fives) Wind spectrum level at 1 kHz, 5 kn (canonical anchor), dB re 1 µPa²/Hz Wind spectrum level at 1 kHz, 5 kt (canonical anchor), dB re 1 µPa²/Hz
JOMOPANS-ECHO ship source level Bulker V=13.5 kn L=211 m band level at 1 kHz (File S1 oracle), dB re 1 µPa m Bulker V=13.5 kt L=211 m band level at 1 kHz (File S1 oracle), dB re 1 µPa m

Closest to their published limit (top 5)

The rows with the least room left, so the ones a change is most likely to push over.

Standard Quantity Deviation Used
ISO/TR 17534-3:2015 Table 3 Ground-projected path length dp, m 0.005 m 100 %
DIN 4150-2:1999-06 Annex C, Example 5 KB_FTr with hammer b) in the rest hours, Formula (5) -0.005 100 %
DIN 4150-2:1999-06 Annex C, Example 8 KB_FTm over the record with the passage maxima alone -0.0005 100 %
E DIN 4150-2:2023-08 Annex B, Table B.1 KB_FTm,Zug of the metro north by Formula (5) -0.0005 100 %
Jarvis (1996) NPL CIRA(EXT) 010 Appendix B, folio 26 Volume of the coupler of the example, v = pi r^2 L -0.00000000005 m³ 100 %

Pass Tests & coverage: 255843 tests, 0 failures (all green)
Python Version Tests Failures Coverage Status
macos-latest-3.12 28427 0 96.9% Pass Passed
macos-latest-3.13 28427 0 96.9% Pass Passed
macos-latest-3.14 28427 0 96.9% Pass Passed
ubuntu-latest-3.12 28427 0 96.9% Pass Passed
ubuntu-latest-3.13 28427 0 96.9% Pass Passed
ubuntu-latest-3.14 28427 0 96.9% Pass Passed
windows-latest-3.12 28427 0 96.9% Pass Passed
windows-latest-3.13 28427 0 96.9% Pass Passed
windows-latest-3.14 28427 0 96.9% Pass Passed

Full report at this commit: docs/CONFORMANCE.md · docs/conformance.json · full CI artifacts

… public module says what it publishes

Thirty-one modules shared their name with a function their package publishes. `signals/correlation.py` sat beside `signals.correlation()`, so the package attribute `signals.correlation` was the function: `import phonometry.signals.correlation as m` bound the function, `signals.correlation.time_delay` raised `AttributeError`, and only a `from` import of the file path reached the module, while the API reference had a page titled with that address. The same held for `room.impulse_response`, `fluids.air`, the eight sound power modules of `emission` and twenty more. And 119 public modules had no `__all__`, so a constant one of them kept for itself looked as public as its functions; some of those constants had reached guides and scripts through the full module path, where nothing could rename them without breaking a reader.
@jmrplens
jmrplens force-pushed the fix/no-module-behind-a-function branch from de8da16 to 0bc8fbe Compare October 20, 2026 01:45
@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Renames internal modules to follow naming conventions.

The PR appears safe to merge, with two non-blocking fixes recommended for the new API check.

Findings

  1. P2 Correct imports fail the check ▶
  2. P2 Unused branches fail the check ▶

Reviews (1) · Last reviewed commit: "A module is never hidden behind a functi..." · Reviewed by Greptile

Comment on lines +649 to +652
if isinstance(node, ast.Import):
for alias in node.names:
if alias.asname == leaf:
return f"import {alias.name} as {leaf}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Correct imports fail the check

_binding_other_than_submodule reports import pkg.probe as probe as hiding probe, even though that statement binds the module itself. A contributor using this valid import form gets a false error from the new API check.

Exclude imports whose full name is f"{package}.{leaf}", and add this case to _BINDINGS.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in #992, commit 3c7d09c. The relative source is resolved against the package before it is compared, and import pkg.leaf as leaf is read as binding the submodule. Both shapes are in the binding tests, with a nested package for the relative one.

Comment on lines +687 to +690
for defined in defined_names(module):
if defined.startswith("_") or defined in listed:
continue
obj = getattr(module, defined, None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Unused branches fail the check

defined_names collects names from both sides of every if and every try branch. _unlisted_problems then reports those names even when the imported module does not contain them. For example, a fallback helper defined only under except ImportError is reported when the dependency imports successfully.

Skip names absent from vars(module) before checking whether they are listed, and test branches that define different names.

Suggested change
for defined in defined_names(module):
if defined.startswith("_") or defined in listed:
continue
obj = getattr(module, defined, None)
for defined in defined_names(module):
if defined.startswith("_") or defined in listed or defined not in vars(module):
continue
obj = getattr(module, defined, None)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I am leaving this as it is on purpose. A name bound in any branch of an if or a try is a name the module binds on some install or interpreter, so it takes a leading underscore or goes in __all__ whichever branch ran on the machine doing the check. Skipping names absent from vars(module) would make the verdict depend on what that machine has installed, and a fallback helper defined for the module's own use is exactly what the rule asks to make private (_helper).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That’s a fair clarification. This is intentionally a conservative source-level check: it enforces the naming/publication rule for every branch that may bind a name, rather than making the result depend on which optional dependencies happen to be installed when the check runs. In that design, a fallback-only helper is still an internal module name that must be underscored (or explicitly published), so my suggested vars(module) guard would weaken the portability guarantee. No change is needed.

@sonarqubecloud

Copy link
Copy Markdown

@jmrplens
jmrplens merged commit 19c3afe into main Oct 21, 2026
102 of 103 checks passed
@jmrplens
jmrplens deleted the fix/no-module-behind-a-function branch October 21, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Public API surface, naming and deprecations area: aircraft Aircraft and rotorcraft noise area: broadcast Programme loudness and broadcast levels area: building Sound insulation and building acoustics area: core Shared internals and cross-cutting code every domain depends on area: electroacoustics Transducers, arrays and electroacoustic devices area: emission Sound power and source emission area: environment Outdoor propagation, environmental sources and noise assessment area: filters Octave filter banks, weightings and instrument class verification area: hearing Audiometric thresholds, hearing loss and noise exposure area: materials Absorption, impedance and material properties area: metrology Calibration, uncertainty and measurement quality area: noise control Silencers, barriers and noise control treatments area: psychoacoustics Loudness, sharpness, roughness and annoyance area: room Room acoustics and reverberation area: signals Levels, spectra, generators and general signal analysis area: simulation FDTD and other numerical solvers area: speech Speech intelligibility: STI, SII and STOI area: underwater Underwater acoustics and propagation area: vibration Human vibration and structure-borne sound conformance Standard clause coverage, reference values or errata documentation Improvements or additions to documentation errata Confirmed defect in a published standard, tracked in docs/ERRATA.md figures Generated plots, diagrams and animations i18n English and Spanish translations reports Accredited-format .report() fiches and their rendering site Documentation website validation Reference data and oracles used to check results against normative values

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant