Stabilize CLI, modularize commands, migrate packaging to uv + pyproject.toml#25
Draft
Copilot wants to merge 2 commits into
Draft
Stabilize CLI, modularize commands, migrate packaging to uv + pyproject.toml#25Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/DataHerb/dataherb-python/sessions/d03ba734-03e6-4028-9330-0c99ab1b4e53 Co-authored-by: emptymalei <663798+emptymalei@users.noreply.github.com>
…tup.py Agent-Logs-Url: https://github.com/DataHerb/dataherb-python/sessions/4bcdf088-6f7f-474e-8356-cb8a3eafb8d0 Co-authored-by: emptymalei <663798+emptymalei@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
emptymalei
May 21, 2026 10:05
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several CLI commands were broken or incomplete, core search logic had a string/sequence confusion bug, and the project used a legacy
setup.py+requirements.txtstack. This PR addresses all three areas.Core bug fixes
search_by_ids_in_flora: a plainstrwas iterated as a character sequence —"geo"would match inside query string"geo-nuts". Fixed by normalizing to[str]before the membership test.Flora.__init__: remote flora calledself.workdirbefore it was set; plainstrpaths were rejected. Both fixed.Flora._convert_to_herb:Herbwas constructed withoutbase_path, falling back to a config file lookup that fails in CI. Now passesself.workdir / id.upload/validate: used__CWD__ = Path(__file__).parent(the package directory, evaluated at import time) instead ofPath.cwd(). Fixed.validate: calledMetaData()with no args (raises);MetaData.validate()returnedNone— CLI iterated it. Implemented a real structured return:{"data": [{"path": {...}, "name": {...}}]}.add: implementation was cut off at a# TODO. Completed — fetches remote metadata and callsfl.add(Herb(metadata)).Exception(...)raises replaced withValueError,FileNotFoundError,TypeError,ConnectionError,click.ClickException.CLI restructuring
Split the 600-line monolithic
command.pyinto focused modules:dataherb/cmd/flora.pysearch,download,add,removedataherb/cmd/dataset.pycreate,upload,validatedataherb/cmd/configure.pyconfiguredataherb/cmd/serve.pyservecommand.pyis now ~50 lines — a thin registration file usingdataherb.add_command(...).Tests
35 new tests (43 total):
tests/core/test_search.py— exact-match, multi-id, empty, and the string-safety regressiontests/core/test_metadata.py—MetaData.load,validate(success/error/missing),createtests/test_cmd/test_cli.py— CLI regression viaCliRunner: search, validate, upload aborttests/integration/test_flora.py— add/remove roundtrip, unknown-id returnsNone, duplicate-ID guardPackaging migration
Replaced
setup.py+requirements*.txtwithpyproject.toml(hatchling backend) and auv.locklockfile.CI updated to use
astral-sh/setup-uv@v5instead ofsetup-python+ manual pip installs.Also fixed a
distutils.dir_util.copy_treeimport insave_mkdocs.pythat broke on Python 3.12 (module removed); replaced withshutil.copytree(..., dirs_exist_ok=True).