Table of Contents
- About The Project
- Getting Started
- Usage
- Tasks
- Contributing
- License
- Contact
- Acknowledgments
About The Project
SerialPy is a Python package designed to streamline search and replace operations on data formats: yaml, toml, and json.
Built to use with additional shell scripting to semi-automate workflows involving OpenAPI and Swagger files, making it ideal for companies aiming to maintain consistency within their specification sheets.
Features include search
and replace
, allowing for precise control of serial data. SerialPy empowers users to ensure accuracy and reliability, making it an invaluable tool for specification sheet maintenance.
(back to top)
Getting Started
Installation
Simply run:
pip install SerialPy
(back to top)
Usage
Serialpy supports the -h
flag at the main and all subcommands so more details can be found there.
Command-Line Interface (CLI)
Search for any key within the data in the given file path that is "test" and return a list of values associated with the key.
serialpy search path/to/file "test" --find="key" --ret="value"
Replace any instance of "var1" from the data in the given file path to "var2" and return True if successfully written back to the file.
serialpy replace path/to/file "var1" "var2"
Library
Import the module at the top of your python script.
The following snippet of code runs search
on all values in "path/to/file"
for 5 and returns all keys associated with the value, 5.
The next line checks to see if the replace
function successfully converted all instances of 5 in "path/to/file"
with 6 and wrote the changes back into the file.
from serialpy import search, replace
found = search.values("path/to/file", "5", "keys") # add False as last argument to disable console printing
if (replace.all("path/to/file", "5", "6"):
# code to run after successfully replacing 5 with 6
(back to top)
Tasks
See the open issues for a full list of issues and proposed features.
(back to top)
Contributing
- Fork the Project
- Create your Feature/Update Branch (
git checkout -b feature/NewFeature
or git checkout -b update/Feature
) - Commit your Changes (
git commit -m 'Add some Feature'
) - Push to the Branch (
git push origin feature/NewFeature
or git push origin update/Feature
) - Open a Pull Request
(back to top)
License
Distributed under the GPL-3.0 License. See LICENSE.txt
for more information.
(back to top)
Contact
Michael Montanaro - LinkedIn - mcmontanaro01@gmail.com
Project Link: https://github.com/montymi/SerialPy
(back to top)
Acknowledgments
(back to top)