Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
A sudden scooty explosion was reported near the headquarters of the Border Security Force (BSF) in Punjab's Jalandhar district. The high-security location of the blast has added urgency to an already serious situation. Police investigating all angles. Fortunately no one was hurt. #nationalsecurity
3 accused have been charged in Ahmedabad in ISIS-linked Jihadi bioterrorism conspiracy to carry out mass poisoning in public spaces. Hyderabad-based doctor Syed Ahmed Mohiuddin, and co-accused Azad & Suhel from U.P, have been charged under UA (P) Act, BNS and Arms Act. #nationalsecurity
Recent imagery from Pakistan shows reconstruction work at the "terror-linked" targets India struck in May 2025, previously damaged structures are being restored, demolitions & debris continue to be removed nearly a year after the strike. #nationalsecurity
https://www.indiatoday.in/world/story/jaish-rebuilds-bahawalpur-base-muzaffarabad-after-operation-sindoor-satellite-images-show-2906805-2026-05-05
In March 1966, IAF bombed Mizoram, due to insurgency threats
In May 1967, Naxalism started in India.
Sixty years later, both of these Internal security threats are over within a span of a month.
#NationalSecurity
NIA teams are spread across various districts, including South 24 Parganas, Hooghly, Nadia, and Kolkata ahead of polling. Teams are probing the cases of recovery of crude bombs, illegal arms and ammunitions. Teams are also on ground to immediately respond if a situation arises during, after or before polling #NationalSecurity
On 18th and 19th April, the Enforcement Directorate conducted raids at several locations linked to a Christian evangelical organisation named The Timothy Initiative, TTI.
In a press release, the ED said that it is investigating how TTI channelled over Rs 95 crore into India using foreign banks issued debit cards (Truist Bank, 🇺🇸) while completely skipping FCRA regulations.
TTI funneled money using these cards to build churches(and maybe more) in naxal affected districts of Chattisgarh.
#nationalsecurity
https://x.com/i/status/2047643801460805854
Punjab (Patiala):
Man dies while attempting to blow up railway track near Shambhu border. No damage or other casualties.
Police recovered evidence (incl. SIM), probe underway with GRP & RPF to uncover larger conspiracy.
#NationalSecurity
Center puts 2029 as the deadline to end Insurgency across the North East.
Major Realignment of CAPFs been planned after West Bengal Election, Amarnath Yatra ends.
#NationalSecurity
In a significant development, the Union Ministry of Home Affairs (MHA) has handed over a case related to the recovery of crude bombs in West Bengal to the National Investigation Agency (NIA), citing serious national security concerns and the need to probe a larger conspiracy.
#NationalSecurity