Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor project structure and improve optional dependencies handling #101

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

MitchellAcoustics
Copy link
Owner

Refactor the project structure and dependencies to enhance maintainability and user experience. Improve handling of optional dependencies with lazy loading and better error messages. Update testing workflows and documentation to reflect these changes.

* refactor: remove schema dep

* refactor: remove pandas performance deps

Seems a better policy to allow users to decide whether or not to use pandas[performance], especially since it can introduce issues with numba, llvmlite as compiled packages.

* chore: reorganise pyproject and use uv's new dev groups

* chore: check optional installs on testpypi

* bump version v0.7.5 -> v0.7.6dev0

* fix: improve optional dependency handling

- Implement lazy loading for optional components via __getattr__
- Centralize optional dependency configuration in _optionals.py
- Add explicit __all__ list for better IDE support
- Remove dynamic __all__ manipulation for more reliable behavior
- Maintain helpful error messages for missing dependencies

This change improves the developer and user experience when working with
optional features while maintaining backwards compatibility.

* refactor: relative imports

* refactor: reduce dependencies

* fix: opt dep tests

* bump version v0.7.6dev0 -> v0.7.6dev1

* fix: fixed test collection

* bump version v0.7.6dev1 -> v0.7.6dev2

### Improvements to optional dependencies handling:

* Centralized optional dependency configuration in `_optionals.py` for better maintainability. (`CONTRIBUTING.md` [[1]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055R85)], [[2]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L93-R99)], [[3]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L108-R125)], [[4]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L130-R141)], [[5]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L145-R272)])
* Improved error messages and IDE support for optional dependencies. (`CHANGELOG.md` [[CHANGELOG.mdR8-R59](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR8-R59)])

### Updates to testing and CI workflows:

* Added new workflows for tagged releases and testing tagged releases, including installation from TestPyPI and running tests. (`.github/workflows/test-tag-release.yml` [[.github/workflows/test-tag-release.ymlL107-R132](diffhunk://#diff-11b7dedbf7b09ab5a0bd90aa70d8a2eda1918dab64a511c82104706cfa09f3b7L107-R132)])
* Updated `conftest.py` to handle dependency checks in a more modular way, caching results for better performance. (`conftest.py` [[1]](diffhunk://#diff-a31c7ed5d35f5ed8233994868c54d625b18e6bacb6794344c4531e62bd9dde59L7-R39)], [[2]](diffhunk://#diff-a31c7ed5d35f5ed8233994868c54d625b18e6bacb6794344c4531e62bd9dde59L54-R65)], [[3]](diffhunk://#diff-a31c7ed5d35f5ed8233994868c54d625b18e6bacb6794344c4531e62bd9dde59L89-R88)])
* Simplified the `pyproject.toml` by consolidating dependencies and updating test configurations. (`pyproject.toml` [[1]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L3-R15)], [[2]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L37-R57)], [[3]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L71-R66)])

### Documentation updates:

* Added detailed developer notes and guidelines for adding new optional features and handling dependencies. (`CONTRIBUTING.md` [[1]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055R85)], [[2]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L93-R99)], [[3]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L108-R125)], [[4]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L130-R141)], [[5]](diffhunk://#diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055L145-R272)])
* Documented the new optional dependencies system and provided examples for both success and failure cases. (`CHANGELOG.md` [[CHANGELOG.mdR8-R59](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR8-R59)])
@MitchellAcoustics MitchellAcoustics merged commit 83bdc1f into main Nov 6, 2024
12 checks passed
@MitchellAcoustics MitchellAcoustics deleted the dev branch November 6, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant