-
Notifications
You must be signed in to change notification settings - Fork 18
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
Refactor project #24
Refactor project #24
Conversation
1. Delete everything and use `poetry` to rebuild the project structure, manage dependencies and handle development commands
1. Provide a handler to manage session cookies and configure `requests.Session` to use them. 2. Plan and structure some sketches for other handlers and other components for the project.
1. Authentication handlers available: session cookies, access tokens, and ID tokens. - Automatically renew the credentials if required. - Store the credentials in the filesystem, and load them if available to avoid reauthentications. For the ID token handler, refresh the token until the max session lifetime is reached (10h) before asking for a manual reauthentication. - Set file permissions to `0600` - Provide tests to check the code's correctness. 2. Update the McM REST client to use the new authentication handlers. - Enable users to perform arbitrary requests to the same web service via the `request.Session` attribute available at `self.session`. - Update the tests to use the `pytest` syntax.
1. Logger: Set default level to INFO if the client class does not configure this. 2. Include headers for the non authenticated session. 3. Update session User-Agent header for McM. 4. isort imports. 5. Skip cookie tests if `auth-get-sso-cookie` is not available.
1. Reorder all the content under the `rest` package. 2. Change the project's name. 3. Remove the `fixtures` test module from the final bundle, instead configure `pytest` to include it into its `PYTHONPATH` when tests are executed. 4. Update README: Include instructions about how to build the package automatically with `pip`
1. Downgrade from Python 3.11 to Python 3.9 Python 3.9 is the main version for the alias `python3` in AlmaLinux 9 and `lxplus.cern.ch` nodes. Also, this decision is mainly based on the Python version available in `cms-sw` apptainer images for `el9`, using a different version will reduce chances to smoothly integrate this with some batch execution within McM web application.
1. Configure a session using `access_token` 2. Use decorators and class fixtures to check and skip tests based on the execution runtime environment, and avoid repeating `except` conditions across the test suite 3. Refactor parametrized tests in several functions regarding its authentication method. 4. Skip session cookie tests if no valid Kerberos ticket is available. 5. yield files in fixtures instead of using `os.remove` into tests.
1. Raise a `DeprecationWarning` if someone attempts to access mangled methods in the McM class. 2. Re-include examples about how to use the McM REST class to perform requests to McM. 3. Remove some dead code. 4. Change the logger prefix to `pdmv-http-client`. 5. Fix some grammar issues. 6. Format the code using `black` and `isort`.
Only one script is missing, create_chained_campaigns.py, I will reinclude it in another PR when it is finished as it will require more code to properly plug it in this new project. Also, I consider change_priority.py is not required anymore so I deleted it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just too much code to be reviewable, so let me just approve.
Related to: #23