Skip to content

Refactor version handling to dynamically retrieve from __init__.py in setup.py #1

@chigwell

Description

@chigwell

User Story
As a maintainer,
I want setup.py to dynamically retrieve the package version from __init__.py
so that version management is centralized and release processes avoid manual updates.

Background
The current setup.py (line 4) hardcodes an arbitrary version string (2025.4.231612), which:

  • Requires manual updates for releases, increasing error risk
  • Creates confusion for users seeing a nonsensical future version
  • Complicates CI/CD pipelines due to lack of single source of truth

The solution involves:

  1. Adding a __version__ attribute to folder_scanner/__init__.py
  2. Modifying setup.py to parse this value dynamically

Risks include potential version-parsing failures during installation if not implemented cautiously.

Acceptance Criteria

  • Add __version__ = "1.0.0" to folder_scanner/__init__.py
  • Update setup.py to extract __version__ from __init__.py without importing the package (use file reading + regex)
  • Remove hardcoded version= value from setup.py
  • Validate by running python setup.py sdist and confirming the built package's metadata reflects the __version__ value
  • Ensure the README's PyPI badge URL remains functional post-change (no version hardcoding in README.md)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions