xdev-1.5.4
توضیحات
An excellent developer tool for excellent developers
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | xdev-1.5.4 |
| نام | xdev |
| نسخه کتابخانه | 1.5.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Jon Crall |
| ایمیل نویسنده | erotemic@gmail.com |
| آدرس صفحه اصلی | https://github.com/Erotemic/xdev |
| آدرس اینترنتی | https://pypi.org/project/xdev/ |
| مجوز | Apache 2 |
Xdev - Excellent Developer
--------------------------
|GithubActions| |Codecov| |Pypi| |Downloads| |ReadTheDocs|
+------------------+------------------------------------------+
| Read the docs | https://xdev.readthedocs.io |
+------------------+------------------------------------------+
| Github | https://github.com/Erotemic/xdev |
+------------------+------------------------------------------+
| Pypi | https://pypi.org/project/xdev |
+------------------+------------------------------------------+
Xdev is an excellent developer tool for excellent developers.
It contains miscellaneous and/or interactive debugging tools.
This started as a project for myself to contain development related tools that
I wouldn't want to ship with a package itself (where as `ubelt
<https://github.com/Erotemic/ubelt>`_ contains the tools used in programs
themselves). I've polished it up over the years, and it's become a reasonably
useful package with tools I could see others making use of.
This is the CLI:
.. code::
usage: xdev [-h] [--version] {info,codeblock,sed,find,tree,pint,pyfile,pyversion,editfile,format_quotes,freshpyenv,docstubs,available_package_versions,dirstats} ...
The XDEV CLI
A collection of excellent developer tools for excellent developers.
options:
-h, --help show this help message and exit
--version show version number and exit (default: False)
commands:
{info,codeblock,sed,find,tree,pint,pyfile,pyversion,editfile,format_quotes,freshpyenv,docstubs,available_package_versions,dirstats}
specify a command to run
info Info about xdev
codeblock Remove indentation from text.
sed Search and replace text in files
find Find matching files or paths in a directory.
tree List a directory like a tree
pint (convert_unit)
Converts one type of unit to another via the pint library.
pyfile (modpath) Prints the path corresponding to a Python module.
pyversion (modversion)
Detect and print the version of a Python module or package.
editfile (edit) Opens a file in your visual editor determined by the ``VISUAL``
format_quotes Use single quotes for code and double quotes for docs.
freshpyenv Create a fresh environment in a docker container to test a Python package.
docstubs (doctypes)
Generate Typed Stubs from Docstrings (experimental)
available_package_versions (availpkg)
Print a table of available versions of a python package on Pypi
dirstats Analysis for code in a repository
.. .... mkinit xdev
This is the top level API:
.. code:: python
from xdev import algo
from xdev import autojit
from xdev import class_reloader
from xdev import cli
from xdev import desktop_interaction
from xdev import embeding
from xdev import format_quotes
from xdev import interactive_iter
from xdev import introspect
from xdev import misc
from xdev import patterns
from xdev import profiler
from xdev import regex_builder
from xdev import search_replace
from xdev import tracebacks
from xdev import util
from xdev import util_networkx
from xdev import util_path
from xdev.algo import (edit_distance, knapsack, knapsack_greedy, knapsack_ilp,
knapsack_iterative, knapsack_iterative_int,
knapsack_iterative_numpy, number_of_decimals,)
from xdev.autojit import (import_module_from_pyx,)
from xdev.class_reloader import (reload_class,)
from xdev.desktop_interaction import (editfile, startfile, view_directory,)
from xdev.embeding import (EmbedOnException, embed, embed_if_requested,
embed_on_exception, embed_on_exception_context,
fix_embed_globals,)
from xdev.format_quotes import (DOUBLE_QUOTE, SINGLE_QUOTE,
TRIPLE_DOUBLE_QUOTE, TRIPLE_SINGLE_QUOTE,
format_quotes, format_quotes_in_file,
format_quotes_in_text,)
from xdev.interactive_iter import (InteractiveIter,)
from xdev.introspect import (distext, get_func_kwargs, get_stack_frame,
iter_object_tree, test_object_pickleability,)
from xdev.misc import (byte_str, difftext, nested_type, quantum_random,
set_overlaps, textfind, tree_repr,)
from xdev.patterns import (MultiPattern, Pattern, PatternBase, RE_Pattern,
our_extended_regex_compile,)
from xdev.profiler import (IS_PROFILING, profile, profile_globals,
profile_now,)
from xdev.regex_builder import (PythonRegexBuilder, RegexBuilder,
VimRegexBuilder,)
from xdev.search_replace import (GrepResult, find, grep, grepfile, greptext,
sed, sedfile,)
from xdev.tracebacks import (make_warnings_print_tracebacks,)
from xdev.util import (bubbletext, conj_phrase, take_column,)
from xdev.util_networkx import (AsciiDirectedGlyphs, AsciiUndirectedGlyphs,
UtfDirectedGlyphs, UtfUndirectedGlyphs,
generate_network_text, graph_str,
write_network_text,)
from xdev.util_path import (ChDir, sidecar_glob, tree,)
Remarks
-------
Perhaps I should just use `ipdb` but I often just like to directly embed with
IPython whenever I want:
.. code:: python
import xdev
xdev.embed()
Or wherever I want whenever there is an exception.
.. code:: python
import xdev
with xdev.embed_on_exception:
some_code()
I don't feel like I need `ipdb <https://github.com/gotcha/ipdb>`_'s other features.
I also like to
.. code:: python
def func(a=1, b=2, c=3):
"""
Example:
>>> from this.module import * # import contextual namespace
>>> import xinspect
>>> globals().update(xinspect.get_func_kwargs(func)) # populates globals with default kwarg value
>>> print(a + b + c)
6
"""
But I know these things are a little dirty.
But these aren't production practices. These are development tricks and life
hacks to make working faster.
Also see ``xinspect`` for things like ``autogen_imports``
.. code:: python
>>> import ubelt as ub
>>> source = ub.codeblock(
>>> '''
>>> p = os.path.dirname(join('a', 'b'))
>>> glob.glob(p)
>>> ''')
>>> # Generate a list of lines to fix the name errors
>>> lines = autogen_imports(source=source)
>>> print(lines)
['import glob', 'from os.path import join', 'import os']
The CLI
-------
The xdev CLI is getting kinda nice, although it is a bit of a hodgepodge of
functionality (much like this library).
.. code::
pip install xdev
xdev --help
It contains functionality that I generally use when developing on my setup, but
I often find lacking in the setup of others.
For instance the `tree <https://en.wikipedia.org/wiki/Tree_(command)>`_ UNIX
command is amazing, but not everyone has it installed, and getting it via
``apt`` requires sudo privileges. Meanwhile xdev can be installed in user space
via pip, so this provides me with an easy way to get ``tree`` on someone's
system while helping them debug.
Other examples are ``sed``, ``find``, ``pyfile``, and ``pyversion``. Look at
the ``--help`` for more info on them.
The ``dirstats`` function is like a buffed up ``tree``. In addition to printing
the directory tree structure it inspects the contents of the tree and
summarizes things like: number of lines per type of file. For Python files it
breaks up the analysis into code-lines and docstring lines to give a better
sense of project complexity.
For repo maintence I use this package in conjunction with `xcookie
<https://github.com/Erotemic/xcookie>`_. I use xcookie to generate the package
structure and then xdev helps fill in the details. Specifically the
``availpkg`` and ``docstubs`` commands.
The ``availpkg`` command has been indispensable for me when writing
requirements.txt files. If you need to find good versions of a package ---
especially a binary one, e.g. numpy --- for different versions of Python and
would like the appropirate requirements.txt syntax to be generated for you,
take a look at ``availpkg``. It also provides an overview of what versions of a
package are available for what operating systems / CPU architectures.
The ``docstubs`` command is designed to turn google-style docstrings into
proper type annotation stubs. It "works on my machine" and currently requires
a custom monkey patched mypy. See the code for details, it is possible to use,
but it is still very raw. I do think it can evolve into a tool.
.. |Appveyor| image:: https://ci.appveyor.com/api/projects/status/github/Erotemic/xdev?branch=master&svg=True
:target: https://ci.appveyor.com/project/Erotemic/xdev/branch/master
.. |Codecov| image:: https://codecov.io/github/Erotemic/xdev/badge.svg?branch=master&service=github
:target: https://codecov.io/github/Erotemic/xdev?branch=master
.. |Pypi| image:: https://img.shields.io/pypi/v/xdev.svg
:target: https://pypi.python.org/pypi/xdev
.. |Downloads| image:: https://img.shields.io/pypi/dm/xdev.svg
:target: https://pypistats.org/packages/xdev
.. |ReadTheDocs| image:: https://readthedocs.org/projects/xdev/badge/?version=latest
:target: http://xdev.readthedocs.io/en/latest/
.. |GithubActions| image:: https://github.com/Erotemic/xdev/actions/workflows/tests.yml/badge.svg?branch=main
:target: https://github.com/Erotemic/xdev/actions?query=branch%3Amain
نیازمندی
| مقدار | نام |
|---|---|
| - | ubelt>=1.3.3 |
| - | xinspect>=0.4.0 |
| - | pyfiglet>=0.7 |
| - | pygments>=2.12.0 |
| - | IPython>=7.16.2 |
| - | parse>=1.19.0 |
| - | pyflakes>=2.5.0 |
| - | scriptconfig>=0.7.10 |
| - | lazy_loader>=0.3 |
| ython_versio | numpy>=2.1.0; |
| ython_versio | numpy>=1.26.0; |
| ython_versio | numpy>=1.23.2; |
| ython_versio | numpy>=1.21.6; |
| ython_versio | numpy>=1.21.0; |
| ython_versio | numpy>=1.21.0; |
| ython_versio | networkx>=3.1; |
| ython_versio | networkx>=3.1; |
| ython_versio | networkx>=3.1; |
| ython_versio | networkx>=3.1; |
| - | rich>=12.3.0 |
| - | progiter>=2.0.0 |
| xtr | ubelt>=1.3.3; |
| xtr | xinspect>=0.4.0; |
| xtr | pyfiglet>=0.7; |
| xtr | pygments>=2.12.0; |
| xtr | IPython>=7.16.2; |
| xtr | parse>=1.19.0; |
| xtr | pyflakes>=2.5.0; |
| xtr | scriptconfig>=0.7.10; |
| xtr | lazy_loader>=0.3; |
| python_versio | numpy>=2.1.0; |
| python_versio | numpy>=1.26.0; |
| python_versio | numpy>=1.23.2; |
| python_versio | numpy>=1.21.6; |
| python_versio | numpy>=1.21.0; |
| python_versio | numpy>=1.21.0; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| xtr | rich>=12.3.0; |
| xtr | progiter>=2.0.0; |
| xtr | xdoctest>=1.1.5; |
| python_versio | pytest>=7.0.0; |
| python_versio | pytest>=6.2.5; |
| python_versio | pytest>=4.6.0; |
| python_versio | pytest>=4.6.0; |
| ython_versio | pytest-cov>=3.0.0; |
| ython_versio | coverage>=6.1.1; |
| python_versio | coverage>=5.3.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | Levenshtein>=0.26.1; |
| python_versio | Levenshtein>=0.23.0; |
| python_versio | Levenshtein>=0.20.3; |
| python_versio | Levenshtein>=0.18.2; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| ython_versio | fire>=0.5.0; |
| ython_versio | fire>=0.4.0; |
| python_versio | line_profiler>=4.2.0; |
| python_versio | line_profiler>=4.1.2; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| xtr | yapf>=0.16.3; |
| xtr | autoflake>=1.5.0; |
| python_versio | parso>=0.8.4; |
| python_versio | parso>=0.8.3; |
| ython_versio | parso>=0.8.0; |
| python_versio | pint>=0.24.4; |
| python_versio | pint>=0.23; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| xtr | python_dateutil>=2.8.2; |
| xtr | pytimeparse>=1.1.8; |
| xtr | ubelt>=1.3.3; |
| xtr | xinspect>=0.4.0; |
| xtr | pyfiglet>=0.7; |
| xtr | pygments>=2.12.0; |
| xtr | IPython>=7.16.2; |
| xtr | parse>=1.19.0; |
| xtr | pyflakes>=2.5.0; |
| xtr | scriptconfig>=0.7.10; |
| xtr | lazy_loader>=0.3; |
| python_versio | numpy>=2.1.0; |
| python_versio | numpy>=1.26.0; |
| python_versio | numpy>=1.23.2; |
| python_versio | numpy>=1.21.6; |
| python_versio | numpy>=1.21.0; |
| python_versio | numpy>=1.21.0; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| python_versio | networkx>=3.1; |
| xtr | rich>=12.3.0; |
| xtr | progiter>=2.0.0; |
| xtr | xdoctest>=1.1.5; |
| python_versio | pytest>=7.0.0; |
| python_versio | pytest>=6.2.5; |
| python_versio | pytest>=4.6.0; |
| python_versio | pytest>=4.6.0; |
| ython_versio | pytest-cov>=3.0.0; |
| ython_versio | coverage>=6.1.1; |
| python_versio | coverage>=5.3.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | coverage>=6.1.1; |
| python_versio | Levenshtein>=0.26.1; |
| python_versio | Levenshtein>=0.23.0; |
| python_versio | Levenshtein>=0.20.3; |
| python_versio | Levenshtein>=0.18.2; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| python_versio | Levenshtein>=0.18.0; |
| ython_versio | fire>=0.5.0; |
| ython_versio | fire>=0.4.0; |
| python_versio | line_profiler>=4.2.0; |
| python_versio | line_profiler>=4.1.2; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| python_versio | line_profiler>=4.1.0; |
| xtr | yapf>=0.16.3; |
| xtr | autoflake>=1.5.0; |
| python_versio | parso>=0.8.4; |
| python_versio | parso>=0.8.3; |
| ython_versio | parso>=0.8.0; |
| python_versio | pint>=0.24.4; |
| python_versio | pint>=0.23; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| python_versio | pint>=0.18; |
| xtr | python_dateutil>=2.8.2; |
| xtr | pytimeparse>=1.1.8; |
| xtr | sphinx>=4.3.2; |
| xtr | sphinx-autobuild>=2021.3.14; |
| xtr | sphinx_rtd_theme>=1.0.0; |
| xtr | sphinxcontrib-napoleon>=0.7; |
| xtr | sphinx-autoapi>=1.8.4; |
| xtr | Pygments>=2.9.0; |
| xtr | myst_parser>=0.16.1; |
| xtr | sphinx-reredirects>=0.0.1; |
| xtr | ubelt==1.3.3; |
| xtr | xinspect==0.4.0; |
| xtr | pyfiglet==0.7; |
| xtr | pygments==2.12.0; |
| xtr | IPython==7.16.2; |
| xtr | parse==1.19.0; |
| xtr | pyflakes==2.5.0; |
| xtr | scriptconfig==0.7.10; |
| xtr | lazy_loader==0.3; |
| python_versio | numpy==2.1.0; |
| python_versio | numpy==1.26.0; |
| python_versio | numpy==1.23.2; |
| python_versio | numpy==1.21.6; |
| python_versio | numpy==1.21.0; |
| python_versio | numpy==1.21.0; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| xtr | rich==12.3.0; |
| xtr | progiter==2.0.0; |
| xtr | xdoctest==1.1.5; |
| python_versio | pytest==7.0.0; |
| python_versio | pytest==6.2.5; |
| python_versio | pytest==4.6.0; |
| python_versio | pytest==4.6.0; |
| ython_versio | pytest-cov==3.0.0; |
| ython_versio | coverage==6.1.1; |
| python_versio | coverage==5.3.1; |
| python_versio | coverage==6.1.1; |
| python_versio | coverage==6.1.1; |
| python_versio | coverage==6.1.1; |
| python_versio | Levenshtein==0.26.1; |
| python_versio | Levenshtein==0.23.0; |
| python_versio | Levenshtein==0.20.3; |
| python_versio | Levenshtein==0.18.2; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| ython_versio | fire==0.5.0; |
| ython_versio | fire==0.4.0; |
| python_versio | line_profiler==4.2.0; |
| python_versio | line_profiler==4.1.2; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| xtr | yapf==0.16.3; |
| xtr | autoflake==1.5.0; |
| python_versio | parso==0.8.4; |
| python_versio | parso==0.8.3; |
| ython_versio | parso==0.8.0; |
| python_versio | pint==0.24.4; |
| python_versio | pint==0.23; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| xtr | python_dateutil==2.8.2; |
| xtr | pytimeparse==1.1.8; |
| xtr | ubelt==1.3.3; |
| xtr | xinspect==0.4.0; |
| xtr | pyfiglet==0.7; |
| xtr | pygments==2.12.0; |
| xtr | IPython==7.16.2; |
| xtr | parse==1.19.0; |
| xtr | pyflakes==2.5.0; |
| xtr | scriptconfig==0.7.10; |
| xtr | lazy_loader==0.3; |
| python_versio | numpy==2.1.0; |
| python_versio | numpy==1.26.0; |
| python_versio | numpy==1.23.2; |
| python_versio | numpy==1.21.6; |
| python_versio | numpy==1.21.0; |
| python_versio | numpy==1.21.0; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| python_versio | networkx==3.1; |
| xtr | rich==12.3.0; |
| xtr | progiter==2.0.0; |
| xtr | xdoctest==1.1.5; |
| python_versio | pytest==7.0.0; |
| python_versio | pytest==6.2.5; |
| python_versio | pytest==4.6.0; |
| python_versio | pytest==4.6.0; |
| ython_versio | pytest-cov==3.0.0; |
| ython_versio | coverage==6.1.1; |
| python_versio | coverage==5.3.1; |
| python_versio | coverage==6.1.1; |
| python_versio | coverage==6.1.1; |
| python_versio | coverage==6.1.1; |
| python_versio | Levenshtein==0.26.1; |
| python_versio | Levenshtein==0.23.0; |
| python_versio | Levenshtein==0.20.3; |
| python_versio | Levenshtein==0.18.2; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| python_versio | Levenshtein==0.18.0; |
| ython_versio | fire==0.5.0; |
| ython_versio | fire==0.4.0; |
| python_versio | line_profiler==4.2.0; |
| python_versio | line_profiler==4.1.2; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| python_versio | line_profiler==4.1.0; |
| xtr | yapf==0.16.3; |
| xtr | autoflake==1.5.0; |
| python_versio | parso==0.8.4; |
| python_versio | parso==0.8.3; |
| ython_versio | parso==0.8.0; |
| python_versio | pint==0.24.4; |
| python_versio | pint==0.23; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| python_versio | pint==0.18; |
| xtr | python_dateutil==2.8.2; |
| xtr | pytimeparse==1.1.8; |
| xtr | sphinx==4.3.2; |
| xtr | sphinx-autobuild==2021.3.14; |
| xtr | sphinx_rtd_theme==1.0.0; |
| xtr | sphinxcontrib-napoleon==0.7; |
| xtr | sphinx-autoapi==1.8.4; |
| xtr | Pygments==2.9.0; |
| xtr | myst_parser==0.16.1; |
| xtr | sphinx-reredirects==0.0.1; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl xdev-1.5.4:
pip install xdev-1.5.4.whl
نصب پکیج tar.gz xdev-1.5.4:
pip install xdev-1.5.4.tar.gz