Comments (10)
I have been using the following sed
commands to drop the big majority of py2 compatibility code:
find . -type f -not -path './.git*' -exec sed -i '/from __future__.*$/d' {} +
find . -type f -not -path './.git*' -exec sed -i 's/(object):/:/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/super([^)]*,[^)]*)/super()/g' {} +
find . -type f -not -path './.git*' -exec sed -i '/\(import six\|from six\).*$/d' {} +
find . -type f -not -path './.git*' -exec sed -i '/\(six\.add_metaclass\).*$/d' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.integer_types/int/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.string_types/str/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.text_type/str/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.binary_type/bytes/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.moves.StringIO/io.StringIO/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.StringIO/io.StringIO/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.moves.BytesIO/io.BytesIO/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.BytesIO/io.BytesIO/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's/six.moves.range/range/g' {} +
find . -type f -not -path './.git*' -exec sed -i 's|six.iterkeys(\([^)]*\))|\1.keys()|' {} +
find . -type f -not -path './.git*' -exec sed -i 's|six.iteritems(\([^)]*\))|\1.items()|' {} +
find . -type f -not -path './.git*' -exec sed -i 's|six.itervalues(\([^)]*\))|\1.values()|' {} +
from qe-tools.
Agreed. Let's go with the string variant only then!
from qe-tools.
I think it's ok to make a version dropping py2 support.
I won't have much time, if you want to work on it (I don't think there is too much work) and make a PR, that would be great!
As I mentioned earlier, I would use the excuse to release a new major release, fixing a thing that is bugging me, i.e. the interface of the __init__
of the parser:
qe-tools/qe_tools/parsers/qeinputparser.py
Lines 149 to 155 in c9eac45
In particular I find it confusing that if the string is a valid abs path, it is interpreted as the file name, otherwise as the content (and e.g. if I pass a relative path, the second route is taken).
I would suggest that if it is a string, it's the file content, otherwise if it's a file-like object, it should be already open, and the function just calls .open()? Or we just go with the file content as a string (it's the input of QE, so it should never be huge)?
from qe-tools.
Re: the the __init__
interface:
I'm all in favour of making that interface a bit more consistent. To be honest, I'm not even sure all these different cases need to be handled here - I would also be fine with an interface that only takes the string variant, for example.
The steps needed to convert it (e.g. open()
and .read()
, or ''.join(..)
) are so simple that I'd be tempted to say this can go in the calling code.
from qe-tools.
Thanks @greschd !
Should we move the discussion of the init in a different thread, or you are going to make a PR for that as well soon?
Also, can you already upgrade the version number to a new major version when this is done, so we don't forget? Maybe an alpha 1 version?
from qe-tools.
We can keep it here, since we've already come to a conclusion.
Do you mind if I also fiddle around with the scaffolding (tests, pre-commit, etc.) a bit?
from qe-tools.
You are more than welcome!!
from qe-tools.
BTW, I approved #33, feel free to merge - and feel free to make any scaffolding changes or other that you want.
Also, once this will be ready, I'm happy to give you access to pypi if you want to be able to make releases
from qe-tools.
Also, once this will be ready, I'm happy to give you access to pypi if you want to be able to make releases
Thanks! My PyPI username is greschd
, same as on GitHub.
Since we're slightly breaking backwards compatibility with the next release, is there any other downstream code (that you're aware of) other than aiida-quantumespresso
?
from qe-tools.
Added you on Pypi as maintainer!
There is tools-barebone that I am updating these days, and seekpath (that I am converting to tools-barebone, so it does not matter so much). Not sure about others (but if we make a major release, we should be OK).
from qe-tools.
Related Issues (20)
- Exponentially-slow regex HOT 2
- Problem when encountering comments HOT 1
- dictionary problem with k_points
- Slight inconsistencies in physical constants HOT 9
- Wrong alat used if ibrav != 0 HOT 1
- Missing 'valid_ibrav' values in get_cell_from_parameters HOT 4
- ibrav -13 is incorrect HOT 3
- Clearly define public vs. private interface HOT 8
- Structure of Qe/Pw/CpInputFile HOT 5
- Add (minimal) documentation build
- Check and update docstrings
- Add README as long_description in setup.py
- When set qetools as the parser for qeinputgenerator, the generated input file for pwscf always use this setting: calculation = 'scf'. HOT 5
- Update or pin pytest-cases
- Parsing PW input file HOT 4
- Empty line after ATOMIC_SPECIES makes the parser fail HOT 1
- Move CI from Travis to GHA
- Drop Python 3.5 compatibility, add Python 3.9 to test matrix
- Constructing cell from parameters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qe-tools.