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

doc/bettter document update and reset statepoint #444

Merged
merged 24 commits into from
Jan 23, 2021

Conversation

cbkerr
Copy link
Member

@cbkerr cbkerr commented Dec 23, 2020

Description

The docstrings for job.update_statepoint() and job.reset_statepoint() are confusing because they are too short and use the same words in the definition.

Here, I propose an update for them to be able to stand on their own.

I also linked them to the relevant part of signac docs (no intersphinx because the other link in the file didn't use it.)

Note: preview the changes live here: https://signac--444.org.readthedocs.build/projects/core/en/444/api.html#the-job-class

Motivation and Context

See a bigger write-up about the confusion here: glotzerlab/signac-docs#108

In an offline discussion with @vyasr last week, we also realized that the main documentation states that these functions change the job id while the docstrings do not. Here, I also propose we add that notice to the docstrings.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog and added all related issue and pull request numbers for future reference (if applicable). See example below.

@cbkerr cbkerr requested a review from vyasr December 23, 2020 17:39
@cbkerr cbkerr requested review from a team as code owners December 23, 2020 17:39
@cbkerr cbkerr requested review from Charlottez112 and removed request for a team December 23, 2020 17:39
@codecov
Copy link

codecov bot commented Dec 23, 2020

Codecov Report

Merging #444 (49c19c8) into master (8c7362a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #444   +/-   ##
=======================================
  Coverage   77.18%   77.18%           
=======================================
  Files          42       42           
  Lines        5768     5768           
  Branches     1129     1129           
=======================================
  Hits         4452     4452           
  Misses       1030     1030           
  Partials      286      286           
Impacted Files Coverage Δ
signac/contrib/collection.py 84.02% <ø> (ø)
signac/contrib/import_export.py 77.89% <ø> (ø)
signac/contrib/job.py 89.12% <ø> (ø)
signac/contrib/project.py 86.97% <ø> (ø)
signac/sync.py 82.32% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed99e25...915eacc. Read the comment docs.

Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @cbkerr! I agree these docs can be improved. I have a few suggestions for better clarity and usage of Sphinx features.

signac/contrib/job.py Outdated Show resolved Hide resolved

Change the job id if necessary.
For more, see
`Modifying the State Point <https://docs.signac.io/en/latest/jobs.html#modifying-the-state-point>`_.
Copy link
Member

Choose a reason for hiding this comment

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

This should use an intersphinx reference to _project-job-statepoint-modify.

See this guide: https://github.com/glotzerlab/signac-docs/wiki/How-to-cross-reference-links-between-package-docs-and-signac-docs-using-intersphinx

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll make a new issue to add intersphinx because none of the files use it yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

made #452 to involve newer contributors

signac/contrib/job.py Show resolved Hide resolved
signac/contrib/job.py Outdated Show resolved Hide resolved
signac/contrib/job.py Outdated Show resolved Hide resolved
@vyasr
Copy link
Contributor

vyasr commented Dec 29, 2020

@cbkerr feel free to ping me if you would like me to weigh in on any discussions, but I'll refrain from commenting too much otherwise since I think you've summarized (and expanded upon!) our discussion very nicely in glotzerlab/signac-docs#108 and here.

@cbkerr cbkerr requested a review from bdice December 30, 2020 19:15
Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

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

This is a good improvement. We need to make the same changes for Project.update_statepoint and Project.reset_statepoint. Those methods are deprecated but documentation improvements should still be applied. I would have preferred to start using intersphinx references in this PR rather than deferring that to #452, to set a good example for the future, but I understand if you wish to skip that for now.

@bdice bdice self-requested a review December 31, 2020 19:51
@cbkerr
Copy link
Member Author

cbkerr commented Jan 5, 2021

not ready to merge yet!

Copy link
Member Author

@cbkerr cbkerr left a comment

Choose a reason for hiding this comment

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

figuring out best way to address @Charlottez112's comment. One option is to add to the first sentence which is good for completeness.

Another could be adding a wholely new sentence.

@@ -1440,7 +1442,9 @@ def reset_statepoint(self, job, new_statepoint):
details="Use job.update_statepoint() instead.",
)
def update_statepoint(self, job, update, overwrite=False):
"""Update the state point of this job.
"""Change the state point of this job without affecting existing parameters.
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
"""Change the state point of this job without affecting existing parameters.
"""Change the state point of this job without affecting existing parameters while preserving job data.

