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

PyOpenSci REVIEW - Refactor code to meet PEP8 #40

Merged
merged 6 commits into from
Jan 17, 2023

Conversation

Robaina
Copy link
Owner

@Robaina Robaina commented Jan 17, 2023

PR addressing reviewer (@Batalex) comments in PyOpenSci:

  • I would encourage the author to follow the stylistic style guide defined by the PEP8. The most immediate benefit this would provide to the code base is consistency with the rest of the Python ecosystem and a lower entry bar for potential contributors. Two easy fixes to apply in this code base are:

    • Using a code formater such as black.
    • Using snake_case to name functions and methods rather than camelCase
  • Another suggestion would be to use a .editorconfig file. There again, this is a simple way to enforce consistency in the code base by defining a few options to control the files’ format. This is especially true for Python projects since mixing tabs and spaces would crash the program. There are other benefits as well, e.g., removing trailing spaces and adding new lines at the end of files.

This may be useful if contributions to Pynteny grow with time.

  • There are a few discrepancies in types, some of them could be fixed by converting argparse.ArgumentParser instances to CommandArgs before using them

Right. I wrote class CommandArgs to be able to re-use subcommands defined in module pynteny/subcommands.py when calling pynteny as a module rather than from its CLI. So, in effect, subcommands take as arguments objects of class either argparse.ArgumentParser or CommandArgs. It works because both contain the same required attributes. I see this is a working but not elegant solution. I could indeed instantiate CommandArgs from argparse.ArgumentParser before calling each subcommand from the CLI.

  • Empty parentheses in class definitions without inheritance are not necessary.

Taken care of.

@Robaina Robaina linked an issue Jan 17, 2023 that may be closed by this pull request
@Robaina Robaina closed this Jan 17, 2023
@Robaina Robaina reopened this Jan 17, 2023
@Robaina Robaina closed this Jan 17, 2023
@Robaina Robaina reopened this Jan 17, 2023
@Robaina Robaina closed this Jan 17, 2023
@Robaina Robaina reopened this Jan 17, 2023
@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Base: 73.66% // Head: 73.66% // No change to project coverage 👍

Coverage data is based on head (f1d0679) compared to base (120c647).
Patch coverage: 73.17% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #40   +/-   ##
=======================================
  Coverage   73.66%   73.66%           
=======================================
  Files          11       11           
  Lines         767      767           
=======================================
  Hits          565      565           
  Misses        202      202           
Impacted Files Coverage Δ
pynteny/api.py 71.05% <60.00%> (ø)
pynteny/preprocessing.py 70.00% <61.29%> (ø)
pynteny/hmm.py 62.62% <70.37%> (ø)
pynteny/filter.py 73.26% <75.00%> (ø)
tests/test_preprocessing.py 93.75% <75.00%> (ø)
tests/test_parser.py 95.23% <85.71%> (ø)
pynteny/parser.py 73.04% <88.57%> (ø)
pynteny/__init__.py 100.00% <100.00%> (ø)
tests/test_hmm.py 94.11% <100.00%> (ø)
tests/test_integration_search.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Robaina Robaina merged commit 020ae84 into main Jan 17, 2023
@Robaina Robaina deleted the 39-refactor-code-to-meet-pep8 branch January 17, 2023 16:06
@Robaina Robaina self-assigned this Jan 17, 2023
@Robaina Robaina added the refactor refactor code label Jan 17, 2023
@Robaina Robaina changed the title Refactor code to meet PEP8 PyOpenSci REVIEW - Refactor code to meet PEP8 Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor code to meet PEP8
1 participant