Comments (10)
The code is in the Google Python style, which is basically pep8 with 2 space indents and CapWords for function and method names. All the contributions will have to be in that style going forward, at least until the point where there's a significant amount of code not coming from me.
I changed this bug to be to set up auto-formatting. I have experimented with yapf but didn't apply it to all the code yet. I do want there to be a consistent style and for contributors to not have to worry about reformatting their code.
When the C++ code lands it will use clang-format as well.
from oil.
Now running flake8, thanks @cclauss. It doesn't auto-format but it catches significant errors.
I'm still somewhat interested in yapf, but it's not a big priority.
from oil.
@andychu Hiya, I looked around for an Emacs mode for Google's python style, and couldn't find one anywhere. This seems to be the canonical source: https://github.com/google/styleguide
Based on that, it looks like Google doesn't use 2-space indentation for python anymore -- so they recommend using the default Emacs python mode style now. I don't know if that's enough reason to change the oilshell project style.
Assuming it's not, are you aware offhand of any Emacs mode files floating around for Google's old python style?
from oil.
Sorry I'm not sure, I'm a vim user :-)
I will say that I accept any PR that passes tests :) The functionality is the more important part.
I may go back and update the style with subsequent commits. Or if there are consistent contributors then we can automate things more.
Right now flake8 runs in Travis, and I keep it green. It could be made more strict in the future.
from oil.
Also this issue keeps getting closed because I type #1
in other contexts!
I'm reopening it although there a lot of other things that I think would benefit contributors more, e.g.
https://oilshell.zulipchat.com/#narrow/stream/121539-oil-dev/topic/Dev.20Dependencies.20Problem
from oil.
Ok, thanks, no worries. I just didn't want to make a mess once I figure out a good way to contribute, but I'm sure I'll manage.
from oil.
The Python Software Foundation is proposing the canonical way to format Python code and it is called black. It has integrations to Emacs, Vim, other editors. pre-commit hooks, and CI systems. Let's follow Google's lead for the formatting of Go code with gofmt but let's follow the PSF's lead for the formatting of Python code.
from oil.
test/lint.sh format-oil
does this for C++
from oil.
Oil bundles legacy Python which went end-of-life on 1/1/2020.
The black formatting tool for Python code will not run on Python 2.
from oil.
Black can be installed by running pip install black. It requires Python 3.6.0+ to run but you can reformat Python 2 code with it, too.
https://pypi.org/project/black/
In any case this is a moot point until people who have contributed patches want it . It could be black or something else they prefer
from oil.
Related Issues (20)
- Fatal error when closing stderr on a non-fatal error
- nixos defaultUserShell HOT 4
- `json read` unexpectedly parses `123\x00` HOT 8
- Sudo in dev builds isn't very necessary HOT 2
- duplicate error messages in redirects HOT 1
- segfault on MacOS - maybe related to case statement HOT 2
- executing blocks that contain return/break/continue/error is inconsistent with eval on strings HOT 1
- osh hangs after nano and sometimes other outputs HOT 3
- tool to print sourced files - dynamic tree shaking
- Hay: Code nodes containing blocks don't serialize code correctly HOT 4
- trap INT doesn't run on Ctrl-C
- Trap does not check for the first argument being an unsigned integer HOT 3
- can't Ctrl-C out of long operation (regex)
- osh pwd and ls disagree on current dir HOT 3
- Consider word expansion before arithmetic parsing, e.g. $(( $x * 3 )) HOT 1
- Bug with lseek() and descriptor 100 HOT 1
- declare -i is silently ignored HOT 8
- members of context managers are uninitialized and rooted HOT 1
- Crash with dict literal HOT 6
- install script may not match what distros want - Void Linux, stripped binary, binary location when cross-compiling, etc. HOT 7
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 oil.