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

chore(python): run blacken session for all directories with a noxfile #1276

Merged
merged 2 commits into from
Nov 11, 2021

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Nov 7, 2021

Many python repositories have a separate noxfile.py file in the samples directory. This PR modifies owlbot_main() for python to run the blacken nox session on all directories that contain a noxfile.py rather than only the root of the repository.

I tested the changes using the following commands after cloning synthtool

git checkout run-blacken-session-for-all-dirs
docker build -f docker/owlbot/python/Dockerfile -t runblackenonsamples . 

Once the docker image was built, I ran the following commands in the root of python-apigee-connect which has no samples and python-secret-manager which has samples. I've confirmed that the blacken session runs on all directories that have noxfile.py.

docker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo runblackenonsamples

@parthea parthea requested a review from a team November 7, 2021 10:12
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 7, 2021
@parthea
Copy link
Contributor Author

parthea commented Nov 9, 2021

@busunkim96, Please could you review/approve?

Copy link
Contributor

@busunkim96 busunkim96 left a comment

Choose a reason for hiding this comment

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

I think this will fail in google-auth because it has a noxfile.py with no blacken. Is there a way to opt out for that repo?

https://github.com/googleapis/google-auth-library-python/blob/main/system_tests/noxfile.py

@parthea
Copy link
Contributor Author

parthea commented Nov 9, 2021

@busunkim96 Good find! I think it won't be an issue as the change is in owlbot_main(). This will only affect repos that don't have an owlbot.py. See
https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py#L153

@parthea parthea merged commit bc0de6e into master Nov 11, 2021
@parthea parthea deleted the run-blacken-session-for-all-dirs branch November 11, 2021 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants