Package: searchin
Search'InSearch anything in a live python object, method or variable!View Demo·Report BugAbout The ProjectHave you ever spent hours looking for the name of a method or property of a third party library? You are sure that this method/property must exist, but you cannot find it, neither in the documentation, nor in the examples, nor on StackOverflow... You end up scrolling through the source code of the library... So frustrating!Search'In is a tool that allows you to search in python objects as if you were on Google, just by adding a line in the middle of your code !Getting StartedUsing Search'In requires no effort at all!Install Search'In with pip :pipinstallsearchinImport Search'In in your code, by adding this line :importsearchinTo search for"name"in aHumanclass for example, just add this line :searchin(Human,"name")Other examplesYou can search for any string in any python "entity" : variable, method, object, class, module, etc.Search for"5"in atuplesearchin((1,2,3,4,5,6,7,8,9),"5")# >>> "5" found in root.4 : 5Search for"mean"in the methodtorch.nn.functional.cross_entropysearchin(torch.nn.functional.cross_entropy,"mean")# >>> "mean" found in root. : def cross_entropy( [...] reduction: str = "mean", [...], label_smoothing)Search for"grad"in atorch.nn.Modulemodel=torch.nn.Linear(10,10)searchin(model,"grad")# >>> "grad" found in root.bias# >>> "grad" found in root.requires_grad_# >>> "grad" found in root.weight# >>> "grad" found in root.zero_gradAdvanced featuresdefsearchin(obj,query:str,max_depth:int=3,top_k_results:int=10,max_iterable_length:int=100,get_raw_result:bool=False)->Union[List[SearchResult],None]:"""Search an object for a given search term.:param obj: The object to search in.:param query: What to search for.:param max_depth: The maximum depth of the recursive search.:param top_k_results: The maximum number of results to return.:param max_iterable_length: The maximum length of an iterable to search in.:param get_raw_result: If True, return the raw results (of type SearchResult), else just print them.:return: A list of search results."""(back to top)Contributing(Section in english)I want to add a lot of functionnalities to this project, but I don't have much time to work on it. Contributions are welcome!Roadmap/todoTaskImportanceDifficultyContributor on itDescriptionFuzzy match5/52/5NOBODYe.g.:batch_sizeshould match when searchingbatchsize.Link to implem5/53/5NOBODYIn jupyter notebooks, etc. one should be able to click results to go to implementation.Underline the match4/51/5NOBODYe.g.: the printed result should be formatted like this :def cross_entropy( [...] reduction: str = "mean", [...], label_smoothing)Write some tests4/52/5NOBODYWrite some tests to ensure that the code is working properly.Find a better algorithm3/54/5NOBODYThe current algorithm is a BFS (Breadth First Search). Maybe there is a better algorithm to use.Searchin...animation3/51/5NOBODYAdd a cool animation when searching takes a bit of time.Profile code2/51/5NOBODYProfile the code to see if we can speed it up a little.Add a CLI1/52/5NOBODYThink about the design of a CLI (Command Line Interface) to use Search'In from the terminal.Non-Code contribution :TaskImportanceDifficultyContributor on itDescriptionAdding documentation4/51/5NOBODYAdd some helpful docstrings, write basic tutorials with real-life scenarios, write a wiki for other contributors to better understand the functioning of the library.For every todo, just click on the link to find the discussion where I describe how I would do it.See thediscussionsfor a full list of proposed features (and known issues).(back to top)How to contributeContributing is an awesome way to learn, inspire, and help others. Any contributions you make aregreatly appreciated, even if it's just about styling and best practices.If you have a suggestion that would make this project better, please fork the repo and create a pull request.Don't forget to give the project a star! Thanks again!Fork the ProjectCreate your Feature Branch (git checkout -b feature/YourAmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestAuthorsThis library was created byNicolas MICAUX.