Copy link
Contributor

Choose a reason for hiding this comment

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

There's another small issue here, which is that "without affecting existing parameters" is only true if overwrite=False, so that might be misleading.

Copy link
Member

@bdice bdice Jan 5, 2021

Choose a reason for hiding this comment

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

I agree with @vyasr that this suggestion is potentially misleading. The summary line of a docstring must be short. It doesn't have to fully explain the behavior or how various parameters affect its behavior - that's better to put in the description after the first line and the "Parameters" sections.

Copy link
Member Author

Choose a reason for hiding this comment

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

I made a separate sentence to address @Vyas's point. I left in "while preserving job data" in both to resolve my confusion and @Charlottez112 's suggestion

@@ -243,7 +248,12 @@ def _reset_sp(self, new_statepoint=None):
self.reset_statepoint(new_statepoint)

def update_statepoint(self, update, overwrite=False):
"""Update the state point of this job.
"""Change the state point of this job without affecting existing parameters.
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
"""Change the state point of this job without affecting existing parameters.
"""Change the state point of this job without affecting existing parameters while preserving job data.

Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

This PR is waiting on @cbkerr to make some additional wording changes.

@vyasr vyasr self-requested a review January 12, 2021 22:45
vyasr
vyasr previously requested changes Jan 12, 2021
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

This PR is waiting on @cbkerr to make some wording changes.

@bdice bdice added this to the v1.6.0 milestone Jan 22, 2021
@bdice bdice added the documentation Writing or editing documentation label Jan 22, 2021
@cbkerr cbkerr requested a review from bdice January 22, 2021 22:09
@cbkerr
Copy link
Member Author

cbkerr commented Jan 22, 2021

Some error from when I merged in the master branch on the windows build. Maybe from the recent CI changes?

WARNING: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error.
ERROR: Running ["C:\ProgramData\chocolatey\lib\python3\tools\python-3.8.1-amd64.exe" /quiet InstallAllUsers=1 PrependPath=1 TargetDir="C:\Python38" ] was not successful. Exit code was '1603'. Exit code indicates the following: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error..
  python3 may be able to be automatically uninstalled.
The install of python3 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\python3\tools\chocolateyInstall.ps1'.
 See log for details.```

@bdice
Copy link
Member

bdice commented Jan 22, 2021

Some error from when I merged in the master branch on the windows build. Maybe from the recent CI changes?

WARNING: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error.
ERROR: Running ["C:\ProgramData\chocolatey\lib\python3\tools\python-3.8.1-amd64.exe" /quiet InstallAllUsers=1 PrependPath=1 TargetDir="C:\Python38" ] was not successful. Exit code was '1603'. Exit code indicates the following: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error..
  python3 may be able to be automatically uninstalled.
The install of python3 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\python3\tools\chocolateyInstall.ps1'.
 See log for details.```

Ignore this, it's a random failure. It's been happening a fair amount in the last couple days for no apparent reason.

signac/contrib/job.py Outdated Show resolved Hide resolved
@bdice
Copy link
Member

bdice commented Jan 22, 2021

@cbkerr I fixed up some places where project.py and job.py didn't have the same docstring edits. You replied to a comment on one file, but made the changes in the other file (and not the place you commented). I also fixed all broken Sphinx references to error classes. I'll merge this once tests pass.

@bdice bdice enabled auto-merge (squash) January 22, 2021 22:48
@cbkerr
Copy link
Member Author

cbkerr commented Jan 23, 2021

I think my problem was that I made the changes before merging and didn't check when the merge just worked...

@bdice bdice disabled auto-merge January 23, 2021 21:17
@bdice bdice enabled auto-merge (squash) January 23, 2021 21:17
@bdice bdice merged commit ec58809 into master Jan 23, 2021
@bdice bdice deleted the doc/bettter-document-reset branch January 23, 2021 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Writing or editing documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants