Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
The Freedom Flotilla Coalition invites you to join us from May 30th to June 1st in Catania, Sicily, Italy, as we stand together in solidarity to launch our new mission, the ‘Madleen’.
The summit will be happening in Porto di San Giovanni li Cuti, where we will stand in solidarity with the Palestinian people in a series of panels, cultural programs, and community gatherings.
The ‘Madleen‘ will sail to break Israel's illegal siege as we bring humanitarian aid, hope, and solidarity to Gaza. The world stands united against the deliberate starvation, genocide, Apartheid, colonial occupation, and the ethnic cleansing of the Palestinian people. Join us!
Let's sail in spirit and solidarity. Free Palestine!
#FreedomFlotilla#BreakIsraelsSiege#EndTheBlockade#StandWithGaza#AllEyesOnDeck#Madleen#Conscience
Meet just some of the panelists, volunteers and supporters that will join us as we launch the ‘Madleen’ that will sail in a matter of days to break Israel's illegal siege of Gaza.
We urge media, press and supporters to join us in Catania, Sicily - your coverage and solidarity is critical in helping ensure our safety. March with us. Make noise with us. Show the world that Europe will not be silent. Share our content. Make it impossible for every politician, for the European Union and media to ignore what is happening in Gaza. Make it impossible for them to ignore the voice of the people, to ignore this mission, and to ignore this moment.
#BreakTheSiege#BreakIsraelsSiege#AllEyesOnDeck#EndTheBlockade#StandWithGaza#AllEyesOnDeck#Madleen#Conscience
Meet the 12 volunteers from around the world, who are sailing on 'Madleen' in the Freedom Flotilla Coalition's steadfast mission to break Israel's illegal siege of Gaza and establish a people's sea corridor:
Baptiste Andre 🇫🇷
Greta Thunberg 🇸🇪
Şuayb Ordu 🇹🇷
Mark van Rennes 🇳🇱
Omar Faiad 🇫🇷
Pascal Maurieras 🇫🇷
Reva Viard 🇫🇷
Rima Hassan 🇫🇷
Sergio Toribio 🇪🇸
Thiago Ávila 🇧🇷
Yanis Mhamdi 🇫🇷
Yasemin Acar 🇩🇪
Let their names be known, as they hold the people's hearts and courage, and carry solidarity to Palestinians in Gaza.
#AllEyesOnDeck#Madleen#Conscience#BreakTheSiege#EndOccupation#FreePalestine#FreedomFlotilla
The Israeli military has attacked our flotilla. We call on all our governments and people of the world to condemn Israel’s crimes against humanity, and to demand the immediate release of all abducted crew. Our governments must end Israel’s illegal blockade and ongoing genocide of Gaza.
🚨 Take action NOW:
•Tag, email, and call your Ministry of Foreign Affairs and elected officials
• Join or organise a protest in your city
• Boycott Israeli products and companies
• Pressure your government to enforce an arms embargo and diplomatic sanctions on Israel
• Pressure institutions and your work place to divest from and sanction Israel
• Use the 'RISEFOR' campaign to pressure your government in 2 minutes
• Donate or join the next wave of flotilla - we will not stop until Palestine is free. Share this call widely on social media and with your network
#BreakIsraelsSiege#ActNow#Conscience#GazaFreedomFlotilla#ThousandMadleensToGaza#FreePalestine
We will sail. Since our ship was attacked on May 2, Israel has killed nearly 2,000 more Palestinians. Meanwhile, 14,000 babies now face imminent death from hunger due to Israel’s deliberate starvation campaign. This is the cost of global impunity. But we refuse to back down.
The ‘Madleen’ will sail soon. She may be small, but her mission is powerful: To break the silence. To challenge Israel’s illegal blockade through nonviolent direct action. To stand firmly and unapologetically, with Gaza.
JOIN US. Registrations are open for experienced and committed captains, crew, volunteers, and boat owners. You will be vetted and contacted only if successful: https://bit.ly/joinfreedomflotillaform
To those who can help us on land, sign our petition for an investigation into the attacks, demand your governments ensure safe passage for the 'Madleen’, and share this journey - because the more eyes on us, the safer we are.
#WeWillSail#Madleen#Conscience#FreeGaza#EndTheSiege#AllEyesOnDeck#StopArmingIsrael
Israel’s attack on an unarmed humanitarian vessel in European waters, and the government silence that followed, is part of a wider pattern: 19 months of Israel's relentless violence in Gaza and 77 years of impunity across occupied Palestine.
While Malta’s newly released report confirms what we already knew, there has still been no condemnation issued. No investigation. No accountability.
As we prepare to sail again with ‘Madleen’, we do so knowing our ships remain targets, not only of Israeli aggression but of global inaction.
We call on governments to guarantee safe passage, on media to report the truth, and on people everywhere to demand an end to Israel’s siege and ongoing genocide:
– Share this post and tag the EU Commission and your MEPs
– Sign our petition to demand an independent investigation
– Demonstrate at weapons manufacturers
– Keep #AllEyesOnDeck as ‘Madleen’ sails
#BreakTheSiege#EndTheBlockade#StandWithGaza#StandWithPalestine#EU#Malta#Conscience