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

Black formatting of existing code and inclusion of formatting check in workflow #78

Merged
merged 7 commits into from
Mar 14, 2022

Conversation

JuliaKukulies
Copy link
Member

No description provided.

@w-k-jones w-k-jones self-requested a review February 25, 2022 20:33
iris
cf-units
xarray
cf - units
Copy link
Member

Choose a reason for hiding this comment

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

Is this the autoformatting making these changes? Might have to restrict it from these files (i.e. non-python files) as I think this would break them

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, I fixed this!

@freemansw1
Copy link
Member

I think we should merge this into dev rather than main. Also, I'm confused as to why the docker check hasn't run yet...

@w-k-jones w-k-jones changed the base branch from main to dev March 4, 2022 14:57
@w-k-jones
Copy link
Member

Just changed the base to dev, thought that that might run the docker checks but it doesn't seem to

@w-k-jones w-k-jones added this to the Version 1.3 milestone Mar 4, 2022
@freemansw1
Copy link
Member

My guess is that the issue is that docker-image.yml specifies the branches to run it on and still calls main master. I've gone ahead and just removed the branch list, so it should work once @JuliaKukulies pulls the changes into her repo (it should rerun the actions).

get changed docker image file
@JuliaKukulies
Copy link
Member Author

Great, seems to work now @freemansw1 !

@freemansw1
Copy link
Member

Now that it's passing the CI checks, I'm happy for this to be merged, but I'll let @w-k-jones as it's his review.

@fsenf
Copy link
Member

fsenf commented Mar 11, 2022

Hi, I was just about to merge the PR, but then did the black reformatting by myself to be really on the safe side. Interestingly, I don't get exactly the same results. In my case, some more spaces have been added, e.g.

> git diff fabians-PRcheck..juliasPR 
...

 def calculate_cog_untracked(mass, mask):
-    """ caluclate centre of gravity and mass for untracked parts of domain
+    """caluclate centre of gravity and mass for untracked parts of domain
     Input:
-    mass:       iris.cube.Cube 
+    mass:       iris.cube.Cube
...

Any idea what happend?

@fsenf
Copy link
Member

fsenf commented Mar 11, 2022

And yes, I was running black via:

> for py in `find -iname '*.py'`; do echo $py; black $py;done

using

> conda list black
# packages in environment at /home/senf/.miniconda3:
#
# Name                    Version                   Build  Channel
black                     19.10b0                  py37_0    conda-forge

on my linux OS

@fsenf
Copy link
Member

fsenf commented Mar 11, 2022

@sean , @w-k-jones & @JuliaKukulies : If you don't think that these super-small differences matter, please press the merge button and step forward!

@JuliaKukulies
Copy link
Member Author

JuliaKukulies commented Mar 11, 2022

Hmm..that is interesting. I used black 22.1.0. I tried to see if the same thing happens, when I use the same version as you:

> conda list black 
# packages in environment at /home/juli/anaconda3/envs/blacktest:
#
# Name                    Version                   Build  Channel
black                     19.10b0                  py37_0    conda-forge

but all files remain unchanged.

These are really small differences, but on the other hand the idea with black is to have everything exactly consistent. If you go down the rabbit hole of formatting (section "empty lines"), I think it is against PEP-8 to have empty lines directly after the function definition, since you already have an indentation. Do you pass the formatting check when you push your changes?

@w-k-jones
Copy link
Member

Hi, I was just about to merge the PR, but then did the black reformatting by myself to be really on the safe side. Interestingly, I don't get exactly the same results. In my case, some more spaces have been added, e.g.

> git diff fabians-PRcheck..juliasPR 
...

 def calculate_cog_untracked(mass, mask):
-    """ caluclate centre of gravity and mass for untracked parts of domain
+    """caluclate centre of gravity and mass for untracked parts of domain
     Input:
-    mass:       iris.cube.Cube 
+    mass:       iris.cube.Cube
...

Any idea what happend?

Not sure why your black formatting has included the extra spaces, however I believe that the PR is formatting correctly (without spaces) so I'm happy to merge if there are no other exceptions

@fsenf
Copy link
Member

fsenf commented Mar 14, 2022

OK, as a last check: My black version on my OS leaves all files in @JuliaKukulies PR unchanged, so we won't have any circular PRs in future ... Let's go forward ...

@fsenf fsenf merged commit a1d9132 into tobac-project:dev Mar 14, 2022
@w-k-jones w-k-jones added the enhancement Addition of new features, or improved functionality of existing features label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Addition of new features, or improved functionality of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants