Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в Python 3.3
Что он означает?
Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py.
Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета".
Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта.
Конечно, не любую в файловой системе, а только те что находятся в sys.path.
Это значит, что теперь __init__.py нужно делать только если:
🔸 вам требуется создать код инициализации пакета
🔸 нужна совместимость со старыми версиями Python
На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего.
Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов.
repo_name/
my_library/
__init__.py
main.py
examples/
exam1.py
exam2.py
В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет.
Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет!
#basic#pep
#html
The Agent Development Kit (ADK) is an open-source toolkit that helps you build, test, and deploy advanced AI agents easily. It lets you create flexible, multi-agent systems using Python or Java, supports many AI models, and works with different deployment options. ADK offers a rich set of tools, built-in monitoring, and simple integration with Google services, making it easier to develop, debug, and scale your AI applications. This means you can focus on creating smart, efficient agents without worrying about complex setup or compatibility issues.
https://github.com/google/adk-docs
#html
You get access to a huge, well-organized collection of 2,053 ready-to-use n8n automation workflows covering 365 different services, all searchable instantly with a super fast, mobile-friendly documentation system. This system offers lightning-fast full-text search, smart categorization by service and use case, and clear, meaningful workflow names, making it easy to find exactly what you need. You can run the documentation locally with simple setup steps, explore workflows by category or complexity, and even download or visualize them. This saves you time and effort in building automations, helps you discover proven workflows quickly, and supports efficient workflow management and customization.
https://github.com/Zie619/n8n-workflows
#html
The International Obfuscated C Code Contest (IOCCC) is a programming contest where participants write the most confusing and hard-to-understand C code, often under 512 bytes. It started in 1984 to highlight bad coding styles and show how poor structure can ruin a program. The contest uses satire to teach programmers about C’s tricky parts and the importance of clear coding by showing what not to do. Winning entries are both educational and entertaining, helping you learn subtle C language details while having fun. The contest encourages you to explore and understand complex code, improving your programming skills and appreciation for good style.
https://github.com/ioccc-src/winner
#html
You can easily create a secure Octra blockchain wallet by running a simple webserver on your computer. Just clone the wallet generator from GitHub, start the server, and open your browser to generate a new wallet. The tool shows your mnemonic phrase, private and public keys, and address, lets you test signatures, derive addresses for different networks, and automatically saves your wallet file. This helps you safely manage your Octra blockchain assets with full control over your keys and easy access to wallet features without needing complex setups. It’s a user-friendly way to secure and use your Octra wallet locally.
https://github.com/octra-labs/wallet-gen
#html
"开往 Travellings" is a project that helps unknown websites get more visitors. It does this by creating a network where users can click a button to randomly visit other participating sites. This project started in 2020 and aims to make the internet more diverse and open. By joining, users can discover new sites and help smaller websites grow. It benefits users by introducing them to new content and supporting lesser-known creators.
https://github.com/travellings-link/travellings
Is Skia the works-everywhere feature-rich text rendering engine I’ve always been looking for? It seems to work on all sorts of platforms, even on #HTML Canvas with WebAssembly (!)
It even used to have particles support, but was sadly removed from 2 months ago.
https://skia.org/
🐘
Frontend
2-dars. HTML asoslari(davomi)
-Formalar bilan ishlash
-Table bilan ishlash
-Layout va semantik taglar
Mentor : Mahammadamin Abbosov
#frontend#html
👉Telegram | Instagram | YouTobe