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

Rename root parameter to path. #758

Merged
merged 14 commits into from
May 14, 2022
Merged

Rename root parameter to path. #758

merged 14 commits into from
May 14, 2022

Conversation

bdice
Copy link
Member

@bdice bdice commented May 10, 2022

Description

See #757.

Motivation and Context

Resolves #757.

Checklist:

@bdice bdice requested review from a team as code owners May 10, 2022 14:45
@bdice bdice requested review from vyasr and syjlee and removed request for a team May 10, 2022 14:45
@bdice bdice changed the base branch from master to next May 10, 2022 14:48
@bdice bdice added this to the v2.0.0 milestone May 10, 2022
@bdice bdice self-assigned this May 10, 2022
signac/common/config.py Outdated Show resolved Hide resolved
Copy link
Member

@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.

There's still a bit of old terminology (like "job workspace") that needs to be fixed.

changelog.txt Outdated Show resolved Hide resolved
@@ -78,13 +78,13 @@ class Project:
A :class:`Project` may only be constructed in a directory that is already a
signac project, i.e. a directory in which :func:`~signac.init_project` has
already been run. If project discovery (searching upwards in the folder
hierarchy until a project root is discovered) is desired, users should
hierarchy until a project is discovered) is desired, users should
Copy link
Member

Choose a reason for hiding this comment

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

Can we say how a project is discovered? Like the presence of a signac.rc file?

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 would need to consult the implementation to refresh myself but I think it's defined by the existence of a .signac/config file (?). Either way, it may be better to write this definition in one place (not in every method/function docstring), and it's outside the scope of this PR which is focused on an API change.

Copy link
Member

Choose a reason for hiding this comment

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

signac/contrib/project.py Outdated Show resolved Hide resolved
@@ -1370,7 +1370,7 @@ def _read_cache(self):
def temporary_project(self, dir=None):
"""Context manager for the initialization of a temporary project.
The temporary project is by default created within the root project's
The temporary project is by default created within the parent project's
Copy link
Member

@cbkerr cbkerr May 12, 2022

Choose a reason for hiding this comment

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

"Parent project" doesn't sound the same as "root" in this context. To me, "parent" sounds like a higher level then the project. This could be confusing once we have nested projects

Copy link
Member Author

@bdice bdice May 12, 2022

Choose a reason for hiding this comment

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

Well... it is sort of a parent. The temporary project is created in a subdirectory of the project instance calling this. This is awkward almost any way I can think of writing it, since it's hard to explain the benefit of this implementation detail without describing specific filesystem hierarchies.

Copy link
Member

@cbkerr cbkerr May 12, 2022

Choose a reason for hiding this comment

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

Proposal to also rewrite the beginning of the docstring to be:

def temporary_project(self, dir=None): 
    ""Context manager that initializes a temporary project within the calling Project.

    The temporary project path defaults to that of the calling project workspace.

...

"""

I think this helps convey the relation better and uses more consistent terms.

btw - we should rename the argument from dir to path.

Copy link
Member Author

@bdice bdice May 13, 2022

Choose a reason for hiding this comment

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

This PR is focused on changing root to path, primarily in the get_project and init_project functions. A follow-up PR to address this would be appropriate.

I agree with your suggestions and I agree that the temporary project functionality and docs need a careful look before releasing 2.0. I just don't think this PR is the right place to iterate on that.

Comment on lines +1456 to +1458
the specified directory, otherwise only return projects with
a directory whose path is identical to the specified path
argument (Default value = True).
Copy link
Member

@cbkerr cbkerr May 12, 2022

Choose a reason for hiding this comment

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

I would like to see the updated signac-docs page on what a project is now. See my other comment about whether a project "has" a path.
(not blocking, but for curiosity and to start explaining to users)

signac/contrib/project.py Outdated Show resolved Hide resolved
tests/test_project.py Outdated Show resolved Hide resolved
@bdice bdice requested a review from cbkerr May 12, 2022 22:49
Copy link
Member

@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.

