Skip to content
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

Lock O365 to Python 3.7 compatible version #980

Merged
merged 4 commits into from
Jun 7, 2023

Conversation

kylie-bee
Copy link
Contributor

v2.0.27 of O365 includes a f-string that is not compatible with Python 3.7

v2.0.27 of O365 includes a f-string that is not compatible with Python 3.7
@kylie-bee kylie-bee self-assigned this Jun 2, 2023
@kylie-bee kylie-bee added bug Bad or unexpected behaviour dependency PR: Update a dependency file labels Jun 2, 2023
@kylie-bee
Copy link
Contributor Author

I saw that a fix was done but it simply excluded v2.0.27 but if they bump the version to v2.0.28, won't it pull that in? I believe this dependency version statement will exclude all future versions. Correct me if I am wrong.

@cmin764 cmin764 linked an issue Jun 6, 2023 that may be closed by this pull request
Copy link
Contributor

@cmin764 cmin764 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! And luckily, you'd have to release main only, as the lock-files of all the other sub-packages aren't affecting the final published package. (as for quite some time, we ship within that the pyproject.toml file instead of a setup.py/cfg script)

Comment on lines +73 to +74
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch for the alignment!

@cmin764
Copy link
Contributor

cmin764 commented Jun 6, 2023

Side-challenge: Do you know any way of outputting the failed test(s) when running in async (-a) mode? (this will aid a LOT the DX)

@kylie-bee
Copy link
Contributor Author

@cmin764 the underlying async behavior is provided by invoke. I'm copying the associated API documentation here for discussion because as far as I can tell, it should be getting joined to std out.

Connections to the controlling terminal are disabled, meaning you will not see the subprocess output and it will not respond to your keyboard input - similar to hide=True and in_stream=False (though explicitly given (out|err|in)_stream file-like objects will still be honored as normal).

run returns immediately after starting the subprocess, and its return value becomes an instance of Promise instead of Result.

Promise objects are primarily useful for their join method, which blocks until the subprocess exits (similar to threading APIs) and either returns a final Result or raises an exception, just as a synchronous run would.

As with threading and similar APIs, users of asynchronous=True should make sure to join their Promise objects to prevent issues with interpreter shutdown.

One easy way to handle such cleanup is to use the Promise as a context manager - it will automatically join at the exit of the context block.

And the result object's documentation describes how the streams are returned:

A container for information about the result of a command execution.

All params are exposed as attributes of the same name and type.

Parameters
stdout (str) – The subprocess’ standard output.

stderr (str) – Same as stdout but containing standard error (unless the process was invoked via a pty, in which case it will be empty; see Runner.run.)

encoding (str) – The string encoding used by the local shell environment.

command (str) – The command which was executed.

shell (str) – The shell binary used for execution.

env (dict) – The shell environment used for execution. (Default is the empty dict, {}, not None as displayed in the signature.)

exited (int) –

An integer representing the subprocess’ exit/return code.

Note
This may be None in situations where the subprocess did not run to completion, such as when auto-responding failed or a timeout was reached.

pty (bool) – A boolean describing whether the subprocess was invoked with a pty or not; see Runner.run.

hide (tuple) –

A tuple of stream names (none, one or both of ('stdout', 'stderr')) which were hidden from the user when the generating command executed; this is a normalized value derived from the hide parameter of Runner.run.

For example, run('command', hide='stdout') will yield a Result where result.hide == ('stdout',); hide=True or hide='both' results in result.hide == ('stdout', 'stderr'); and hide=False (the default) generates result.hide == () (the empty tuple.)

And finally, our code joins those promises and prints both streams:

    for test, result in results.items():
        if color:
            result_header = Fore.BLUE + f"Results from {test} tests:"
            result_msg = Style.RESET_ALL + remove_blank_lines(result.stdout)
        else:
            result_header = f"*** Results from {test} tests:"
            result_msg = remove_blank_lines(result.stdout)
        print(result_header)
        print(result_msg)
        if hasattr(result, "stderr"):
            print(remove_blank_lines(result.stderr))
        print(os.linesep)

@kylie-bee kylie-bee merged commit 392984c into master Jun 7, 2023
103 checks passed
@kylie-bee kylie-bee deleted the hotfix/lock-o365-dependency branch June 7, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bad or unexpected behaviour dependency PR: Update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cryptography dependency causes SNYK alert - upgrade to newer version
2 participants