Skip to content

feat(core): handle local modules without __init__.py#285

Merged
mkniewallner merged 1 commit intofpgmaas:mainfrom
mkniewallner:feat/handle-local-modules-without-init
Apr 23, 2023
Merged

feat(core): handle local modules without __init__.py#285
mkniewallner merged 1 commit intofpgmaas:mainfrom
mkniewallner:feat/handle-local-modules-without-init

Conversation

@mkniewallner
Copy link
Collaborator

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Description of changes

Since PEP 420, it is not required for Python modules to have an __init__.py to be considered a Python module.
We also today only consider directories and not Python files.

This PR handles this case by relaxing _get_local_modules method to account for 2 things:

  • Directories that don't contain any __init__.py, by checking for any Python file
  • Files that are Python files (end up with .py extension)

Tests have been updated to reflect what this implies for projects using an src directory structure.

@codecov
Copy link

codecov bot commented Jan 29, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@3c61806). Click here to learn what that means.
The diff coverage is 100.0%.

❗ Current head eeda478 differs from pull request most recent head f7cc6ca. Consider uploading reports for the commit f7cc6ca to get more accurate results

@@          Coverage Diff           @@
##             main    #285   +/-   ##
======================================
  Coverage        ?   95.6%           
======================================
  Files           ?      29           
  Lines           ?     928           
  Branches        ?     186           
======================================
  Hits            ?     888           
  Misses          ?      27           
  Partials        ?      13           
Impacted Files Coverage Δ
deptry/core.py 98.0% <100.0%> (ø)

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

@mkniewallner mkniewallner force-pushed the feat/handle-local-modules-without-init branch from 9461120 to eeda478 Compare January 29, 2023 15:28
@mkniewallner mkniewallner marked this pull request as ready for review January 29, 2023 15:31
@mkniewallner mkniewallner requested a review from fpgmaas January 29, 2023 15:35
@mkniewallner mkniewallner force-pushed the feat/handle-local-modules-without-init branch from 4ea7cdd to f7cc6ca Compare April 23, 2023 10:03
@mkniewallner mkniewallner merged commit 2471494 into fpgmaas:main Apr 23, 2023
@mkniewallner mkniewallner deleted the feat/handle-local-modules-without-init branch April 23, 2023 10:05
@mkniewallner mkniewallner mentioned this pull request May 5, 2023
@mkniewallner mkniewallner added this to the 0.9 milestone May 5, 2023
@mkniewallner mkniewallner added the breaking Change that introduces a breaking change label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Change that introduces a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants