Python
Table of Contents
- [B] * testing pythontesting
- TODO [B] Hypothesis has a set of Pandas strategies for generating data pythontestingpandas
- pythontesting python - Run code before and after each test in py.test? - Stack Overflow
- pythontestingprojectpip python - How should I structure a pytest test only package? - Stack Overflow
- TODO [B] doctest? pythontesting
- pytest can detect recursion pythontestingpytest
- [B] * profiling pythonperformance
- [B] what-studio/profiling: An interactive continuous Python profiler pythonperformance
- pythonperformance kinda unmaintainerd though?
- [A] profiling with cprof pythonperformance
- [C] rkern/lineprofiler: Line-by-line profiling for Python pythonperformance
- pythonperformance profiling
- TODO ipython? pythonperformance
- timeit pythonperformance
- [B] what-studio/profiling: An interactive continuous Python profiler pythonperformance
- [B] * packaging pythonpip
- pythonpip minimal-setup-py/setup.py at master · maet3608/minimal-setup-py
- install only dependencies:
pip3 install --user -e .
pythonpip - install multiple packages at once pythonpip
- [A] local PIP dependency: if the repo is in
/path/to/repo
, putHPI@git+file://DUMMY/path/to/repo@master
insetup.py
pythonpip - TODO [B] bast/pypi-howto: How to publish Python packages on PyPI. pythonpippypi
- TODO [C] Testing & Packaging · Homepage of Hynek Schlawack pythonpip
- TODO releasing on pypi pythonpippypi
- [B] * debugging pythondebug
- [B] * bad things about python python
- [B] * static analysers python
- monkeytype – automatic typing annotations generation pythonmypy
- TODO would be nice to have static analysis that checks you are not using global variables, etc. python
- [C] bandit – security checks pythonsecurity
- pythonsecurity wouldn't say it's super useful… might detect occasional eval or whatever, but won't help with more sophisticated stuff
- [C] * libraries python
- [C] * Import system python
- [C] * datetime handling pythondatetime
- [B] utcfromtimestamp – returns timestamp, unaware; fromtimestamp – returns offset + timestamp, unaware pythondatetime
- [B] ok, seems that it's better to use
pytz.utc.localize(tz_unaware_datetime)
pythondatetime - pythondatetime zachwill/moment: Dealing with dates in Python shouldn't have to suck.
- pythondatetime zachwill/moment: Dealing with dates in Python shouldn't have to suck.
- [C] * logging pythonlogging
- pythonlogging creating top level logger is always bad (may happen before configuring). use factory method
- [C] * docs python
- [C] * ipdb pythonipdb
- ---------------------------------- python
- [B] Python3 f-strings - A complete guide to the most well received feature of Python 3. /r/Python python
- [B] To yield or not to yield pythonyield
- pythonyield good point about separating validation and generation
- [B] AST
ast.dump(ast.parse("'a' in 'aa' in 'aaa'"))
python - TODO [B] use for – else pythonhabit
- TODO [B] log optimizers i used python
- [B] optimizing python CLI tools https://files.bemusement.org/talks/OSDC2008-FastPython/ python
- TODO [B] parser.addargument('rest, nargs=argparse.REMAINDER) pythonhabit
- [B] awesome-python https://github.com/vinta/awesome-python python
- should definitely subscribe to its feed and go through again python
- TODO https://github.com/vinta/awesome-python#command-line-tools python
- TODO pretty cool https://github.com/timofurrer/try python
- TODO cool https://github.com/dbcli/mycli python
- TODO hmm try that? http://docopt.org/ python
- TODO some of these for nutrino? https://github.com/vinta/awesome-python#database python
- TODO hmm that's interesting, visual scraping https://github.com/scrapinghub/portia python
- TODO https://www.reddit.com/r/coolgithubprojects/ python
- TODO ?? https://python.libhunt.com/ python
- TODO [B] do not use replace tzinfo, always localize.. pythonhabit
- [B] multiline string – lstrip('\n') for nicer formatting! python
- [B] Tweet from Vladislav Isenbaev (@isenbaev), at Mar 20, 03:48: pickle просто скотски медленный, если что - кратно медленнее даже json'а python
- [B] multiprocessing vs multithreading vs asyncio in Python 3.4 - Stack Overflow pythonconcurrencyperformance
- [B] adamchainz/patchy: Patch the inner source of python functions at runtime. pythonlisp
- TODO [C] PyPy.js: Python in the web browser | Hacker News pythonjswebext
- [C]
difflib.unified_diff
is suuuuper slow… python - [C] scrapy debugging pythonscrapy
- [C] python's for..else makes in 'syntactially' look like a total function python
- [C] NamedTuple python
- [C] Use contextmanager python
- [C] get current function/method name python
- TODO [C] traitlets? python
- [C] What's the difference between marshmallow and sql-alchemy? /r/flask python
- [C] dominatepp/.travis.yml at master · karlicoss/dominatepp pythonci
- [C] use
re.VERBOSE
for inline comments in regexes python - [C] python - What do (lambda) function closures capture? - Stack Overflow pythonplt
- [C] argparse — Parser for command-line options, arguments and sub-commands — Python 3.8.1 documentation python
- [C] Performance — python-rapidjson 0.4 documentation pythonjson
- [C] python - Argparse: Way to include default values in '–help'? - Stack Overflow python
- [D] PyPy - packages http://packages.pypy.org pythonpypy
- [D] Construct: kinda like struct but better? https://construct.readthedocs.io/en/latest/ pythonparsing
- [D] Pyrser: grammars? https://pythonhosted.org/pyrser/ pythonparsing
- [D] kython@git+https://github.com/karlicoss/kython.git@master dependency for setup.cfg pythonpip
- TODO [D] PyCon 2018 Talk Videos : Python https://www.reddit.com/r/Python/comments/8j4ep6/pycon_2018_talk_videos/ pythontowatch
- [D] Basic usage — tox 3.13.3.dev13 documentation python
- TODO [D] if there is a 'main.py' in script dir, it gets imported – wtf???? python
- [D] concurrent.futures https://docs.python.org/3.7/library/concurrent.futures.html?highlight=processpoolexecutor use
map
python - [D] PyCQA/pyflakes: A simple program which checks Python source files for errors python
- [D] posargs are needed to passing adhoc args, e.g. pythontox
- [D] some misc notes python
from http import HTTPStatus
python- pythonhabit use nonlocal instead of global
- TODO !r formatter pythonhabit
- python yield is often preferrable because python doesn't have bindings in generators
- python there is a difference between returning generator and yield from generator. the latter keeps scope, which might be useful if you have open files
- DONE [C] To yield or not to yield pythondecorator
- pythondecorator huh, some things are mentioned in the original post actually
- CANCEL [C] use putup (pyscaffold) for project generation pythonhabit
- WAIT [D] Poetry instead of pyscaffold? python
- python eh, don't think it worked for me, I prefer to rely on setup.py
- [C] https://docs.python.org/3.7/library/argparse.html argparse: use
set_defaults
python- python ah, could pass lambda to forward to actual handler function!
- TODO [C] generateordering? python
- TODO [B] How can I color Python logging output? - Stack Overflow pythonloggingkython
- TODO [B] Direct URL PEP 508 support and installing sub-dependencies from Git · Issue 5566 · pypa/pip pythonpip
- [B] Allow direct urls in installrequires · Issue 6301 · pypa/pip python
- TODO [C] rstojnic/lazydata: Lazydata: Scalable data dependencies for Python projects python
- python so it kinda keeps textual 'submodules' for data??
- TODO [C] using pytest fixtures to inject stuff into the module pythonpytest
- pythonpytest like in tz provider
- STRT [C] end2end gui semi manual tests pythonpromnesiatesting
- TODO [C] pytest dependencies python
- TODO [C] backoff · PyPI python
- STRT [D] Poetry for dep management python
- [D] Support automatic versioning setuptoolsscm-style? · Issue 140 · python-poetry/poetry python
- TODO [D] it's clearly not detecting changes in
install_requires
; needed to reinsall pythontox - [D] python - pytest exits with no error but with "collected 0 items" - Stack Overflow pythonpytest
- TODO [D] traceback — Print or retrieve a stack traceback — Python 3.8.0 documentation pythonerrors
- TODO [C] separate testing and linting since mypy's deps might be installed by accident? pythontox
- [C] python - Run an OLS regression with Pandas Data Frame - Stack Overflow python
- TODO [C] figure out a better framework for python multiprocessing… python
- TODO [C] vinta/awesome-python: A curated list of awesome Python frameworks, libraries, software and resources pythontui
- STRT [C] sigh… don't think it's possible to properly preserve stacktraces… pythonerrors
- STRT [C] strptime is incapable of handling timezones via %Z direcive?? pythontimezone
- pythontimezone see takeout provider
- [C] encode/httpx: A next generation HTTP client for Python. 🦋 python
- TODO [C] Python Prompt Toolkit 3.0 — prompttoolkit 3.0.2 documentation pythontui
- pythontoxpip testing - Python/tox Install a dependency as editable - Stack Overflow
- pythonhpi testing - Python/tox Install a dependency as editable - Stack Overflow
- python python - What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc? - Stack Overflow
- [C] adapter thigs with getattr (like in workout provider for org notes) – pretty great for adding one missing method python
- TODO [C] argparseweb · PyPI python
- STRT [C] vinta/awesome-python: A curated list of awesome Python frameworks, libraries, software and resources pythoncli
- TODO [B] GrahamDumpleton/wrapt: A Python module for decorators, wrappers and monkey patching. python
- TODO attemt to figure out mixed sem/cal versioning pythonprojectpip
- TODO had to remore username from hatch config? it was overriding token during the release.. pythonpypi
- pythonpypi
why it is hard – if you have 2fa you can't upload packages
- pythonpypi ah ok, actually it allows for a token, so even better!
- [D] tox support python-poetry/poetry python
- TODO [C] findpackages in setup.py? python
- TODO [C] eee pythonipython
- CANCEL [C] KoffeinFlummi/Chronyk: A Python 3 library for parsing human-written times and dates python
- [D] sampleproject/setup.py at master · pypa/sampleproject python
- TODO [C] nicer attribute errors python
- TODO [D] pytest-profiling · PyPI python
- TODO [D] Poetry easy pip publishing python
- TODO [C] use quit instead of close? pythonselenium
- [C] Brython pythonweb
- TODO [C] logzero: Python logging made easy — logzero 1.5.0 documentation python
- TODO [D] marshmallow for db handling looks interesting… python
- TODO [D] PandaPy python
- [D] Ability to execute certain tests sequentially while using -n (xdist) · Issue #385 · pytest-dev/pytest-xdist python
- [D] pylint exceed maximum recursion depth · Issue #2388 · PyCQA/pylint python
- [D] Search pylint configuration in setup.cfg and pyproject.toml · Issue #617 · PyCQA/pylint python
- TODO [D] How do I use regex in a SQLite query? - Stack Overflow pythonsqlite
- [D] -pdbcls=IPython.terminal.debugger:TerminalPdb –pdb pythonipythondebug
- TODO [B] wonder how to make sure dataclasses are represented very effecienly? python
- TODO [C] Types at the edges in Python – MeadSteve's Dev Blog python
- TODO figuring out why has the package ended up in path python
- pythonmypy Exhaustiveness Checking with Mypy | Haki Benita
- TODO [C] hvplot: clever algebra on plots pythonbokeh
- TODO [C] naiquevin/pipdeptree: A command line utility to display dependency tree of the installed Python packages [NOT ACCEPTING PRs FOR A WHILE BECAUSE OF MAJOR REFACTORING IN ANOTHER BRANCH] python
- [C] pandas/setup.py at master · pandas-dev/pandas pythonpip
- pythonpip nice, pandas is using quite elaborate setup.py with proper documentation links
- TODO [C] kirankoduru/scrapy-programmatically: Running scrapy spider programmatically. pythonscrape
- [D] detect all subpackages properly · karlicoss/promnesia@f7451c4 python
- [D] Configs suck? Try a real programming language | Hacker News python
- [C] google/python-fire: Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. pythoncli
- [C] samuelhwilliams/Eel: A little Python library for making simple Electron-like HTML/JS GUI apps pythongui
- TODO [C] setuptools/_init_.py at master · pypa/setuptools python
- [B] keeping testss side by side with code pythonpytest
- python pkgutil — Package extension utility — Python 3.8.3rc1 documentation
- TODO [C] PEP 593 – Flexible function and variable annotations | Python.org python
- TODO [C] Simple dependent types in Python - DEV Community 👩💻👨💻 pythonmypy
- TODO [B] SymPy - a Python library for symbolic mathematics | Hacker News pythonsympysage
- STRT [B] The Qt Console for Jupyter — Jupyter Qt Console 4.7.5 documentation python
- [B] Frame Hacks python
- [B] pylint useful stuff python
- STRT [B] try using devpi for uploading? pythontox
- [C] docopt v argparse • Dimitri Merejkowsky python
- [D] Dynamically change slots in Python 3 - Stack Overflow python
- [C] LiveCode is a modern day HyperCard (2019) | Hacker News pythongui
- [C] Show HN: CrossHair – SMT Assisted Testing for Python pythontesting
- STRT [B] lihaoyi/macropy: Macros in Python: quasiquotes, case classes, LINQ and more! pythonmacrolisp
- pythonmacrolisp wow that's amazing https://macropy3.readthedocs.io/en/latest/discussion.html#function-advice
- [D] What does it do? — Logbook pythonlogging
- TODO [C] How formulas work — patsy 0.5.1+dev documentation python
- TODO [D] Pipenv: promises a lot, delivers very little | Chris Warrick pythonpip
- pythonpip installrequires vs requirements files — Python Packaging User Guide
- pythongitipython kynan/nbstripout: strip output from Jupyter and IPython notebooks
- pythonbokehviz Plotly vs. Bokeh: Interactive Python Visualisation Pros and Cons | Paul Iacomi
- [C] hack to allow optional git dependencies pythonpippypi
- [C] jestem króliczkiem on Twitter: "or, you can encode dependencies in types: @dataclass(init=False) class FancyPath: path: Path mtime: float def _init_(self, path: Path): self.path = path self.mtime = path.stat().stmtime" / Twitter pythoncachew
- [C] Traps for the Unwary in Python’s Import System — Nick Coghlan's Python Notes 1.0 documentation python
- STRT [C] amontalenti/elements-of-python-style: Goes beyond PEP8 to discuss what makes Python code feel great. A Strunk & White for Python. python
- [B] The Definitive Guide to Python import Statements | Chris Yeh python
- [B] resize ipython notebook output window - Stack Overflow python
- [C] Not really. Enable something like MyPy or PyType on a big enough codebase with z… | Hacker News python
- TODO [B] tmbo/questionary: Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts … pythontui
- python Good Integration Practices — pytest documentation
- pythonviz Python Scatterplot Matrix | Plotly
- pythonpytest box/flaky: Plugin for nose or pytest that automatically reruns flaky tests.
- pythonipython ipython -pylab
- [C] lambdalisue/jupyter-vim-binding: Jupyter meets Vim. Vimmer will fall in love. pythonvimjupyter
- pythonvimjupyter eh, I'm using emacs now…
- python Is SQLAlchemy recommended for a highly transactional, large volume database? /r/Python
- [C] Command Line Scripts — Python Packaging Tutorial pythonpip
- pythonpip hmm maybe best to use 'scripts', seems more manageable
- pythonlisp Hy - Wikipedia
- pythonlisp Python VS Common Lisp, workflow and ecosystem - Lisp journey
- pythonscrape
When do you us Beautiful Soup or Scrapy? : Python
- pythonscrape TLDR: scrapy is better
- pythonpandas DataFrame — pandas 0.24.2 documentation
- pythonpandas Comparison with SQL — pandas 0.24.2 documentation
- pythontuiweb There's now a dead simple way to slap a web interface on a command line script : Python (click library)
- python multiprocess.Pool + submitasync work properly with timeouts… unlike concurrent.futures?
- [D] dataset: right, so synccolumn is taking quite a bit of time… I suppose because of column detection stuff pythonsqlite
- TODO [B] gotcha with yield pythonyield
- pythonpandasdata date index
- pythonviz Which one is better: Bokeh or Plotly? - Quora
- pythonviz Plotly vs Bokeh vs … : Python
- python unwrap vs assert: assert is a statement, so can't do in one line
- python imp.loadsource for loading python module from file
- _all isinstance python Ok, to prevent pollution just assert everything in
- python dill seems to be superior to pickle
- [B] Choosing a Python Visualization Tool - Practical Business Python pythonviz
- [B] Quickstart — Bokeh 1.0.4 documentation pythonviz
- pythonviz ok, so apparently bokeh is more akin to plotly?
- [C] python - how to set readable xticks in seaborn's facetgrid? - Stack Overflow pythonplottingseaborn
- [C] #45 Control color of each marker | seaborn – The Python Graph Gallery pythonseaborn
- [C] python - Format x-axis on chart created with pandas plot method - Stack Overflow pythondrillpandas
- pythonpip screw hatch. it's got some weird defaults and doesn't provide much value
- [C] python - Argparse: Way to include default values in '–help'? - Stack Overflow python
- [D] I created a GitHub repository explaining the complete process of gathering data, transforming it, getting insights and making plots using pandas, NumPy, Matplotlib and Seaborn. /r/Python pythonviz
- [C] google/pytype: A static type analyzer for Python code python
- TODO [B] Comparing Python Command-Line Parsing Libraries – Argparse, Docopt, and Click | Hacker News python
- [C] sdispater/pendulum: Python datetimes made easy pythondatetime
- TODO [C] fastcore: An Underrated Python Library | fastpages python
- pythonrepl On Repl-Driven Programming | Hacker News
- TODO [B] ast — Abstract Syntax Trees — Python 3.9.1rc1 documentation python
- TODO [B] Why Python is my Favorite Language • Buttondown python
- TODO [B] wrapt · PyPI python
- TODO [B] pydot/pydot: Python interface to Graphviz's Dot language pythonviz
- TODO [C] NBSafety Fearless interactivity for Jupyter notebooks python
- python Top 10 Python libraries of 2020 you should know about | Tryolabs Blog
- [B] Overviews — PyViz 0.0.1 documentation python
- TODO [B] fastai/nbdev: Create delightful python projects using Jupyter Notebooks python
- TODO [B] Running Python code in a subprocess with a time limit | Simon Willison’s TILs python
- TODO [B] tiangolo/typer: Typer, build great CLIs. Easy to code. Based on Python type hints. python
- TODO [C] Allow to customize location of .eggs directory · Issue #1854 · pypa/setuptools python
- [C] PyInstrument – A statistical Python profile that focuses on the slow parts | Hacker News python
- [C] python - Extract traceback info from an exception object - Stack Overflow pythonerrors
- TODO frustrating: so much duplication pythonpip
- [D] Hypermodern Python | Lobsters python
- TODO [C] The Hard Part of Learning a Language • Hillel Wayne pythontoblog
- [B] I've gained massive amounts of random Python knowledge over the past month of actively working on my projects pythontoblog
- TODO [D] python - How can I make setuptools install a package that's not on PyPI? - Stack Overflow python
- [C] pypa/gh-action-pypi-publish: GitHub Action for publishing pre-built distribution packages to PyPI (from `dist/` dir) pythongithubci
- [C] Publishing package distribution releases using GitHub Actions CI/CD workflows — Python Packaging User Guide pythongithubci
- TODO [C] uva-graphics/autoimp: Automatic Python imports python
- [D] My Python setup for 2020 | Noam Elfanbaum https://noamelf.com/posts/my-python-setup-for-2020/ python
- TODO [D] Vendoring Python dependencies with pip - Underdog.io Engineering Team - Medium https://medium.com/underdog-io-engineering/vendoring-python-dependencies-with-pip-b9eb6078b9c0 python
- [D] PyPy - Performance https://pypy.org/performance.html#profiler python
- [D] PEP 612 – Parameter Specification Variables | Python.org python
- [D] Please Fix Your Decorators · Homepage of Hynek Schlawack https://hynek.me/articles/decorators/ python
- [D] bast/somepackage: Show how to structure a Python project. https://github.com/bast/somepackage python
- TODO [D] holtzy/The-Python-Graph-Gallery: A website displaying hundreds of charts made with Python https://github.com/holtzy/The-Python-Graph-Gallery pythonviz
- [D] Debugging Jupyter notebooks - David Hamann https://davidhamann.de/2017/04/22/debugging-jupyter-notebooks/ python
- [D] python-poetry/poetry: Python dependency management and packaging made easy. https://github.com/python-poetry/poetry python
- TODO [C] Do You Have Any Offline Programming Techniques or Tools? | Lobsters python
- [D] pschanely/CrossHair: A static analysis tool for Python that blurs the line between testing and type systems. https://github.com/pschanely/CrossHair python
- [D] egg-info in local directory makes pip think package is installed · Issue #6558 · pypa/pip python
- [D] I hate easy-install.pth · Issue #929 · fonttools/fonttools python
- [D] macropy: syntactic macros for Python | Lobsters python
- [D] Installation — HoloViews 1.13.3 documentation python
- [C] ok, naming test modules the same as originals doesn't end up well… python
- [C] python - Using property() on classmethods - Stack Overflow python
- [B] Web Scraping 101 with Python | Hacker News python
- TODO [C] –system-site-packages? pythonpipx
- TODO [C] strptime idea – cache time string and somehow speed up? python
- TODO [B] hmm, maybe possible to self-pack minimal package in setup.py? could work… python
- [C] Tiendil/smart-imports: smart imports for Python python
- [C] djrobstep/logx: best practice, zero config python logging pythonlogging
- [C] textwrap — Text wrapping and filling — Python 3.8.5 documentation python
- TODO [C] thebjorn/pydeps: Python Module Dependency graphs https://github.com/thebjorn/pydeps pythonproject
- [C] Hello flake8 • Dimitri Merejkowsky pythonpylint
- [D] Brython – A Python 3 implementation for client-side web programming | Hacker News pythonjs
- TODO [C] leeoniya/uPlot: 📈 A small, fast chart for time series, lines, areas, ohlc & bars pythondataviz
- [C] cleanup; remove unused imports by seanbreckenridge · Pull Request 151 · karlicoss/HPI pythonflake8
- [B] Iterables vs. Iterators vs. Generators » nvie.com python
- [C] hhatto/autopep8: A tool that automatically formats Python code to conform to the PEP 8 style guide. python
- [B] python - Suspend on exception in pdb - Stack Overflow pythondebug
- TODO [B] tips about putting test next to code pythontoblog
- TODO [B] How to make an unaware datetime timezone aware in python - Stack Overflow pythontz
- [C] python - How do I parse an ISO 8601-formatted date? - Stack Overflow python
- TODO [B] setuptools - python: simple example for a python egg with a one-file source file? - Stack Overflow pythonpip
- [C] Utilities — Click Documentation (7.x) pythoncli
- TODO [B] pythonql/pythonql: A Query Language extension for Python: Query files, objects, SQL and NoSQL databases with a built-in query language python
- [C] PythonPackagingTerminology - Python Wiki pythonpip
¶[B] * testing pythontesting
¶TODO [B] Hypothesis has a set of Pandas strategies for generating data pythontestingpandas
https://www.hillelwayne.com/talks/beyond-unit-tests/
¶ python - Run code before and after each test in py.test? - Stack Overflow pythontesting
py.test fixtures are a technically adequate method to achieve your purpose. You just need to define a fixture like that: @pytest.fixture(autouse=True) def run_around_tests():
¶ python - How should I structure a pytest test only package? - Stack Overflow pythontestingprojectpip
https://stackoverflow.com/questions/48111426/how-should-i-structure-a-pytest-test-only-package/48350323#48350323
distribute tests with package..
¶TODO [B] doctest? pythontesting
¶pytest can detect recursion pythontestingpytest
¶[B] * profiling pythonperformance
¶[B] what-studio/profiling: An interactive continuous Python profiler pythonperformance
https://github.com/what-studio/profiling
profiling live-profile webserver.py
ok, this is really nice and easy to use
¶ kinda unmaintainerd though? pythonperformance
¶[A] profiling with cprof pythonperformance
python3 -m cProfile -o stats.prof script.py snakeviz stats.prof
¶[C] rkern/lineprofiler: Line-by-line profiling for Python pythonperformance
¶ profiling pythonperformance
python3 -m cProfile -s tottime process.py | less sudo apt install kcachegrind pip3 install --user pyprof2calltree
https://julien.danjou.info/guide-to-python-profiling-cprofile-concrete-case-carbonara/ python -m cProfile -o myscript.cprof myscript.py pyprof2calltree -k -i myscript.cprof
¶TODO ipython? pythonperformance
¶timeit pythonperformance
¶[B] * packaging pythonpip
¶ minimal-setup-py/setup.py at master · maet3608/minimal-setup-py pythonpip
¶install only dependencies: pip3 install --user -e .
pythonpip
¶install multiple packages at once pythonpip
ok, apparently pip does use some sort of 'set compiling', so worth doing that
https://github.com/pypa/pip/issues/988
¶[A] local PIP dependency: if the repo is in /path/to/repo
, put HPI@git+file://DUMMY/path/to/repo@master
in setup.py
pythonpip
no idea why you need DUMMY bit, must be some parsing quirk :shrug:
also, sometimes it needs //DUMMY, sometimes ///DUMMY ???
¶TODO [B] bast/pypi-howto: How to publish Python packages on PyPI. pythonpippypi
¶TODO [C] Testing & Packaging · Homepage of Hynek Schlawack pythonpip
https://hynek.me/articles/testing-packaging/
Your tests do not run against the package as it will be installed by its users. They run against whatever the situation in your project directory is.
¶ o pythonpip
To achieve that, you just move your packages into a src directory and add a where argument to find_packages() in your setup.py: setup( [...] packages=find_packages(where="src"), package_dir={"": "src"}, )
¶TODO releasing on pypi pythonpippypi
ok, that seems to be way easier
hatch build --clean --verbose hatch release --strict "$@"
¶[B] * debugging pythondebug
¶TODO [C] with ipdb.launch_ipdb_on_exception()
pythondebughabit
¶[C] python3.7 has a breakpoint()
builtin + more https://hackernoon.com/python-3-7s-new-builtin-breakpoint-a-quick-tour-4f1aebc444c pythondebug
¶TODO ipdb pp
for pretty print pythondebughabit
¶[B] * bad things about python python
- lambdas suck
- statements, not expressions, you are essentially restrictet to a single line
- no local variables in lambdas (although with walrus operation it's a bit better now)
- http://math.andrej.com/2009/04/09/pythons-lambda-is-broken
- statements, not expressions, you are essentially restrictet to a single line
- scoping (i.e. only local and global scopes)
- GIL makes the concurrency very annoying at times
- no static typing (although it's kinda okay now with annotations and #mypy)
¶[B] * static analysers python
¶monkeytype – automatic typing annotations generation pythonmypy
¶TODO would be nice to have static analysis that checks you are not using global variables, etc. python
however there are not any tools which do that…
¶[C] * libraries python
¶ peopledoc/workalendar: Worldwide holidays and workdays computational toolkit. python
¶ Altair: Declarative Visualization in Python — Altair 2.3.0 documentation pythonviz
¶[C] * Import system python
¶TODO figure it out – very confusing! python
¶ from . import module python
local import
¶[B] Alone Djangonaut – How python's import machinery works python
¶[C] python - Relative imports for the billionth time - Stack Overflow python
https://stackoverflow.com/questions/14132789/relative-imports-for-the-billionth-time
.. are only relative in a package However, if your module's name is __main__, it is not considered to be in a package. Its name has no dots, and therefore you cannot use from .. import statements inside it. If you try to do so, you will get the "relative-import in non-package" error.
¶DONE [D] relative imports are discouraged python
¶[C] * datetime handling pythondatetime
¶[B] utcfromtimestamp – returns timestamp, unaware; fromtimestamp – returns offset + timestamp, unaware pythondatetime
In : datetime.fromtimestamp(123) Out: datetime.datetime(1970, 1, 1, 4, 2, 3)
In : datetime.utcfromtimestamp(123) Out: datetime.datetime(1970, 1, 1, 0, 2, 3)
¶[B] ok, seems that it's better to use pytz.utc.localize(tz_unaware_datetime)
pythondatetime
¶ zachwill/moment: Dealing with dates in Python shouldn't have to suck. pythondatetime
# Create a moment with words in it moment.date("December 18, 2012")
¶ zachwill/moment: Dealing with dates in Python shouldn't have to suck. pythondatetime
# Create a moment that would normally be pretty hard to do moment.date("2 weeks ago")
¶[C] * logging pythonlogging
¶ creating top level logger is always bad (may happen before configuring). use factory method pythonlogging
¶[C] * docs python
¶pydoc python
-k: keyword search
-g: gui
¶ipython: ? and ?? python
¶[C] * ipdb pythonipdb
related #repl
¶TODO [D] python - Use IPython magic functions in ipdb shell - Stack Overflow pythonipdb
https://stackoverflow.com/questions/16184487/use-ipython-magic-functions-in-ipdb-shell
shell.find_line_magic('cpaste')()
¶---------------------------------- python
¶[B] Python3 f-strings - A complete guide to the most well received feature of Python 3. /r/Python python
That’s a part of python’s data model like `len`, `reversed`, `iter`, …: `datetime` simply defines [`datetime.__format__`](https://docs.python.org/3/library/datetime.html#datetime.date.__format__). The method [is explained here](https://docs.python.org/3/reference/datamodel.html#object.__format__).
¶[B] To yield or not to yield pythonyield
https://barahilia.github.io/blog/computers/2017/01/04/to-yield-or-not-to-yield.html
Finally we came to this. To me it is more important that generators make code more elegant. Performance is usually relevant to smaller hot spots. The idea is simple: in comparison to list interface where computation results are first saved and are returned only at the end, “yielding” could reach faster code and reduce memory usage. As a quick simulation we may use %timeit magic command in IPython with the following two functions:
¶ good point about separating validation and generation pythonyield
¶[B] AST ast.dump(ast.parse("'a' in 'aa' in 'aaa'"))
python
¶TODO [B] use for – else pythonhabit
¶TODO [B] log optimizers i used python
¶[B] optimizing python CLI tools https://files.bemusement.org/talks/OSDC2008-FastPython/ python
interpreter – about 10ms
lazy imports
profile slow imports
¶TODO [B] parser.addargument('rest, nargs=argparse.REMAINDER) pythonhabit
process remaining arguments
¶[B] awesome-python https://github.com/vinta/awesome-python python
attrs – could be interesting… might solve stupid namedtuple addition etc.
https://github.com/python-attrs/attrs
This gives you the power to use actual classes with actual types in your code instead of confusing tuples or confusingly behaving namedtuples. Which in turn encourages you to write small classes that do one thing well. Never again violate the single responsibility principle just because implementing init et al is a painful drag.
¶should definitely subscribe to its feed and go through again python
¶TODO pretty cool https://github.com/timofurrer/try python
¶TODO cool https://github.com/dbcli/mycli python
¶TODO hmm try that? http://docopt.org/ python
¶TODO some of these for nutrino? https://github.com/vinta/awesome-python#database python
¶TODO hmm that's interesting, visual scraping https://github.com/scrapinghub/portia python
¶TODO https://www.reddit.com/r/coolgithubprojects/ python
¶TODO ?? https://python.libhunt.com/ python
¶TODO [B] do not use replace tzinfo, always localize.. pythonhabit
¶[B] multiline string – lstrip('\n') for nicer formatting! python
¶[B] Tweet from Vladislav Isenbaev (@isenbaev), at Mar 20, 03:48: pickle просто скотски медленный, если что - кратно медленнее даже json'а python
¶[B] multiprocessing vs multithreading vs asyncio in Python 3.4 - Stack Overflow pythonconcurrencyperformance
if io_bound: if io_very_slow: print("Use Asyncio") else: print("Use Threads") else: print("Multi Processing")
¶[B] adamchainz/patchy: Patch the inner source of python functions at runtime. pythonlisp
https://github.com/adamchainz/patchy#patchy
Patch the inner source of python functions at runtime.
¶TODO [C] PyPy.js: Python in the web browser | Hacker News pythonjswebext
¶[C] difflib.unified_diff
is suuuuper slow… python
¶[C] scrapy debugging pythonscrapy
scrapy shell
withsecrets scrapy shell
from scrapy.http import FormRequest
request=FormRequest(url='http://www.quantified-mind.com/login',formdata={'Email': USER,'Password':PASSWORD,})
fetch(request) – redirects by default
sets response variable
you can do view(response) to view in browser
mind that it might be different from browsing in chrome. because of user agent?
¶[C] python's for..else makes in 'syntactially' look like a total function python
¶[C] NamedTuple python
¶use typing.NamedTuple
python
¶watch out for default add and mul, it acts as adding pairs python
¶you can't easily overload init, so make types of fields robust. Use a helper method instead python
def N(*args, **kwargs):
reurn NamedTuple(whatevs)
¶[C] Use contextmanager python
- @contextmanager; prepare; yield exactly once, then shutdown
contextlib.redirect_stdout
meh. I think it patches sys module? so it redirects sys.stdout calls only; but not all stdout
¶[C] get current function/method name python
def fname():
import inspect
return inspect.stack()[1][3]
¶TODO [C] traitlets? python
¶[C] What's the difference between marshmallow and sql-alchemy? /r/flask python
Marshmallow “converts” (deserializes) dicts to SQLAlchemy models or serializes SQLAlchemy models to dicts. SQLAlchemy is an ORM. It maps database schema (tables) and data to Python objects. The two packages complement each other. They cannot and do not replace each others’ functionality. Flask-Marshmallow gives you a convenient interface to Marshmallow under Flask.
¶[C] dominatepp/.travis.yml at master · karlicoss/dominatepp pythonci
https://github.com/karlicoss/dominatepp/blob/master/.travis.yml
hmm, minimalistic travis is not so bad..
¶[C] use re.VERBOSE
for inline comments in regexes python
¶[C] python - What do (lambda) function closures capture? - Stack Overflow pythonplt
https://stackoverflow.com/questions/2295290/what-do-lambda-function-closures-capture
Scoping in Python is dynamic and lexical. A closure will always remember the name and scope of the variable, not the object it's pointing to.
¶[C] argparse — Parser for command-line options, arguments and sub-commands — Python 3.8.1 documentation python
https://docs.python.org/3/library/argparse.html
metavar - A name for the argument in usage messages.
¶[C] Performance — python-rapidjson 0.4 documentation pythonjson
https://python-rapidjson.readthedocs.io/en/latest/benchmarks.html
ok, so loads speedups are not that significant for my purposes
¶[C] python - Argparse: Way to include default values in '–help'? - Stack Overflow python
Add '%(default)' to the help parameter to control what is displayed.
¶[D] PyPy - packages http://packages.pypy.org pythonpypy
¶[D] Construct: kinda like struct but better? https://construct.readthedocs.io/en/latest/ pythonparsing
¶[D] Pyrser: grammars? https://pythonhosted.org/pyrser/ pythonparsing
¶[D] kython@git+https://github.com/karlicoss/kython.git@master dependency for setup.cfg pythonpip
¶TODO [D] PyCon 2018 Talk Videos : Python https://www.reddit.com/r/Python/comments/8j4ep6/pycon_2018_talk_videos/ pythontowatch
¶[D] Basic usage — tox 3.13.3.dev13 documentation python
https://tox.readthedocs.io/en/latest/example/basic.html#integration-with-setup-py-test-command
As the python eco-system rather moves away from using setup.py as a tool entry point it’s maybe best to not go for any setup.py test integration.
¶TODO [D] if there is a 'main.py' in script dir, it gets imported – wtf???? python
(while debugging telegram2org)
¶[D] concurrent.futures https://docs.python.org/3.7/library/concurrent.futures.html?highlight=processpoolexecutor use map
python
¶[D] PyCQA/pyflakes: A simple program which checks Python source files for errors python
https://github.com/PyCQA/pyflakes
Pyflakes makes a simple promise: it will never complain about style, and it will try very, very hard to never emit false positives. Pyflakes is also faster than Pylint or Pychecker. This is largely because Pyflakes only examines the syntax tree of each file individually. As a consequence, Pyflakes is more limited in the types of things it can check.
¶[D] posargs are needed to passing adhoc args, e.g. pythontox
¶[D] some misc notes python
## Print with @padding `print("{:>d}{}".fomat(i, a[i]))` prints i aligned to at least two spaces as a decimal. ## Infinite dict ~~~ { .python } infinite_defaultdict = lambda: defaultdict(infinite_defaultdict) d = infinite_defaultdict() d['x']['y']['z'] = 10 ~~~ ## Web server to start a webserver to serve files from your current dir: python -m SimpleHTTPServer @enums ## Enums from enum import Enum class Fruit(Enum): APPLE = 0 ORANGE = 1 ## Generating @random color color = "#%06x" % random.randint(0, 0xFFFFFF) python setup.py install --force #singleton @singleton def singleton(cls): instances = {} def get_instance(): if cls not in instances: instances[cls] = cls() return instances[cls] return get_instance TODO tbh, easier with lru_cache(1)?
¶from http import HTTPStatus
python
¶ use nonlocal instead of global pythonhabit
¶TODO !r formatter pythonhabit
¶ yield is often preferrable because python doesn't have bindings in generators python
¶ there is a difference between returning generator and yield from generator. the latter keeps scope, which might be useful if you have open files python
¶DONE [C] To yield or not to yield pythondecorator
https://barahilia.github.io/blog/computers/2017/01/04/to-yield-or-not-to-yield.html
hmm. if I decorate function with list constructor, I can get both ease of use and yield in function's body
¶ huh, some things are mentioned in the original post actually pythondecorator
¶CANCEL [C] use putup (pyscaffold) for project generation pythonhabit
¶WAIT [D] Poetry instead of pyscaffold? python
The best answer in 2020 is to use poetry. http://poetry.eustace.io
¶ eh, don't think it worked for me, I prefer to rely on setup.py python
¶[C] https://docs.python.org/3.7/library/argparse.html argparse: use set_defaults
python
One particularly effective way of handling sub-commands is to combine the use of the add_subparsers() method with calls to set_defaults() so that each subparser knows which Python function it should execute. For example: This way, you can let parse_args() do the job of calling the appropriate function after argument parsing is complete. Associating functions with actions like this is typically the easiest way to handle the different actions for each of your subparsers. However, if it is necessary to check the name of the subparser that was invoked, the dest keyword argument to the add_subparsers() call will work:
¶ ah, could pass lambda to forward to actual handler function! python
¶TODO [C] generateordering? python
¶TODO [B] How can I color Python logging output? - Stack Overflow pythonloggingkython
2020 code, no additional packages required, Python 3
¶TODO [B] Direct URL PEP 508 support and installing sub-dependencies from Git · Issue 5566 · pypa/pip pythonpip
https://github.com/pypa/pip/issues/5566#issuecomment-402417467
We disabled the ability to use PEP 508 URL requirements in dependencies, since we don't want that a package installed from PyPI to result in the pip reaching out to an arbitary web URL. Basically, pip install spam should not make pip reach out to anything except PyPI.
¶[B] Allow direct urls in installrequires · Issue 6301 · pypa/pip python
https://github.com/pypa/pip/issues/6301
ugh. so I can't have URL dependencies if it's meant to be on pypi???
¶TODO [C] rstojnic/lazydata: Lazydata: Scalable data dependencies for Python projects python
¶ so it kinda keeps textual 'submodules' for data?? python
¶TODO [C] using pytest fixtures to inject stuff into the module pythonpytest
¶ like in tz provider pythonpytest
¶STRT [C] end2end gui semi manual tests pythonpromnesiatesting
¶TODO [C] pytest dependencies python
py, more-itertools, zipp, importlib-metadata, pluggy, six, pyparsing, packaging, atomicwrites, wcwidth, attrs, pytest, orger
¶TODO [C] backoff · PyPI python
https://pypi.org/project/backoff/
It is also possible to specify an alternate logger with the logger keyword argument. If a string value is specified the logger will be looked up by name.
¶STRT [D] Poetry for dep management python
We have moved our dependency management from pipenv to poetry and hasn’t been more happier than now working with and publish Python modules. Now we use pyenv with poetry to run all our projects in Python with venv in project instead of decided by poetry default settings. We changed the settings with: poetry config settings.virtualenvs.in-project true After this in hgignore or gitignore added .venv folder. Now everything is the way we wanted, with Pipenv many times faced issues that the project worked with requirements.txt but not in Pipenv. Didn’t have this issue moving to poetry yet. Also with emacs support and automated deployment tools the predictability of poetry made our team easy to work with and publish Python application modules.
¶[D] Support automatic versioning setuptoolsscm-style? · Issue 140 · python-poetry/poetry python
https://github.com/python-poetry/poetry/issues/140
right, poetry can't infer version...
¶TODO [D] it's clearly not detecting changes in install_requires
; needed to reinsall pythontox
¶[D] python - pytest exits with no error but with "collected 0 items" - Stack Overflow pythonpytest
https://stackoverflow.com/questions/37353960/pytest-exits-with-no-error-but-with-collected-0-items
pytest gathers tests according to a naming convention. By default any file that is to contain tests must be named starting with test_ and any function in a file that should be treated as a test must also start with test_.
¶TODO [D] traceback — Print or retrieve a stack traceback — Python 3.8.0 documentation pythonerrors
https://docs.python.org/3/library/traceback.html#tracebackexception-objects
TracebackException Objects
hmm, could use that?
¶TODO [C] separate testing and linting since mypy's deps might be installed by accident? pythontox
¶[C] python - Run an OLS regression with Pandas Data Frame - Stack Overflow python
https://stackoverflow.com/questions/19991445/run-an-ols-regression-with-pandas-data-frame
I think you can almost do exactly what you thought would be ideal, using the statsmodels package which was one of pandas' optional dependencies before pandas' version 0.20.0 (it was used for a few things in pandas.stats.)
¶TODO [C] figure out a better framework for python multiprocessing… python
¶TODO [C] vinta/awesome-python: A curated list of awesome Python frameworks, libraries, software and resources pythontui
https://github.com/vinta/awesome-python
urwid - A library for creating terminal GUI applications with strong support for widgets, events, rich colors, etc.
¶STRT [C] sigh… don't think it's possible to properly preserve stacktraces… pythonerrors
import logging logging.basicConfig() def bad(): raise RuntimeError('BAD') xx = RuntimeError('while running "test"') ex = None try: bad() except Exception as e: ex = e ex.__cause__ = xx logging.error('inside!') logging.exception(ex) logging.error('outside! note the empty stacktrace :(') logging.exception(ex) logging.error("also __cause__ is ignored even though it's present: '%s'", ex.__cause__) # I guess it just doesn't use __cause__, only traceback information... test()
¶STRT [C] strptime is incapable of handling timezones via %Z direcive?? pythontimezone
In [20]: ds = "Sep 18 2018 5:48:23 UTC" In [21]: _TIME_FORMAT = "%b %d %Y %H:%M:%S %Z" In [22]: datetime.strptime(ds, _TIME_FORMAT) Out[22]: datetime.datetime(2018, 9, 18, 5, 48, 23)
fucking hell..
¶ see takeout provider pythontimezone
¶[C] encode/httpx: A next generation HTTP client for Python. 🦋 python
https://github.com/encode/httpx
HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
¶TODO [C] Python Prompt Toolkit 3.0 — prompttoolkit 3.0.2 documentation pythontui
¶ testing - Python/tox Install a dependency as editable - Stack Overflow pythontoxpip
how to install a dependency as editable
¶ testing - Python/tox Install a dependency as editable - Stack Overflow pythonhpi
add this to developer guide.. fucking hell
¶ python - What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc? - Stack Overflow python
pipenv- like venv - can be used to create virtual envelopes but additionally rolls-in package management and vulnerability checking functionality. Instead of using requirements.txt, pipenv delivers package management via Pipfile. As PyPA endorses pipenv for PACKAGE MANAGEMENT, that would seem to imply pipfile is to supplant requirements.txt. HOWEVER: pipenv uses virtualenv as its tool for creating virtual envelopes, NOT venv which is endorsed by PyPA as the go-to tool for creating virtual envelopes.
¶[C] adapter thigs with getattr (like in workout provider for org notes) – pretty great for adding one missing method python
¶TODO [C] argparseweb · PyPI python
¶STRT [C] vinta/awesome-python: A curated list of awesome Python frameworks, libraries, software and resources pythoncli
https://github.com/vinta/awesome-python
Command-line Interface Development Libraries for building command-line applications. Command-line Application Development
¶TODO [B] GrahamDumpleton/wrapt: A Python module for decorators, wrappers and monkey patching. python
https://github.com/GrahamDumpleton/wrapt
It therefore goes way beyond existing mechanisms such as functools.wraps() to ensure that decorators preserve introspectability, signatures, type checking abilities etc. Th
¶TODO attemt to figure out mixed sem/cal versioning pythonprojectpip
https://github.com/pypa/setuptools_scm/#default-versioning-scheme
def semcal(v): tag = v.tag.base_version assert len(tag.split('.')) == 2, tag v.time # tag is breakpoint() pass if __name__ == '__main__': [pkg] = find_packages('src') setup( name=pkg, # version='0.1.1', # use_scm_version=True, use_scm_version={ 'version_scheme': semcal, }, setup_requires=['setuptools_scm'],
¶TODO had to remore username from hatch config? it was overriding token during the release.. pythonpypi
¶ why it is hard – if you have 2fa you can't upload packages pythonpypi
¶ ah ok, actually it allows for a token, so even better! pythonpypi
¶[D] tox support python-poetry/poetry python
https://github.com/python-poetry/poetry/issues/222
For now, you can use poetry with tox by using something similar to what I did in pendulum: https://github.com/sdispater/pendulum/blob/master/tox.ini
¶TODO [C] findpackages in setup.py? python
Although, beware that you may need to change `find_packages()` to `find_namespace_packages()` in your setup.py. I get burned by that one a lot!
¶TODO [C] eee pythonipython
ldisplay_md("hi") TODO shit. try and work on it? also provide these as utils.. from IPython.display import display, Latex display(Markdown("Heat equation:"), heat_eq) display(Markdown("Boundary conditions:")) display(Latex(r"\begin{cases} x \\ y \end{cases}"), bc_left, bc_right) display(Markdown('hi')) That doesn't look great. `display` is quoting plain
¶CANCEL [C] KoffeinFlummi/Chronyk: A Python 3 library for parsing human-written times and dates python
¶[D] sampleproject/setup.py at master · pypa/sampleproject python
https://github.com/pypa/sampleproject/blob/master/setup.py
# This field corresponds to the "Description-Content-Type" metadata field: # https://packaging.python.org/specifications/core-metadata/#description-content-type-optional long_description_content_type='text/markdown', # Optional (see note above)
¶TODO [C] nicer attribute errors python
AttributeError: unexpected attribute 'color' to Line, similar attributes are line_color
¶[B] would be nice to do this hpi: python
¶TODO [D] pytest-profiling · PyPI python
¶TODO [D] Poetry easy pip publishing python
Even putting aside it's approach to dependency management, Poetry has a fond place in my heart for making it so much easier to publish to PyPI. If poetry did nothing but simply the process of publishing and updating python packages, it would still be an amazing tool.
¶TODO [C] use quit instead of close? pythonselenium
¶TODO [C] logzero: Python logging made easy — logzero 1.5.0 documentation python
https://logzero.readthedocs.io/en/latest/
logzero.setup_logger(name=None, logfile
¶TODO [D] marshmallow for db handling looks interesting… python
https://github.com/marshmallow-code/marshmallow
zoopla/zoopla/schemas.py
¶TODO [D] PandaPy python
PandaPy has the speed of NumPy and the usability of Pandas - https://news.ycombinator.com/item?id=22142869
¶[D] Ability to execute certain tests sequentially while using -n (xdist) · Issue #385 · pytest-dev/pytest-xdist python
https://github.com/pytest-dev/pytest-xdist/issues/385
Isn't this enough? py.test -m sequential py.test -m "non sequential" -n8
¶[D] pylint exceed maximum recursion depth · Issue #2388 · PyCQA/pylint python
https://github.com/PyCQA/pylint/issues/2388
Thanks for the tip. I actually had that setting before and still keep it on. --extension-pkg-whitelist=numpy However, after upgrading to later versions of python and pylint and astroid I no longer have the issue even with the numpy whitelist setting. Python 3.7.1 pylint 2.3.1 astroid 2.2.5
¶[D] Search pylint configuration in setup.cfg and pyproject.toml · Issue #617 · PyCQA/pylint python
https://github.com/PyCQA/pylint/issues/617#event-2701192212
Search pylint configuration in setup.cfg and pyproject.toml
¶TODO [D] How do I use regex in a SQLite query? - Stack Overflow pythonsqlite
https://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query
With python, assuming con is the connection to SQLite, you can define the required UDF by writing: con.create_function('regexp', 2, lambda x, y: 1 if re.search(x,y) else 0)
¶[D] -pdbcls=IPython.terminal.debugger:TerminalPdb –pdb pythonipythondebug
¶TODO [B] wonder how to make sure dataclasses are represented very effecienly? python
¶TODO [C] Types at the edges in Python – MeadSteve's Dev Blog python
Pydantic checks that each key I expected exists and is of the correct type. So now all the assumptions I’ve made about the shape of the data is a runtime contract, expressed in native python. If in production it turns out that description is, in fact, optional I’ll get a very descriptive error and the code will fail early.
¶TODO figuring out why has the package ended up in path python
d for d in sorted(pkg_resources.working_set, key=lambda p: p.project_name)]
¶ Exhaustiveness Checking with Mypy | Haki Benita pythonmypy
Exhaustiveness Checking
use else clause with NoReturn, then mypy assists in refining
¶TODO [C] hvplot: clever algebra on plots pythonbokeh
wow! * (same plot) vs + (different plots) is pretty clever! also I like how multiplication doesn't commute so the 'first' plot wins the layout parameters
¶TODO [C] naiquevin/pipdeptree: A command line utility to display dependency tree of the installed Python packages [NOT ACCEPTING PRs FOR A WHILE BECAUSE OF MAJOR REFACTORING IN ANOTHER BRANCH] python
¶[C] pandas/setup.py at master · pandas-dev/pandas pythonpip
Docum
¶ nice, pandas is using quite elaborate setup.py with proper documentation links pythonpip
¶TODO [C] kirankoduru/scrapy-programmatically: Running scrapy spider programmatically. pythonscrape
¶[D] detect all subpackages properly · karlicoss/promnesia@f7451c4 python
tests/integration_test.py::test_example_config /Users/runner/runners/2.169.1/work/promnesia/promnesia/.tox/py3/lib/python3.7/site-packages/hug/use.py:185: DeprecationWarning: invalid escape sequence \d status_code = int("".join(re.findall("\d+", response.status)))
¶[D] Configs suck? Try a real programming language | Hacker News python
https://news.ycombinator.com/item?id=22787332
mjw1007 28 minutes ago [-] One variant of this is to use Python syntax but parse it with the `ast` module rather than evaluating it. This avoids the security problems and the risk that someone will start to write programs inside the configuration file, but gives you the reasonably nice and powerful syntax.
¶[C] google/python-fire: Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. pythoncli
ython Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.
¶[C] samuelhwilliams/Eel: A little Python library for making simple Electron-like HTML/JS GUI apps pythongui
¶TODO [C] setuptools/_init_.py at master · pypa/setuptools python
why is it not including files at all??
¶[B] keeping testss side by side with code pythonpytest
import sys # make sure it doesn't need pytest in prod if 'pytest' in sys.modules: import pytest # type: ignore else: from unittest.mock import Mock pytest = Mock()
¶ pkgutil — Package extension utility — Python 3.8.3rc1 documentation python
pkgutil.extend_path(path, name) Extend the search path for the modules which comprise a package. Intended use is to place the following code in a package’s __init__.py: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories.
¶TODO [C] PEP 593 – Flexible function and variable annotations | Python.org python
¶TODO [C] Simple dependent types in Python - DEV Community 👩💻👨💻 pythonmypy
https://dev.to/wemake-services/simple-dependent-types-in-python-4e14
Now, we are going to combine our new knowledge about Literal and @overload together to solve our problem with open. At last!
¶TODO [B] SymPy - a Python library for symbolic mathematics | Hacker News pythonsympysage
As one point of comparison, SymPy is comically slow compared to Sage. This is mostly because SymPy is purely Python; Sage on the other hand uses a derivative of GiNaC [1] for its internal symbolic expression representation, and then multiple external libraries for non-trivial operations. Symbolic transformations are mostly Maxima [3]. Sage literally converts expressions to strings, pipes them through a Maxima process, and then parses the result back. This is still much faster than the pure Python SymPy. There is an effort to speed up SymPy core, SymEngine [3], but it's been in development for years now, and still isn't integrated into SymPy. Not sure why. Case in point: 'expand("(2+3x+4x*y)^60")' takes 5 seconds with SymPy; Sage does the same in 0.02 seconds.
¶STRT [B] The Qt Console for Jupyter — Jupyter Qt Console 4.7.5 documentation python
The Qt console is a very lightweight application that largely feels like a terminal, but provides a number of enhancements only possible in a GUI, such as inline figures, proper multi-line editing with syntax highlighting, graphical calltips, and much more. The Qt console can use any Jupyter kernel.
¶[B] Frame Hacks python
¶[B] pylint useful stuff python
cell-var-from-loop -- can detect bad lambda capturing pylint --disable='C,fixme,'
¶STRT [B] try using devpi for uploading? pythontox
¶[C] docopt v argparse • Dimitri Merejkowsky python
But for big projects with lots of subcommands, written in Python, using argparse may be a better idea, especially if you need to do advanced stuff for your parsing, like configuring common options in one function, allow plug-ins to change the command line API, and so on …
¶[D] Dynamically change slots in Python 3 - Stack Overflow python
https://stackoverflow.com/questions/27907373/dynamically-change-slots-in-python-3
Normally, an object's attributes are stored in a dict, which requires a fair bit of memory itself. If you are creating millions of objects then the space required by these dicts becomes prohibitive. __slots__ informs the python machinery that makes the class object that there will only be so many attributes refered to by instances of this class and what the names of the attributes will be. Therefore, the class can make an optimisation by storing the attributes directly on the instance rather than in a dict. It places the memory for the (pointers to the) attributes directly on the object, rather than creating a new dict for the object.
¶[C] LiveCode is a modern day HyperCard (2019) | Hacker News pythongui
In the spirit of HN contrarian comments, I'd say the closest thing spiritually to a modern-day HyperCard is PySimpleGUI: https://github.com/PySimpleGUI
¶[C] Show HN: CrossHair – SMT Assisted Testing for Python pythontesting
¶STRT [B] lihaoyi/macropy: Macros in Python: quasiquotes, case classes, LINQ and more! pythonmacrolisp
¶ wow that's amazing https://macropy3.readthedocs.io/en/latest/discussion.html#function-advice pythonmacrolisp
¶[D] What does it do? — Logbook pythonlogging
¶TODO [C] How formulas work — patsy 0.5.1+dev documentation python
https://patsy.readthedocs.io/en/latest/formulas.html
The formula language is actually fairly simple once you get the hang of it, but if you’re ever in doubt as to what some construction means, you can always ask Patsy how it expands.
¶TODO [D] Pipenv: promises a lot, delivers very little | Chris Warrick pythonpip
¶ installrequires vs requirements files — Python Packaging User Guide pythonpip
Requirements Files described most simply, are just a list of pip install arguments placed into a file. Whereas install_requires defines the dependencies for a single project, Requirements Files are often used to define the requirements for a complete Python environment. Whereas install_requires requirements are minimal, requirements files often contain an exhaustive listing of pinned versions for the purpose of achieving repeatable installations of a complete environment. Whereas install_requires requirements are “Abstract”, i.e. not associated with any particular index, requirements files often contain pip options like --index-url or --find-links to make requirements “Concrete”, i.e. associated with a particular index or directory of packages. 1 Whereas install_requires metadata is automatically analyzed by pip during an install, requirements files are not, and only are used when a user specifically installs them using pip install -r.
¶ kynan/nbstripout: strip output from Jupyter and IPython notebooks pythongitipython
¶ Plotly vs. Bokeh: Interactive Python Visualisation Pros and Cons | Paul Iacomi pythonbokehviz
pretty good comparizon
¶[C] hack to allow optional git dependencies pythonpippypi
def building_for_pypi() -> bool: return sys.argv[1] == 'sdist' for_pypi = building_for_pypi() 'my': [] if for_pypi else ['HPI @ git+https://github.com/karlicoss/my.git'], },
¶[C] jestem króliczkiem on Twitter: "or, you can encode dependencies in types: @dataclass(init=False) class FancyPath: path: Path mtime: float def _init_(self, path: Path): self.path = path self.mtime = path.stat().stmtime" / Twitter pythoncachew
https://twitter.com/karlicoss/status/1238791294547353601
@dataclass (init=False) class FancyPath: path: Path mtime: float def __init__(self, path: Path): self.path = path self.mtime = path.stat().st_mtime
right, I suppose it's type to use dataclasses
¶[C] Traps for the Unwary in Python’s Import System — Nick Coghlan's Python Notes 1.0 documentation python
¶STRT [C] amontalenti/elements-of-python-style: Goes beyond PEP8 to discuss what makes Python code feel great. A Strunk & White for Python. python
Use parens (...) for fluent APIs
¶[B] resize ipython notebook output window - Stack Overflow python
You can toggle the scroll window in the main menu of the notebook Cell -> Current Outputs -> Toggle Scrolling
¶[C] Not really. Enable something like MyPy or PyType on a big enough codebase with z… | Hacker News python
https://news.ycombinator.com/item?id=21902827
Not really. Enable something like MyPy or PyType on a big enough codebase with zero explicit annotation and it'll already find plenty of bugs and unhandled cases from the inferred types alone. Some of these are stuff a strong IDE may catch too (using the wrong function name, passing wrong number of args, etc), but some other ones are actually deeper in the code. So already, with zero annotations, you already get value out, let alone once you type a few tricky variables that are harder for Python to track.
¶TODO [B] tmbo/questionary: Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts … pythontui
¶ Good Integration Practices — pytest documentation python
tests in a separate dir vs tests in a subpackage
¶ Python Scatterplot Matrix | Plotly pythonviz
¶ box/flaky: Plugin for nose or pytest that automatically reruns flaky tests. pythonpytest
¶ ipython -pylab pythonipython
¶[C] lambdalisue/jupyter-vim-binding: Jupyter meets Vim. Vimmer will fall in love. pythonvimjupyter
¶ eh, I'm using emacs now… pythonvimjupyter
¶ Is SQLAlchemy recommended for a highly transactional, large volume database? /r/Python python
Yes. I've written a few systems using SQLAlchemy that see 50-100k writes and 200k or so reads per second, and as long as you're using the Core everything works fine. Also allows you to use the ORM for ease-of-development on bits that don't need performance. SQLAlchemy is probably the one library in which I've never reached the "wait, I need to do something and can't" point. Every single weird edge case I've had to handle has been supported either natively or by being able to access the raw interfaces directly in a clean way. Fantastic library, can't recommend it more highly. Also, the lead dev is extremely responsive on the google group and is more than happy to answer questions.
¶[C] Command Line Scripts — Python Packaging Tutorial pythonpip
¶ hmm maybe best to use 'scripts', seems more manageable pythonpip
¶ Hy - Wikipedia pythonlisp
¶ Python VS Common Lisp, workflow and ecosystem - Lisp journey pythonlisp
https://lisp-journey.gitlab.io/pythonvslisp
don't feel like it's very objective comparison.
lots of things are picked etc
although I'm not very positive towards lisp either
¶ When do you us Beautiful Soup or Scrapy? : Python pythonscrape
https://www.reddit.com/r/Python/comments/69wym8/when_do_you_us_beautiful_soup_or_scrapy/
why would you never use BS The selectors system lack in flexibility, it is slow and its HTML parser is not really good for the modern world of opening a page in a browser and looking at what's there to know what to do.
¶ TLDR: scrapy is better pythonscrape
¶ DataFrame — pandas 0.24.2 documentation pythonpandas
¶ Comparison with SQL — pandas 0.24.2 documentation pythonpandas
¶ There's now a dead simple way to slap a web interface on a command line script : Python (click library) pythontuiweb
¶ multiprocess.Pool + submitasync work properly with timeouts… unlike concurrent.futures? python
¶[D] dataset: right, so synccolumn is taking quite a bit of time… I suppose because of column detection stuff pythonsqlite
¶TODO [B] gotcha with yield pythonyield
def wrapped(path: Path): try: it = ex(path) # ugh. keeping yeild in the try section is not ideal, bt yield from it except Exception as e: breakpoint()
¶ date index pythonpandasdata
I guess it's somewhat useful to have multiple stages
raw providers emit dataframe without any index in case of reporting dateless errors (if that makes sense)
then consumer can filter out errors and present them and then choose their own index and aggregateion
¶ Which one is better: Bokeh or Plotly? - Quora pythonviz
https://www.quora.com/Which-one-is-better-Bokeh-or-Plotly
Compare Bokeh with Plotly 1. Easy to install. The process is very similar to Plotly. 2. Bokeh plot is not as interactive as Plotly. 3. Limitation on drawing string value on plot. It looks like only the bar chart can take the string values. Date time string has to convert to DateTime type first in order to be on non-bar plots such as scatter, line, etc. 4. It is not easy to overlay different type of plots on one figure. 5. Less examples online. 6. Less integrated with Panda than Plotly.
¶ Plotly vs Bokeh vs … : Python pythonviz
https://www.reddit.com/r/Python/comments/5nwk9r/plotly_vs_bokeh_vs/
The last advantage I found that plotly has over bokeh is that almost everything in plotly is a dict. This is really useful because I've found certain plotly functions are really slow for some reason or can't be called when you use the multiprocessing module because of pickling issues. Not a problem, in the end they generate dicts under the hood, you can do the same yourself and still pass those dicts to plotly. Also calling help() on plotly objects tells you what keys and values you need to add to your dict.
¶ unwrap vs assert: assert is a statement, so can't do in one line python
¶ imp.loadsource for loading python module from file python
¶ Ok, to prevent pollution just assert everything in _all isinstance python
¶ dill seems to be superior to pickle python
e.g. unpicling requires exactly same modules etc? might be hard if you want to unpickle elsewhere
¶[B] Choosing a Python Visualization Tool - Practical Business Python pythonviz
¶[B] Quickstart — Bokeh 1.0.4 documentation pythonviz
¶ ok, so apparently bokeh is more akin to plotly? pythonviz
¶[C] python - how to set readable xticks in seaborn's facetgrid? - Stack Overflow pythonplottingseaborn
https://stackoverflow.com/questions/43727278/how-to-set-readable-xticks-in-seaborns-facetgrid
The seaborn.pointplot is not the right tool for this plot.
plotting a lot of data via seaborn
¶[C] #45 Control color of each marker | seaborn – The Python Graph Gallery pythonseaborn
https://python-graph-gallery.com/45-control-color-of-each-marker-seaborn/
scatter_kws={'facecolors':df['color']}
¶[C] python - Format x-axis on chart created with pandas plot method - Stack Overflow pythondrillpandas
https://stackoverflow.com/questions/44496383/format-x-axis-on-chart-created-with-pandas-plot-method
ax = df.plot(kind='bar') x_labels = df.index.strftime('%b') ax.set_xticklabels(x_labels)
Comment:
pandas date ticks
¶ screw hatch. it's got some weird defaults and doesn't provide much value pythonpip
i.e. default got username set to "", which gets in the way of using token
¶[C] python - Argparse: Way to include default values in '–help'? - Stack Overflow python
https://stackoverflow.com/questions/12151306/argparse-way-to-include-default-values-in-help
parser = argparse.ArgumentParser( # ... other options ... formatter_class=argparse.ArgumentDefaultsHelpFormatter)
¶[D] I created a GitHub repository explaining the complete process of gathering data, transforming it, getting insights and making plots using pandas, NumPy, Matplotlib and Seaborn. /r/Python pythonviz
¶[C] google/pytype: A static type analyzer for Python code python
¶TODO [B] Comparing Python Command-Line Parsing Libraries – Argparse, Docopt, and Click | Hacker News python
https://news.ycombinator.com/item?id=10185290
I had a simpler case that I couldn't figure out using docopt. I was trying to add in tls flags into docker-compose to match docker. I could not get a combination working where you can just specify --tls to mean tls is true while still accepting --tls=true|false|0|1.
¶[C] sdispater/pendulum: Python datetimes made easy pythondatetime
Why not Arrow? Arrow is the most popular datetime library for Python right now, however its behavior and API can be erratic and unpredictable.
¶TODO [C] fastcore: An Underrated Python Library | fastpages python
¶ On Repl-Driven Programming | Hacker News pythonrepl
Another way is ipython %edit magic command and $EDITOR set to vim and using %autoreload
¶TODO [B] ast — Abstract Syntax Trees — Python 3.9.1rc1 documentation python
ast.literal_eval
¶TODO [B] Why Python is my Favorite Language • Buttondown python
https://buttondown.email/hillelwayne/archive/why-python-is-my-favorite-language/
What I need is an “X for Y”, but better. Something like To Ruby from Python or Go for Python Programmers only cover the core. They don’t cover the peripheral libraries or the lagangue ecosystem. Hyperpolyglot is better, but doesn’t talk much about the ecosystem. It also doesn’t compare across language families, which could be very helpful here.
¶TODO [B] wrapt · PyPI python
Module for decorators, wrappers and monkey patching.
¶TODO [B] pydot/pydot: Python interface to Graphviz's Dot language pythonviz
¶ Top 10 Python libraries of 2020 you should know about | Tryolabs Blog python
To power its capabilities, Typer internally stands on top of Click, which is very well-known and battle-tested. This means that it can leverage all its benefits, community and plugins, while starting simple with less boilerplate code and growing more complex as you need.
¶[B] Overviews — PyViz 0.0.1 documentation python
¶TODO [B] fastai/nbdev: Create delightful python projects using Jupyter Notebooks python
Features of Nbdev - Automatically generate docs from Jupyter notebooks. These docs are searchable and automatically hyperlinked to appropriate documentation pages by introspecting keywords you surround in backticks. - Utilities to automate the publishing of pypi and conda packages including version number management. - A robust, two-way sync between notebooks and source code, which allow you to use your IDE for code navigation or quick edits if desired. - Fine-grained control on hiding/showing cells: you can choose to hide entire cells, just the output, or just the input. Furthermore, you can embed cells in collapsible elements that are open or closed by default. - Ability to write tests directly in notebooks without having to learn special APIs. These tests get executed in parallel with a single CLI command. You can even define certain groups of tests such that you don't have to always run long-running tests. - Tools for merge/conflict resolution with notebooks in a human readable format. - Continuous integration (CI) comes setup for you with GitHub Actions
¶TODO [B] Running Python code in a subprocess with a time limit | Simon Willison’s TILs python
Running Python code in a subprocess with a time limit
¶TODO [B] tiangolo/typer: Typer, build great CLIs. Easy to code. Based on Python type hints. python
Typer, build great CLIs. Easy to code. Based on Python type hints.
¶TODO [C] Allow to customize location of .eggs directory · Issue #1854 · pypa/setuptools python
My code lives in a read-only partition mounted into a Docker container and therefore the build fails:
¶[C] PyInstrument – A statistical Python profile that focuses on the slow parts | Hacker News python
¶[C] python - Extract traceback info from an exception object - Stack Overflow pythonerrors
There's a very good reason the traceback is not stored in the exception; because the traceback holds references to its stack's locals, this would result in a circular reference and (temporary) memory leak until the circular GC kicks in. (This is why you should never store the traceback in a local variable.)
¶TODO frustrating: so much duplication pythonpip
there is github topics, github description, readme, pypi readem, readthedocs readme, classifiers etc
¶[D] Hypermodern Python | Lobsters python
Agree. I now have a sudden urge to write a guide how to start from very simple (i.e. system interpreter, no packaging, minimal verification) and how to progress further on. And how to decide what tools do you even need to consider and at which stage. In hindsight as a somewhat experienced Python programmer I can see how each of these tools can be helpful – but if I was a beginner I would be completely overwhelmed.
¶TODO [C] The Hard Part of Learning a Language • Hillel Wayne pythontoblog
¶[B] I've gained massive amounts of random Python knowledge over the past month of actively working on my projects pythontoblog
but I have no idea how to communicate it.
some problems are just obscure to write a proper blog post or something
self-answering stackoverflow questions??
¶TODO [D] python - How can I make setuptools install a package that's not on PyPI? - Stack Overflow python
https://stackoverflow.com/questions/3472430/how-can-i-make-setuptools-install-a-package-thats-not-on-pypi
why python sucks: dependencies
¶[C] pypa/gh-action-pypi-publish: GitHub Action for publishing pre-built distribution packages to PyPI (from `dist/` dir) pythongithubci
- name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@master with: user: __token__ password: ${{ secrets.pypi_password }}
so much indirection!!
¶[C] Publishing package distribution releases using GitHub Actions CI/CD workflows — Python Packaging User Guide pythongithubci
¶TODO [C] uva-graphics/autoimp: Automatic Python imports python
The autoimp module imports all available Python modules automatically at the Python interactive prompt, similarly to Matlab:
¶[D] My Python setup for 2020 | Noam Elfanbaum https://noamelf.com/posts/my-python-setup-for-2020/ python
pyenv install 3.8.0 pyenv shell 3.8.0 https://noamelf.com/posts/my-python-setup-for-2020/
¶TODO [D] Vendoring Python dependencies with pip - Underdog.io Engineering Team - Medium https://medium.com/underdog-io-engineering/vendoring-python-dependencies-with-pip-b9eb6078b9c0 python
¶[D] PyPy - Performance https://pypy.org/performance.html#profiler python
PyPy 2.6 introduced vmprof, a very-low-overhead statistical profiler. The standard, non-statistical cProfile is also supported, and can be enabled without turning off the JIT. We do recommend vmprof anyway because turning on cProfile can distort the result (sometimes massively, though hopefully this should not be too common).
¶[D] Please Fix Your Decorators · Homepage of Hynek Schlawack https://hynek.me/articles/decorators/ python
If your Python decorator unintentionally changes the signatures of my callables or doesn’t work with class methods, it’s broken and should be fixed. Sadly most decorators are broken because the web is full of bad advice.
¶[D] bast/somepackage: Show how to structure a Python project. https://github.com/bast/somepackage python
¶TODO [D] holtzy/The-Python-Graph-Gallery: A website displaying hundreds of charts made with Python https://github.com/holtzy/The-Python-Graph-Gallery pythonviz
¶[D] Debugging Jupyter notebooks - David Hamann https://davidhamann.de/2017/04/22/debugging-jupyter-notebooks/ python
There’s also ipdb but importing and calling it directly only works in the terminal, not in notebooks (see this issue).
¶[D] python-poetry/poetry: Python dependency management and packaging made easy. https://github.com/python-poetry/poetry python
In other words, poetry uses pyproject.toml to replace setup.py, requirements.txt, setup.cfg, MANIFEST.in and the newly added Pipfile.
¶TODO [C] Do You Have Any Offline Programming Techniques or Tools? | Lobsters python
import pdb; pdb.pm() starts a post-mortem debugger. When you get an error in an interactive session (such as a Jupyter notebook), this will jump to the scene of the error, let you inspect local variables, and let you walk up and down the stack.
¶[D] pschanely/CrossHair: A static analysis tool for Python that blurs the line between testing and type systems. https://github.com/pschanely/CrossHair python
¶[D] egg-info in local directory makes pip think package is installed · Issue #6558 · pypa/pip python
egg-info in local directory makes pip think package is installed
¶[D] I hate easy-install.pth · Issue #929 · fonttools/fonttools python
I hate easy-install.pth
shit. I guess this explains why it was finding mypkgs…
¶[D] macropy: syntactic macros for Python | Lobsters python
acropy is excellent when one wants to use syntactic macros. One problem I had was that, for my scripts, I cannot directly use macropy and other syntax modifiers since they rely on the import hooks, which means that you can not use them directly on the script file. You have to import them separately, which makes their use cumbersome. This was my project to work around this issue. It works, but is very hacky, and requires adding a new codec to the Python installation.
¶[D] Installation — HoloViews 1.13.3 documentation python
HoloViews is an open-source Python library designed to make data analysis and visualization seamless and simple. With HoloViews, you can usually express what you want to do in very few lines of code, letting you focus on what you are trying to explore and convey, not on the process of plotting.
¶[C] ok, naming test modules the same as originals doesn't end up well… python
e.g. when I was writing pytest tests/core/test_pandas.py
vs pytest tests/core/pandas.py
¶[C] python - Using property() on classmethods - Stack Overflow python
Python 3.9 2020 UPDATE You can just use them together (taken from the 3.9 docs): class G: @classmethod @property def __doc__(cls): return f'A doc for {cls.__name__!r}'
¶[B] Web Scraping 101 with Python | Hacker News python
import pandas as pd dfs = pd.read_html(url)
wow. can scrape off table elements?
¶TODO [C] –system-site-packages? pythonpipx
¶TODO [C] strptime idea – cache time string and somehow speed up? python
could be like re.Pattern, or with automatic cache?
¶TODO [B] hmm, maybe possible to self-pack minimal package in setup.py? could work… python
¶[C] djrobstep/logx: best practice, zero config python logging pythonlogging
reasonable list (aka why python logging sucks by default)
¶TODO [C] thebjorn/pydeps: Python Module Dependency graphs https://github.com/thebjorn/pydeps pythonproject
¶[C] Hello flake8 • Dimitri Merejkowsky pythonpylint
Itamar Turner-Trauring 2, in the comment section on dev.to gave an interesting example:
handling accidental variable capture in closures
¶TODO [C] leeoniya/uPlot: 📈 A small, fast chart for time series, lines, areas, ohlc & bars pythondataviz
focus on performance?
¶[C] cleanup; remove unused imports by seanbreckenridge · Pull Request 151 · karlicoss/HPI pythonflake8
find ./my | entr flake8 --ignore=E402,E501,E741,W503,E266,E302,E305,E203,E261,E252,E251,E221,W291,E225,E303,E702,E202,F841,E731,E306,E127 E722,E231 my | grep -v __NOT_HPI_MODULE__
¶[B] Iterables vs. Iterators vs. Generators » nvie.com python
good tutorial
¶[C] hhatto/autopep8: A tool that automatically formats Python code to conform to the PEP 8 style guide. python
Seems like a more sensible alternative to black
¶[B] python - Suspend on exception in pdb - Stack Overflow pythondebug
You're looking for postmortem mode: try: code_that_may_raise_exception() except Exception: import pdb; pdb.post_mortem() This will break on exception and drop you into a debugger right where it is being raised from
nice! a bit magical, but works exactly as described
¶TODO [B] tips about putting test next to code pythontoblog
- no overhead about creating new files
- no need to worry about pythonpaths etc
how to:
- pytest imports in the function itself
- defensive decorator?
- fixtures still work! like tmppath
TODO mention doctests? pros/cons. how to set up common env for doctests?
¶TODO [B] How to make an unaware datetime timezone aware in python - Stack Overflow pythontz
>> unaware.replace(tzinfo=ZoneInfo('localtime')) datetime.datetime(2020, 10, 31, 12, 0, tzinfo=zoneinfo.ZoneInfo(key='localtime')) >>> str(_) '2020-10-31 12:00:00+01:00' pip install backports.zoneinfo
¶[C] python - How do I parse an ISO 8601-formatted date? - Stack Overflow python
Although strptime can parse the 'Z' character to UTC, fromisoformat is faster by ~ x40 (see also: A faster strptime):
¶TODO [B] setuptools - python: simple example for a python egg with a one-file source file? - Stack Overflow pythonpip
You can use the py_modules argument instead of the packages argument to list single file modules. See https://docs.python.org/3/distutils/setupscript.html#listing-individual-modules
¶[C] Utilities — Click Documentation (7.x) pythoncli
progress bars, nice
¶TODO [B] pythonql/pythonql: A Query Language extension for Python: Query files, objects, SQL and NoSQL databases with a built-in query language python
PythonQL is implemented as a special encoding in a normal python script. When this encoding is specified, the pythonql preprocessor is run, which converts the pythonql syntax to pure python. So you should have a line in the beginning of your script: #coding: pythonql result = [ select y for x in [1,2,3] let y = x**2 ]
whoa
¶[C] PythonPackagingTerminology - Python Wiki pythonpip
*.egg-link files that contain the name of a built or development egg, to support symbolic linking on platforms that do not have native symbolic links.