Repository navigation
Change traceback as suggested to improve error message in Bio.Align - #2007
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2007 +/- ##
==========================================
- Coverage 85.07% 85.07% -0.01%
==========================================
Files 312 312
Lines 50161 50161
==========================================
- Hits 42673 42672 -1
- Misses 7488 7489 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #2007 +/- ##
==========================================
- Coverage 85.07% 84.92% -0.15%
==========================================
Files 312 315 +3
Lines 50161 50547 +386
==========================================
+ Hits 42673 42929 +256
- Misses 7488 7618 +130
Continue to review full report at Codecov.
|
|
I implemented the suggestion to parse I feel this is sufficient, or should checks for |
|
Looking at this fresh, the warning code will be in
On reflection, I think probably just issue the warning if |
|
I would suggest to parse _parent_dir = os.path.dirname(os.path.dirname(__file__))
path = os.path.join(_parent_dir, "PKG-INFO")
if os.path.exists(path):
from email.parser import Parser
contents = Parser().parse(open(path))
if contents['Name'] == 'biopython':
# issue a warning |
|
Thanks mdehoon, but what confuses me is the location of source: and: |
|
I have two alternative suggestions, which are easy to check and should decrease the overhead:
|
|
I like Markus's ideas. If 2. is possible then it might be cleaner to create a new boolean variable like |
|
@chris-rands I meant the @MarkusPiotrowski I believe the |
|
The Note that |
|
I'm not keen on idea 2 as written - we want our version number to be valid both for official releases and installations from git - including installing in developer mode ( Are there practical problems with just checking for |
|
I'm okay with your suggestion Peter, but one last suggestion: Could we implement what They create a file (called Source: |
|
|
||
| # biopython setup.py file present in parent directory | ||
| warnings.warn("You may be importing Bio/ from inside the source tree." | ||
| " This is bad practise and might lead to downstream issues." |
|
@chris-rands copying what NumPy does is a lot more attractive than rolling our own 'hack', but I'm not convinced we need this complexity. Shall we try the |
|
@peterjc Ok sure, should we check only for the existence of |
|
As per #2007 (comment) I think just issue the warning if @MarkusPiotrowski @mdehoon - your thoughts? |
|
Agree that just looking for |
|
I think it's OK to just check for the presence of setup.py. |
|
It seems everyone is satisfied- @peterjc i updated the PR- let me know if anything else is needed before proceeding with merging thanks |
|
Excellent - This PR took more discussion than usual, but I think that was wise given the potential impact of this change at the top level import. Thank you all. |
|
Just for completeness, some timings importing from outside the source tree: on original branch without warning: on the new branch with warning: Perhaps someone else would like to run the same tests to be sure, but the overhead of checking for I suggest to close #1991 |
|
There likely is going to be caching at the file system level, but it looks like anyone doing lots of small Biopython jobs (i.e. calling a short script many times - the worst case I would think) won't seem much if any impact. So that's good. Thank you! |
Also changes traceback in Bio.Align etc when C imports fail.
Closes biopython#2318, cross reference biopython#1991 and biopython#2007
This pull request addresses issue #1991
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile and understand that AppVeyor andTravisCI will be used to confirm the Biopython unit tests and
flake8stylechecks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)