-
Notifications
You must be signed in to change notification settings - Fork 1
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
CLI Extension #56
Merged
Merged
CLI Extension #56
Conversation
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
Closed
Codecov Report
@@ Coverage Diff @@
## master #56 +/- ##
==========================================
- Coverage 75.75% 73.49% -2.27%
==========================================
Files 18 19 +1
Lines 726 781 +55
==========================================
+ Hits 550 574 +24
- Misses 176 207 +31
Flags with carried forward coverage won't be shown. Click here to find out more.
|
* use rich module for prettier console output * add checksum flag * implement print_diff helper function for comparing strings
* refactor __main__ code * reserve single letter shortcuts for frequently used arguments * add custom formatter class to parser to increase spacing in help command between long argument names and their description * use console.print instead of raising exceptions for user-facing error messages
* make these methods more forgivable if a an option or section is not defined in ConfigHandler
Future TODOs:
|
StefanGreve
added
documentation
Improvements or additions to documentation
dependencies
Changes related to dependency management
labels
Oct 14, 2023
* according to the rich docs, most applications only require a single console object
* implement truncate method in utils * edit console messages in CLI * fix typo in default download endpoint in config * remove tqdm from prod dependencies * output download path in download command in CLI
* rename endpoint parameter in RequestHandler methods to relative_path, as to correctly denote the relatvie path of a URL * modify returned dictionary in AnonPy's download and upload method and make them more predictable * refactor code in CLI
* rename init_settings method to init_config * implement eval_config * pass settings dictionary to commands instead of the config handler object A note on terminology: in this context, we use the name config to highlight the fact that the variable denotes a ConfigHandler object, while settings is a combination of these config values and the passed command line arguments (args). The eval_config method was implemented to move this logic to a single place, thus reducing the likelihood that sometime in the future an error will be made here due to prior code repetition.
* move print_diff and copy_to_clipboard functions to utils namespace * read hash algorithm from command line or config file Note: I first thought about a string to class instance conversion in order to pass the algorithm parameter to the checksum compute function, but using a globals lookup was ugly, hence the str_to_hash_algorithm function. I don't really like it, so perhaps it's better to change the signature of the compute function to a string in future? Though this switch case would still end up there, one way or the other...
Note: The default configured server (https://pixeldrain.com) is pretty quick with blocking bots after downloading the same file a few times |
StefanGreve
force-pushed
the
47_CliExtension
branch
from
October 18, 2023 19:20
6fc5feb
to
27f97da
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dependencies
Changes related to dependency management
documentation
Improvements or additions to documentation
enhancement
Improve an existing feature
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.
Description
This feature request serves as a collection of small TODOs related to the anonpy CLI.
Requirements
add a --checksum flag for switching between MD5, SHA1 or SHA256add a --provider flag for setting the target server, by using built-in providers implemented in the providers namespace--algorithm
flag to the CLI and settings fileRemarks
The following changes were made to the original specification:
--provider
flag, use theanonpy.ini
file for configuring the requested API--checksum
flag for passing the expected checksum