Comments (10)
Indeed:
$ codespell -I non_existent_file
ERROR: cannot find ignore-words file: non_existent_file
[...]
$ echo $?
0
$
$ python -m codespell_lib -I non_existent_file
ERROR: cannot find ignore-words file: non_existent_file
[...]
$ echo $?
64
$
But the way, isn't $(python -m site --user-base)/bin
in the PATH
by default on most Linux distributions?
from codespell.
I install it in my user's home pip install --user
and don't want to "$(python -m site --user-base)/bin/codespell"
from codespell.
But the way, isn't
$(python -m site --user-base)/bin
in thePATH
by default on most Linux distributions?
Could be ...
But I like my computer to be extra simple.
from codespell.
The codespell executable $(python -m site --user-base)/bin/codespell
looks like this:
from codespell_lib import _script_main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(_script_main())
File codespell_lib/__main__.py
looks like this:
from ._codespell import _script_main
if __name__ == "__main__":
_script_main()
Does changing the last line help?
if __name__ == "__main__":
sys.exit(_script_main())
from codespell.
Yes.
from codespell.
Also, do you know if that's right thing to do? I cannot find definitive information in the relevant documentation, although some examples do call sys.exit()
:
from codespell.
🤔
from codespell.
The only thing I can think of is: when codespell is used as a library it should not exit (terminate)
from codespell.
My wrong, it is (partially at least) documented:
main
functions are often used to create command-line tools by specifying them as entry points for console scripts. When this is done, pip inserts the function call into a template script, where the return value ofmain
is passed intosys.exit()
. For example:sys.exit(main())Since the call to
main
is wrapped insys.exit()
, the expectation is that your function will return some value acceptable as an input tosys.exit()
; typically, an integer orNone
(which is implicitly returned if your function does not have a return statement).
It's just that the above refers to the template script $(python -m site --user-base)/bin/codespell
as far as I can tell, not to python -m
. Also, I would have expected different wording such as "you MUST".
Can you please create a pull request that adds sys.exit()
? I should be able to merge it rapidly - unlike my own pull requests.
from codespell.
Done 🍏
from codespell.
Related Issues (20)
- Support namespaced dictionary packages HOT 1
- "Goverment" not regonized in all relevant lines HOT 2
- support ignore for blocks of code
- Codespell Not Ignoring Words Properly when Provided in Original Case HOT 1
- release a new version ? HOT 15
- Unable to add inline comments for markdown documents HOT 7
- Splitting multiple 'skip' paths onto indented config file lines behaves differently than when on a single line HOT 4
- Are inline ignores restricted to hash-style comments? HOT 1
- Is it possible to combine a custom dictionary with a builtin dictionary? HOT 1
- pre-commit to remove `Used config files:` noisy output HOT 1
- Python API support HOT 7
- Better control over decoding problems reporting HOT 2
- Codespell inline ignores don't appear to work in Markdown files HOT 3
- assertIn false positivies HOT 9
- Better project description HOT 3
- Tests fail if not 'codespell' installed HOT 5
- I need to ignore "image/png" the contents of the ipynb(python) file / .pre-commit-config.yaml HOT 3
- false positive: unparseable HOT 6
- Unable to Ignore Files Completely Using .codespell.toml Configuration HOT 1
- --ignore-words is not working in pre-commit HOT 2
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 codespell.