Closed snoyer closed 11 months ago
Merging #408 (28eb532) into master (bc05b6b) will increase coverage by
0.05%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #408 +/- ##
==========================================
+ Coverage 88.55% 88.60% +0.05%
==========================================
Files 19 19
Lines 1546 1553 +7
Branches 187 189 +2
==========================================
+ Hits 1369 1376 +7
Misses 143 143
Partials 34 34
Files Changed | Coverage Δ | |
---|---|---|
cq_editor/widgets/debugger.py | 81.73% <100.00%> (+0.57%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
LGTM, is it ready?
BTW: you might be also interested in Add script dir to path
option - there is not need to use __file__
explicitly.
LGTM, is it ready?
it works for me :D but that doesn't mean much, does it? I'll defer to you for the final verdict.
BTW: you might be also interested in
Add script dir to path
option - there is not need to use__file__
explicitly.
Does that add to the search path for python imports? if so I believe that'd be a different use case...
__file__
would be used for:
my basic use case goes something like:
# import input file sitting "next to" the .py file
drawing = import_dxf(Path(__file__).parent / 'drawing.dxf')
# work it
result = do_cq_stuff(drawing)
if __name__ == '__main__':
# write to disk if running standalone
export_stl(result, '/somwhere/somehow/result.stl')
elif __name__ == '__cq_main__':
# visualize if running in editor
show_object(result)
Thanks for the contribution @snoyer !
Setting the
__file__
variable when running from a file would allow to locate files relative to the current script (eg.import(Path(__file__).parent / "foo.bar")
).