forked from aws-deadline/deadline-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: General cleanup and polish
BREAKING-CHANGE: Some of the renames (errors module to exceptions, aws module to _aws) are not backwards compatible. - Rename internal functions to start with '_' to follow Python's conventions. - Refine the wording of docstrings and exception messages in the login/lout functionality. Use DeadlineOperationError to prevent stack traces for errors with error messages we've curated. - Tidy up the main() function to use the one generated by click directly instead of wrapping it. - Mark the bealine-dev-gui command as experimental. - Simplify hatch_version_hook.py to hatch_custom_hook.py the same way as in deadline-cloud-for-maya. - Change the default log level to WARNING instead of INFO. Remove the code that overrode the log level when importing deadline.client.ui, we do not want to mess with settings that clients of the library determine. - Update the deadline dev gui entry point to use the log level setting. - Remove the dataclasses-json dependency. This transitively also depends on marshmallow mypy-extensions packaging typing-extensions, and typing-inspect. Because deadline-cloud is imported into customer code contexts that we have little control over, every additional dependency adds the risk of conflicts with choices that customers have made. Therefore each dependency must provide enough benefit to justify this risk, and dataclasses-json does not, as we can implement to_dict and from_dict methods directly for the small number of dataclasses that need this. - Remove the old manifest version v2022_06_06. Update all the conditional code about v2023_03_03 to be the default. Clean up some names like Path -> ManifestPath to avoid confusion with pathlib. - Remove the src/deadline_job_attachments shim that was used temporarily while transitioning to a namespace package. - Remove the map_source_path_to_dest_path function, as it wasn't performing a needed path transformation. - Rename job_attachments.errors to job_attachments.exceptions to be consistent with the exceptions module in the client lib. - Clean up examples/submit_job.py to not depend on any of the interfaces defined as internal. - Combine the duplicated hashing & uploading summary output into the SummaryStatistics __str__ method. - Remove the get_rez_environment function, as we are moving it fully to a Queue Environment. This also means the OPENJDToken class in utils is no longer used, so also remove that. Signed-off-by: Mark Wiebe <[email protected]>
- Loading branch information
Showing
91 changed files
with
801 additions
and
1,978 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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,49 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
from __future__ import annotations | ||
|
||
import os | ||
import shutil | ||
|
||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface | ||
from typing import Any | ||
|
||
|
||
class HatchCustomBuildHook(BuildHookInterface): | ||
""" | ||
This class implements Hatch's [custom build hook] (https://hatch.pypa.io/1.6/plugins/build-hook/custom/) | ||
for a copy_version_py operation that copies the _version.py file generated by the hatch-vcs build hook into | ||
specified destination directories. See the `[[tool.hatch.build.hooks.custom]]` section in `pyproject.toml`. | ||
""" | ||
|
||
def _validate_config(self): | ||
if sorted(self.config) != ["copy_version_py", "path"] or list( | ||
self.config["copy_version_py"] | ||
) != ["destinations"]: | ||
raise RuntimeError( | ||
"Configuration of the custom build hook must be like { 'copy_version_py': {'destinations': ['path1', ...]}}." | ||
+ f" Received:\n{self.config}" | ||
) | ||
|
||
def initialize(self, version: str, build_data: dict[str, Any]) -> None: | ||
self._validate_config() | ||
|
||
for destination in self.config["copy_version_py"]["destinations"]: | ||
print(f"Copying _version.py to {destination}") | ||
shutil.copy( | ||
os.path.join(self.root, "_version.py"), | ||
os.path.join(self.root, destination), | ||
) | ||
|
||
def clean(self, versions: list[str]) -> None: | ||
self._validate_config() | ||
|
||
cleaned_count = 0 | ||
for destination in self.config["copy_version_py"]["destinations"]: | ||
print(f"Cleaning _version.py from {destination}") | ||
clean_path = os.path.join(self.root, destination, "_version.py") | ||
try: | ||
os.remove(clean_path) | ||
cleaned_count += 1 | ||
except FileNotFoundError: | ||
pass | ||
print(f"Cleaned {cleaned_count} items") |
Oops, something went wrong.