Check 2 rewordings in this commit: 74d7f78
plus this comment: #758 (comment)

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

bdice commented May 13, 2022

I'm not sure if 74d7f78 is quite accurate. If signac.get_job() is called from a subdirectory of a job directory, e.g. my_project/workspace/4abbdfd8bbd68bb88e726bb8978ffa14/asdf/, signac.get_job() will return the job from 4abbdf....

Perhaps it should say something like:
The path from which to search. The first job found in or above this path is returned.

Copy link
Member

@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.

Thanks for bearing with me!
Notes for future PRs:

  1. Functionality and description of Project.temporary_project
  2. Review docstrings for consistent terminology.

Copy link

@syjlee syjlee left a comment

Choose a reason for hiding this comment

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

Looks good to me. It reminds me of where's waldo

@bdice bdice merged commit ea3b4df into next May 14, 2022
@bdice bdice deleted the root-to-path branch May 14, 2022 01:46
bdice added a commit that referenced this pull request Jun 14, 2022
* Change root to path.

* Update tests to use path instead of root.

* Update benchmarks to use path instead of root.

* Update changelog.

* Update changelog.txt

Co-authored-by: Corwin Kerr <[email protected]>

* Update signac/contrib/project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Update tests/test_project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Remove use of root.

* Refactor docs for fn/isfile methods.

* Bradley check these rewordings

* Replace outdated job workspace directory

* One more outdated job workspace directory

* Apply minor changes

* Describe path argument searching

Co-authored-by: Corwin Kerr <[email protected]>
bdice added a commit that referenced this pull request Aug 1, 2022
* Change root to path.

* Update tests to use path instead of root.

* Update benchmarks to use path instead of root.

* Update changelog.

* Update changelog.txt

Co-authored-by: Corwin Kerr <[email protected]>

* Update signac/contrib/project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Update tests/test_project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Remove use of root.

* Refactor docs for fn/isfile methods.

* Bradley check these rewordings

* Replace outdated job workspace directory

* One more outdated job workspace directory

* Apply minor changes

* Describe path argument searching

Co-authored-by: Corwin Kerr <[email protected]>
bdice added a commit that referenced this pull request Oct 7, 2022
* Change root to path.

* Update tests to use path instead of root.

* Update benchmarks to use path instead of root.

* Update changelog.

* Update changelog.txt

Co-authored-by: Corwin Kerr <[email protected]>

* Update signac/contrib/project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Update tests/test_project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Remove use of root.

* Refactor docs for fn/isfile methods.

* Bradley check these rewordings

* Replace outdated job workspace directory

* One more outdated job workspace directory

* Apply minor changes

* Describe path argument searching

Co-authored-by: Corwin Kerr <[email protected]>
bdice added a commit that referenced this pull request Oct 27, 2022
* Change root to path.

* Update tests to use path instead of root.

* Update benchmarks to use path instead of root.

* Update changelog.

* Update changelog.txt

Co-authored-by: Corwin Kerr <[email protected]>

* Update signac/contrib/project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Update tests/test_project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Remove use of root.

* Refactor docs for fn/isfile methods.

* Bradley check these rewordings

* Replace outdated job workspace directory

* One more outdated job workspace directory

* Apply minor changes

* Describe path argument searching

Co-authored-by: Corwin Kerr <[email protected]>
vyasr pushed a commit that referenced this pull request Oct 30, 2022
* Change root to path.

* Update tests to use path instead of root.

* Update benchmarks to use path instead of root.

* Update changelog.

* Update changelog.txt

Co-authored-by: Corwin Kerr <[email protected]>

* Update signac/contrib/project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Update tests/test_project.py

Co-authored-by: Corwin Kerr <[email protected]>

* Remove use of root.

* Refactor docs for fn/isfile methods.

* Bradley check these rewordings

* Replace outdated job workspace directory

* One more outdated job workspace directory

* Apply minor changes

* Describe path argument searching

Co-authored-by: Corwin Kerr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename root parameter for all Project methods to path
3 participants