Skip to content

Class inheritance and docstrings #131

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

Merged
merged 2 commits into from
Jun 4, 2023

Conversation

dmdunla
Copy link
Collaborator

@dmdunla dmdunla commented Jun 4, 2023

Fixing minor issues: all classes inheriting from object, copyright notice, more complete testing, removing random docstrings

…tice, more complete testing, removing random docstrings
@dmdunla dmdunla self-assigned this Jun 4, 2023
@dmdunla dmdunla linked an issue Jun 4, 2023 that may be closed by this pull request
@dmdunla dmdunla merged commit 33d3d3b into main Jun 4, 2023
@dmdunla dmdunla deleted the 130-have-all-classes-derive-from-object branch June 4, 2023 03:26
@ntjohnson1
Copy link
Collaborator

The random doc strings were intended to be module level doc strings that print out on help when importing the module but not the contained class. I never checked them.

Also in python3 object as a base is implied so I think we should probably go the other direction of removing object universally. https://docs.python.org/3/tutorial/classes.html and https://www.python.org/doc/newstyle/

I thought both of these were enforced by pylint but testing seems to have passed. As long as testing passes low priority.

@dmdunla
Copy link
Collaborator Author

dmdunla commented Jun 4, 2023

The non-explicit object inheritance caused problems with coveralls coverage. The file-level docstrings were repeated info, but we can put them back if there is interest. Not all classes had them so I was trying to be consistent.

@ntjohnson1
Copy link
Collaborator

Interesting. I wonder if that relates to coveralls backwards compatibility with python 2 still. No strong opinions on it since our current code layout is basically one module per tensor type implementation. Can revisit if we shuffle the code around post 2.0. I think our flat structure is mostly just to match the MATLAB version.

@dmdunla
Copy link
Collaborator Author

dmdunla commented Jun 5, 2023

@ntjohnson1 How do you view docs? Just trying to get some consensus before moving forward on trying to move towards consistency.

Also, I would be happy to revisit code structure after 2.0.

@ntjohnson1
Copy link
Collaborator

ntjohnson1 commented Jun 5, 2023

In decreasing frequency:

  • In the code
  • python command line when I am trying something out help(sptensor)
  • readthedocs

I just pulled your PR locally and ran pytest tests/ --cov=pyttb --cov-report=term-missing --packaging and pylint was upset for missing module doc strings on all these files. If we find them redundant or unnecessary we can disable that pylint rule. I am surprised you didn't hit this locally or in CI. Maybe my pylint is old and this has changed.
https://pylint.readthedocs.io/en/stable/user_guide/messages/convention/missing-module-docstring.html

I also got useless-object-inheritance for the introduced objects.

@ntjohnson1
Copy link
Collaborator

Note that the whole discussion here is part of the value of the linter. We can just defer to that. I've just been working on other pieces of pyttb. But if I can push to get complete coverage with that then its hopefully something we never need to think about again. I noticed here we weren't currently enforcing the partial pylint coverage I already added. So let me try to open a draft PR to clean things up and at least pin our progress.

@ntjohnson1 ntjohnson1 mentioned this pull request Jun 5, 2023
@dmdunla
Copy link
Collaborator Author

dmdunla commented Jun 5, 2023 via email

@ntjohnson1
Copy link
Collaborator

Yes we should probably investigate making our versioning a little stricter at some point. Note I opened this draft PR that basically reverted the object and module doc string changes then enforced the current state of our pylint #132 maybe lets continue discussing there. Note I acknowledge that coveralls works but it awkwardly shows some doc strings as not being covered which seems incorrect. This isn't high priority if we wanted to merge my change then figure out the coveralls integration as follow up

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.

Have all classes derive from object
2 participants