Coder Social home page Coder Social logo

Color builtin modules differently about tuna HOT 8 CLOSED

nschloe avatar nschloe commented on August 19, 2024 1
Color builtin modules differently

from tuna.

Comments (8)

nschloe avatar nschloe commented on August 19, 2024

sys.builtin_module_names gives a list of compiled built-in modules. On my machine, that is

('_ast',
 '_bisect',
 '_blake2',
 '_codecs',
 '_collections',
 '_datetime',
 '_elementtree',
 '_functools',
 '_heapq',
 '_imp',
 '_io',
 '_locale',
 '_md5',
 '_operator',
 '_pickle',
 '_posixsubprocess',
 '_random',
 '_sha1',
 '_sha256',
 '_sha3',
 '_sha512',
 '_signal',
 '_socket',
 '_sre',
 '_stat',
 '_string',
 '_struct',
 '_symtable',
 '_thread',
 '_tracemalloc',
 '_warnings',
 '_weakref',
 'array',
 'atexit',
 'binascii',
 'builtins',
 'errno',
 'faulthandler',
 'fcntl',
 'gc',
 'grp',
 'itertools',
 'marshal',
 'math',
 'posix',
 'pwd',
 'pyexpat',
 'select',
 'spwd',
 'sys',
 'syslog',
 'time',
 'unicodedata',
 'xxsubtype',
 'zipimport',
 'zlib')

This is missing things like argparse, datetime etc. Hm.

from tuna.

nschloe avatar nschloe commented on August 19, 2024

I've simply hardcoded the list of built-in modules now. Hopefully, we'll find a more aesthetically pleasing solution in the future.

from tuna.

eric-wieser avatar eric-wieser commented on August 19, 2024

That list is missing _ctypes, _bz2, posixpath, genericpath, ntpath, and a few others. Could potentially depend on https://pypi.org/project/stdlib-list/, but that adds the need for network access.

from tuna.

nschloe avatar nschloe commented on August 19, 2024

It appears that https://pypi.org/project/stdlib-list is unmaintained. Crucially, Python 3.7 isn't supported (yet?). I guess there's no way around us maintaining our own lists unfortunately. And I'm not too sure what to think about adding private modules to the list...

from tuna.

eric-wieser avatar eric-wieser commented on August 19, 2024

@nschloe: I doubt it needs any maintenance - all it seems to do is scrape the sphinx data from the python docs. As long as the sphinx urls remain the same, it should work for all future python versions

from tuna.

nschloe avatar nschloe commented on August 19, 2024

Ah, I'd been looking at https://github.com/jackmaney/python-stdlib-list/tree/master/stdlib_list/lists.

from tuna.

eric-wieser avatar eric-wieser commented on August 19, 2024

Hmm, I think you're right. Looks like the sphinx script is just used to generate those lists at commit-time. Probably fairly straightforward to rerun fetch, and create a PR with the 3.7 defs.

from tuna.

nschloe avatar nschloe commented on August 19, 2024

Probably fairly straightforward to rerun fetch, and create a PR with the 3.7 defs.

I think so. I've submitted an issue, let's see if the developer shows up sometime.

from tuna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.