본문 바로가기
반응형

Python5

Ruff에서 특정 라인 검사 예외처리 하기 Ruff Linter를 사용하다보면 특정 라인은 예외처리를 하고 싶을 수 있습니다. 예를 들어 Pyflakes의 undefined-local-with-import-star (F403) 규칙을 사용하고 싶을 수 있습니다. 다음과 같이 코드 뒤에 주석으로 # noqa 를 붙여주면 Ruff 검사에서 해당라인만 예외처리됩니다. from mylib import * # noqa 위와 같이 진행 후 다시 체크를 진행하면 해당 라인은 검사하지 않는 것을 볼 수 있습니다. 2023. 9. 9.
Ruff (고성능 Python linter) 소개 및 세팅 ruff homepage https://beta.ruff.rs/docs/ Ruff Ruff Discord | Docs | Playground An extremely fast Python linter, written in Rust. Linting the CPython codebase from scratch. ⚡️ 10-100x faster than existing linters 🐍 Installable via pip 🛠️ pyproject.toml support 🤝 Python 3.11 compatibility beta.ruff.rs ruff github https://github.com/astral-sh/ruff GitHub - astral-sh/ruff: An extremely fast Python l.. 2023. 8. 20.
github action으로 Jupyter book 자동 배포하기 Jupyter book을 작업하다보면 jupyter-book build 명령어를 통하여 작업한 내용을 빌드하고 ghp-import 모듈을 사용하여 빌드된 페이지를 push 해주는 작업을 반복해야지 적용됩니다. https://jupyterbook.org/en/stable/publish/gh-pages.html 위 페이지 내용을 확인하면 github action을 사용하여 작업물이 push 되면 바로 반복 작업하던 빌드 및 push를 자동화 할 수 있습니다. 제가 진행한 방법도 정리하였습니다. 먼저 작업하는 Jupyter book 저장소 최상단에 requirements.txt를 추가합니다. ghp-import==2.1.0 pydata-sphinx-theme==0.13.1 jupyter-book==0.15.1.. 2023. 5. 6.
python -m 옵션으로 모듈 실행하기 pip, pyinstaller 등 설치된 모듈을 실행할 때 다음과 같은 에러를 본적이 있을 것입니다. Fatal error in launcher: Unable to create process using "[Python 경로]" "[모듈 경로]" ': ??? ??? ?? ? ????. 이때 python -m 옵션을 사용하여 설치해둔 패키지의 모듈을 실행할 수 있습니다. pyinstaller를 실행하려고 아래와 같이 입력하였습니다. python -m pyinstaller example.py 하지만 No module named pyinstaller 이라는 결과만 받습니다. 예상으로는 python -m 명령어로 모듈 실행할 때 Scripts의 exe를 찾아 실행할 것이라고 생각하였는데 내부에 설치된 패키지 모듈.. 2023. 5. 5.
Windows 에서 Gradio 웹페이지 안뜨는 문제 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec. 위와 같은 에러메시지를 띄우면서 Gradio 웹페이지를 실행시켰지만 페이지 접속시 아무 화면도 안뜨는 문제가 있었습니다. 처음에 문제를 찾을 때에는 module 이 부분이 문제라고 하여 이쪽을 집중적으로 찾았습니다. module → application/javascript 로 변경하면 된다는 부분이었습니다. 하지만 변경시 해당 js 내부에서 다른 module.. 2022. 8. 31.
반응형