Skip to content

Conversation

@Siyet
Copy link
Contributor

@Siyet Siyet commented Sep 24, 2025

PR Details

Implement Go export GetDefinedName returning DefinedName list.

Description

  • Add Python wrapper File.get_defined_name() to retrieve defined names.
  • Go: export GetDefinedName returning a list of excelize.DefinedName.
  • C: introduce GetDefinedNameResult to pass arrays across the FFI boundary.
  • Python ctypes: add _GetDefinedNameResult in types_go.py and wire lib.GetDefinedName.
  • Tests: extend test_defined_name to assert retrieval after setting a defined name.
  • Mirrors upstream Excelize behavior and complements existing set_defined_name / delete_defined_name.

Refs: https://github.com/qax-os/excelize/blob/42840b3fd595d3221257af1a596612b9045b25ce/sheet.go#L1828

Related Issue

N/A

Motivation and Context

  • Achieve feature parity with Go Excelize’s GetDefinedName.
  • Provide a complete defined name lifecycle in Python: set/get/delete.
  • Enables introspection and validation of named ranges in user code.

How Has This Been Tested

Unit tests: updated test_defined_name to:

  • set a defined name
  • call get_defined_name()
  • assert the name exists with expected scope

Smoke tested by creating a new workbook and enumerating returned names.

Environment:

  • Go 1.23
  • Python 3.12.11
  • OS: Ubuntu 22.04

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Siyet added 2 commits September 24, 2025 21:58
Implement Go export GetDefinedName returning DefinedName list; add C result struct and ctypes binding; expose File.get_defined_name() in Python; extend tests to verify retrieval after setting a defined name. Aligns with existing set/delete wrappers and mirrors upstream library semantics.\n\nRefs: https://github.com/qax-os/excelize/blob/42840b3fd595d3221257af1a596612b9045b25ce/sheet.go#L1828

Signed-off-by: Siyet <[email protected]>
@xuri xuri added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 25, 2025
- Simplify unit tests code
- add failed cases increase code coverage to 100%
@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (834d53f) to head (0d5bebd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #29   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines         2954      2972   +18     
=========================================
+ Hits          2954      2972   +18     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@Siyet
Copy link
Contributor Author

Siyet commented Sep 25, 2025

@xuri Thanks for the updates to my PR. Do you need anything else from me before merging it into main?

This is my first contribution to an open-source library. :)

Copy link
Owner

@xuri xuri left a comment

Choose a reason for hiding this comment

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

Great work, thanks for your contribution!

@xuri xuri merged commit e62db79 into xuri:main Sep 27, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants