Skip to content

Code currently mixes British and American spellings for centre / center #24

Description

@bjmorgan

Problem

The codebase currently has inconsistent spelling between British "centre" and American "center", creating confusion for users and inconsistency in the API.

British spelling currently used:

  • Site.centre property (core base class)
  • DynamicVoronoiSite._centre_coords, .calculate_centre()
  • Builder methods: with_spherical_sites(centres=...), with_polyhedral_sites(centre_species=...)
  • Internal tools: get_coordination_indices(centre_species=...)

American spelling currently used:

  • ReferenceBasedSites.create_polyhedral_sites(center_species=...) (public, released)
  • ReferenceBasedSites.create_dynamic_voronoi_sites(center_species=...)
  • Recently updated: PolyhedralSite(reference_center=...), DynamicVoronoiSite(reference_center=...)

Arguments for Standardising on American Spelling

  1. Ecosystem consistency: PyMatGen (our primary dependency) uses American spelling throughout its API
  2. Python ecosystem standard: NumPy, SciPy, Matplotlib, and virtually all scientific Python libraries use "center"
  3. International accessibility: American spelling is more familiar to the global Python developer community
  4. Future-proofing: New users will expect American spelling based on ecosystem conventions
  5. Minimal breaking changes: The analysis below shows limited public API impact

Breaking Change Analysis

Public API breaking changes:

  • Builder methods: centre_speciescenter_species, centrescenters
    • Impact: LOW - Builder API is relatively new with limited adoption

Non-breaking changes (using aliases):

  • Site.centre → add Site.center alias, keep centre with deprecation warning
    • Impact: NONE - existing code continues to work

Internal changes (no user impact):

  • get_coordination_indices(centre_species=...)center_species (not intended as public API)
  • Internal methods and attributes

Proposed Solution

Core Properties

  • Add Site.center property as alias to Site.centre
  • Add deprecation warning to Site.centre
  • Update DynamicVoronoiSite methods: calculate_centre()calculate_center(), _centre_coords_center_coords

Builder API

  • Update builder method parameters: centre_speciescenter_species, centrescenters
  • Update factory function parameters to match

Internal Tools

  • Update get_coordination_indices(centre_species=...)center_species
  • Update other internal utilities

Documentation

  • Search and replace "centre" → "center" in all docstrings, comments, and documentation
  • Update examples to use American spelling
  • Document breaking changes in release notes

Benefits

  • Consistency: Single spelling convention throughout the API
  • Developer experience: Matches expectations from other Python scientific libraries
  • Maintainability: Reduces cognitive load when developing and reviewing code
  • Ecosystem integration: Better alignment with PyMatGen and broader Python ecosystem

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions