-
Notifications
You must be signed in to change notification settings - Fork 1
Python Packaging #30
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
Merged
Merged
Python Packaging #30
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
27666c4
Update gitignore to use GitHub python ignores [no ci]
zachcran b3232c3
Define pip-installable python package that doesn't touch the cmake build
zachcran 81657af
Update docstrings
zachcran 3903da5
Update project description
zachcran 283f827
Split dependency groups from optional dependencies, explaining differ…
zachcran 8178cc3
Note invisible dependency and document reason for using package-dir
zachcran cd8585a
Update and add tests for friend checking
jwaldrop107 356e584
.licenserc.yaml fix for venv
jwaldrop107 4de180c
Update src/python/friendzone/friends.py
jwaldrop107 6fa0286
update pyproject.toml authors
jwaldrop107 04f5dbf
rework friends
jwaldrop107 90c8b73
revert MolSSI module names
jwaldrop107 61cd73a
CMake updates and Zach's suggestions
jwaldrop107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Copyright 2025 NWChemEx-Project | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # This file defines the pip-installable Python package. | ||
|
|
||
| [build-system] | ||
| requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [tool.setuptools_scm] | ||
| # For smarter version schemes and other configuration options, | ||
| # check out https://github.com/pypa/setuptools_scm | ||
| version_scheme = "no-guess-dev" | ||
|
|
||
| # To create a pip-installable package that uses CMake in the backend, | ||
| # scikit-build-core is used as the build backend, recommended by Pybind11. | ||
| # | ||
| # scikit-build-core: https://scikit-build-core.readthedocs.io/en/latest/ | ||
| # Pybind11 scikit-build-core example: https://github.com/pybind/scikit_build_example | ||
| # [build-system] | ||
| # requires = ["scikit-build-core>=0.11", "pybind11>=3.0"] | ||
| # build-backend = "scikit_build_core.build" | ||
|
|
||
|
|
||
| [project] | ||
| name = "friendzone" | ||
| license = "Apache-2.0" | ||
| license-files = ["LICENSE"] | ||
| description = "Provides SimDE compatible APIs so that NWChemEx can play nicely with its friends." | ||
| readme = "README.md" | ||
| authors = [{ name = "zachcran", email = "[email protected]" }] | ||
| requires-python = ">=3.10" | ||
| classifiers = [ | ||
| "Development Status :: 4 - Beta", | ||
| "Programming Language :: Python :: 3 :: Only", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: 3.14", | ||
| "Private :: Do Not Upload", | ||
| ] | ||
| # Dynamic project attributes | ||
| # | ||
| # Set the project version dynamically according to git tags. | ||
| # Git tag version info: https://github.com/pypa/setuptools-scm/blob/fb261332d9b46aa5a258042d85baa5aa7b9f4fa2/README.rst#default-versioning-scheme | ||
| dynamic = ["version"] | ||
| # NOTE: Invisible dependency for now until Python bindings at SimDE are | ||
| # packaged properly and available here | ||
| # dependencies = ["simde"] | ||
|
|
||
|
|
||
| [tool.setuptools] | ||
| # Cannot automatically find the friendzone namespace so we set it here | ||
| package-dir = { "" = "src/python" } | ||
|
|
||
| # Optional dependencies represent optional features that can be enabled | ||
| # during installation | ||
| # Example: pip install friendzone[ase] | ||
| [project.optional-dependencies] | ||
| ase = ["ase"] | ||
| nwchem = ["qcengine", "qcelemental", "networkx"] | ||
|
|
||
| # Dependency groups are optional dependencies that are not intented to appear | ||
| # after packaging, usually used to help with testing or development | ||
| # Example: pip install . --group dev | ||
| [dependency-groups] | ||
| test = ["pytest"] | ||
| dev = [{ include-group = "test" }] | ||
zachcran marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [tool.pytest.ini_options] | ||
| minversion = "8.0" | ||
| addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] | ||
| xfail_strict = true | ||
| log_cli_level = "INFO" | ||
| filterwarnings = ["error", "ignore::pytest.PytestCacheWarning"] | ||
| testpaths = ["tests"] | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright 2025 NWChemEx-Project | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from importlib.util import find_spec | ||
|
|
||
|
|
||
| def friends() -> list[str]: | ||
| """Returns a list of potentially supported friends. | ||
|
|
||
| :return: A list of names of potentially supported friends. | ||
| :rtype: list[str] | ||
| """ | ||
| friends_list = [ | ||
| "ase", | ||
| "nwchem", | ||
| ] | ||
| return friends_list | ||
|
|
||
|
|
||
| def is_friend_enabled(friend: str) -> bool: | ||
| """Wraps the process of determining if a particular friend was enabled. | ||
|
|
||
| :param friend: Name of friend to check | ||
| :type friend: str | ||
|
|
||
| :return: True if FriendZone was configured with support for ``friend`` | ||
| and false otherwise. | ||
| :rtype: bool | ||
| """ | ||
| if friend in friends() and find_spec(friend) is not None: | ||
| return True | ||
| return False | ||
jwaldrop107 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Copyright 2025 NWChemEx-Project | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import unittest | ||
| from importlib.util import find_spec | ||
|
|
||
| from friendzone.friends import friends, is_friend_enabled | ||
|
|
||
|
|
||
| class TestFriends(unittest.TestCase): | ||
| def test_friends_list(self): | ||
| expected_friends = ["ase", "nwchem"] | ||
| actual_friends = friends() | ||
| self.assertCountEqual(actual_friends, expected_friends) | ||
|
|
||
| def test_is_friend_enabled(self): | ||
| # For known friends, the result should match the system state | ||
| for friend in friends(): | ||
| enabled = is_friend_enabled(friend) | ||
| module_found = find_spec(friend) is not None | ||
| self.assertEqual(enabled, module_found) | ||
| # For unknown friends, the result should be False | ||
| self.assertFalse(is_friend_enabled("non_existent_friend")) | ||
jwaldrop107 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.