-
Notifications
You must be signed in to change notification settings - Fork 276
Refactor: Rename avdutils to pyavd-utils #6065
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
ClausHolbechArista
merged 13 commits into
aristanetworks:devel
from
ClausHolbechArista:refactor/rename-avdutils-to-pyavd-utils
Oct 29, 2025
Merged
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
62e23a1
Refactor: Rename avdutils to pyavd-utils
ClausHolbechArista 6088129
Refactor: Rename avdutils to pyavd-utils
ClausHolbechArista e1b18a3
fix tests
ClausHolbechArista a867139
Update more paths
ClausHolbechArista 05e3d7b
test coverage of bindings
ClausHolbechArista 577782f
fix
ClausHolbechArista 68babbb
fix float
ClausHolbechArista 7b3138d
improve test coverage on pyvalidation crate
ClausHolbechArista 1ebba63
try with py3.12
ClausHolbechArista 70ffc9f
update comment
ClausHolbechArista 6bdc81e
ensure only initializing Python once
ClausHolbechArista f94884f
more tests
ClausHolbechArista fdfad98
Merge branch 'devel' into refactor/rename-avdutils-to-pyavd-utils
ClausHolbechArista 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
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| CURRENT_DIR = $(shell pwd) | ||
| ANSIBLE_AVD_DIR ?= .. | ||
| SCRIPTS_DIR = $(CURRENT_DIR)/scripts | ||
|
|
||
| # export PYTHONPATH=$(CURRENT_DIR) # Uncomment to test from source | ||
|
|
||
| .PHONY: help | ||
| help: ## Display help message | ||
| @grep -E '^[0-9a-zA-Z_-]+\.*[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
|
||
| .PHONY: build | ||
| build: ## Build pyavd package | ||
| pip3 install build | ||
| rm -rf $(CURRENT_DIR)/build/ $(CURRENT_DIR)/dist/ $(CURRENT_DIR)/pyavd.egg-info/ | ||
| python3 -m build --wheel | ||
|
|
||
| .PHONY: uv-build | ||
| uv-build: ## Build pyavd package | ||
| uv pip install build | ||
| rm -rf $(CURRENT_DIR)/build/ $(CURRENT_DIR)/dist/ $(CURRENT_DIR)/pyavd.egg-info/ | ||
| python3 -m build --wheel | ||
|
|
||
|
|
||
| .PHONY: publish | ||
| publish: ## Publish pyavd package to PyPI (build first) | ||
| pip3 install twine && \ | ||
| twine check dist/* && \ | ||
| twine upload -r testpypi dist/* && \ | ||
| twine upload dist/* | ||
|
|
||
| .PHONY: uv-publish | ||
| uv-publish: ## Publish pyavd package to PyPI (build first) | ||
|
ClausHolbechArista marked this conversation as resolved.
|
||
| uv pip install twine && \ | ||
| twine check dist/* && \ | ||
| twine upload -r testpypi dist/* && \ | ||
| twine upload dist/* | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [package] | ||
| name = "pypasswords" | ||
| version.workspace = true | ||
| edition = "2024" | ||
| license.workspace = true | ||
|
|
||
| [build-dependencies] | ||
| pyo3-build-config = { workspace = true } | ||
|
|
||
| [dependencies] | ||
| pyo3 = {workspace = true, "features" = ["abi3-py310"] } | ||
| passwords = { path = "../../../rust/passwords" } | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib", "lib"] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // Copyright (c) 2025 Arista Networks, Inc. | ||
| // Use of this source code is governed by the Apache License 2.0 | ||
| // that can be found in the LICENSE file. | ||
|
|
||
| use pyo3::pymodule; | ||
|
|
||
| #[pymodule] | ||
| #[pyo3(name = "passwords")] | ||
| mod passwords { | ||
|
|
||
| use pyo3::{PyResult, pyfunction}; | ||
|
|
||
| #[pyfunction] | ||
| /// Computes the SHA512 crypt value for the password given the salt | ||
| pub fn sha512_crypt(password: String, salt: String) -> PyResult<String> { | ||
| passwords::sha512_crypt(&password, &salt).map_err(|err| { | ||
| // Mapping our crates error to Python errors. | ||
| match err { | ||
| passwords::Sha512CryptError::InvalidSalt(_) => { | ||
| pyo3::exceptions::PyValueError::new_err(format!("{err}")) | ||
| } | ||
| passwords::Sha512CryptError::ShaCrypt(_) => { | ||
| pyo3::exceptions::PyRuntimeError::new_err(format!("{err}")) | ||
| } | ||
| } | ||
| }) | ||
| } | ||
| } |
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,27 @@ | ||
| [package] | ||
| name = "pyvalidation" | ||
| version.workspace = true | ||
| edition = "2024" | ||
| license.workspace = true | ||
|
|
||
| [build-dependencies] | ||
| pyo3-build-config = { workspace = true } | ||
|
|
||
| [dependencies] | ||
| avdschema = { path = "../../../rust/avdschema", features = ["dump_load_files"] } | ||
| included_store = { path = "../../../rust/included_store" } | ||
| validation = { path = "../../../rust/validation", features = ["python_bindings"] } | ||
|
|
||
| derive_more = { workspace = true, features = ["display", "from"] } | ||
| log = { workspace = true } | ||
| pyo3 = { workspace = true, "features" = ["abi3-py310"] } | ||
| pyo3-log = { workspace = true } | ||
| serde = { workspace = true, features = ["derive"] } | ||
| serde_json = { workspace = true, features = [ | ||
| "arbitrary_precision", # To support very big numbers | ||
| "preserve_order", | ||
| ] } | ||
| serde_yaml = { workspace = true } | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib", "lib"] |
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,17 @@ | ||
| // Copyright (c) 2025 Arista Networks, Inc. | ||
| // Use of this source code is governed by the Apache License 2.0 | ||
| // that can be found in the LICENSE file. | ||
|
|
||
| use std::env; | ||
|
|
||
| fn main() { | ||
| println!("cargo:rerun-if-changed=build.rs"); | ||
| println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_OS"); | ||
|
|
||
| if let Ok(current_target_os) = env::var("CARGO_CFG_TARGET_OS") | ||
| && current_target_os == "macos" { | ||
| println!("cargo:warning=Compiling on 'macos'"); | ||
| // Needed for MacOS when using pyo3 extension-module | ||
| pyo3_build_config::add_extension_module_link_args(); | ||
| } | ||
| } |
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
Oops, something went wrong.
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.