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

Fixing jobs UnknownElement warning #332

Merged
merged 2 commits into from
Jun 1, 2022
Merged

Conversation

msdemlei
Copy link
Contributor

This is an alternative to PR #331 to avoid the lone JobList class.

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #332 (d23ccf0) into main (fb6a5af) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #332   +/-   ##
=======================================
  Coverage   75.52%   75.53%           
=======================================
  Files          44       44           
  Lines        5131     5137    +6     
=======================================
+ Hits         3875     3880    +5     
- Misses       1256     1257    +1     
Impacted Files Coverage Δ
pyvo/io/uws/__init__.py 100.00% <100.00%> (ø)
pyvo/io/uws/endpoint.py 100.00% <100.00%> (ø)
pyvo/io/uws/tree.py 93.19% <100.00%> (+0.14%) ⬆️
pyvo/utils/xml/elements.py 92.92% <0.00%> (-0.51%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Contributor

@andamian andamian left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks

__all__ = ['parse_job', 'parse_job_list', 'JobFile', 'JobList']
__all__ = ['parse_job', 'parse_job_list', 'JobFile', 'Jobs']
Copy link
Member

@bsipocz bsipocz May 31, 2022

Choose a reason for hiding this comment

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

Technically this is a public API change, and as such, it requires deprecation for the rename.

However, for some reasons, it's never ended up in public API docs, it was never added into the __all__ of its actual namespace.

So, overall I think it's OK to make this change without deprecation, BUT do list Jobs in the API here only if you also add it to __all__ in tree.py, otherwise the situation about the public API intent stays somewhat confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. I don't think about it because I thought that JobList/Jobs is not meant to be part of the API as parse_job_list is and this function returns just the list of jobs and not the container class. To be technically correct it's probably simpler keep the JobList name but I agree that it needs to be added to the __all__ in tree.py.

Copy link
Member

Choose a reason for hiding this comment

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

It's OK not being in the public API, but then remove from the __all__ in this file. I'm just basically advocating for consistency (and pretty sure that some tools should be out there that would warn about this undefined Jobs/Joblists here, in fact surprised that it didn't generate a sphinx warning).

Copy link
Contributor

Choose a reason for hiding this comment

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

Another solution could be to rename it but make JobList point to Jobs in case someone is using it by that name.

Copy link
Member

Choose a reason for hiding this comment

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

The naming of things is one thing, normally you would need a rename deprecation. But this was a bug all along, so I think we don't need it here.

However, whether deprecating or not, it still doesn't solve the issue with the namespace, Jobs is listed in __all__, yet it's not importable.

In [1]: from pyvo.io.uws import Jobs
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-c5ca393952e0> in <module>
----> 1 from pyvo.io.uws import Jobs

ImportError: cannot import name 'Jobs' from 'pyvo.io.uws' (/Users/bsipocz/munka/devel/pyvo/pyvo/io/uws/__init__.py)

@msdemlei
Copy link
Contributor Author

msdemlei commented Jun 1, 2022 via email

Copy link
Contributor

@tomdonaldson tomdonaldson left a comment

Choose a reason for hiding this comment

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

Thanks @msdemlei , this look good to me.

@tomdonaldson tomdonaldson merged commit 6a4409a into astropy:main Jun 1, 2022
@bsipocz bsipocz added this to the v1.4 milestone Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants