Вторая по частоте future-функция, которую я использовал, это абсолютный импорт
from __future__ import absolute_import
Что она делает?
Изменения, которые вносит эта инъекция описаны в PEP328
Покажу простой пример.
Допустим, есть такой пакет:
/my_package
/__init__.py
/main.py
/string.py
Смотрим код в my_package/main.py
# main.py
import string
Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта:
1. модуль в моём пакете my_package.string
2. стандартный модуль string
И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string.
Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать.
from my_package import string
или относительный импорт, но с указанием пути относительно текущего модуля main
from . import string
Еще одной неоднозначностью меньше 😎
Подробней про импорты здесь:
https://docs.python.org/3/tutorial/modules.html
#2to3#pep#basic
#java#docker#mybatis#oss#springboot#vue
RuoYi-Vue-Plus is a free, open-source backend framework upgraded from RuoYi for distributed clusters and multi-tenant use, built with Spring Boot 3.5, Vue3, TypeScript, MyBatis-Plus, and Redisson. It offers superior features like plugin decoupling, advanced permissions, multi-database support, workflows, code generation, Docker deployment, monitoring, and data security tools—far beyond original RuoYi. You benefit by building scalable enterprise apps 80% faster with less code, easier maintenance, and robust security for production. Warning: Versions ≤5.5.3 have critical flaws (CVE-2025-66916 RCE, CVE-2026-2819 auth bypass); update immediately.
https://github.com/dromara/RuoYi-Vue-Plus
#SpringBoot#RESTAPI#BackendDevelopment#CodeWithMosh#Java#StripeIntegration#CloudDeployment#LearnToCode
🚀 Ready to take your backend skills to the next level?
🔗Spring Boot: Mastering REST API Development🎓
- Learn to build clean, secure RESTful APIs
- Add authentication, role-based access, and JWT security 🔒
- Integrate Stripe for real payment processing 💳
- Deploy your app and database to the cloud ☁️
- Apply industry best practices for production-ready code 🛠
👉 Join now @repo_science and start building real-world projects like a pro!
#javascript#approval_process#cms#crm#ehr#erp#hr#layui#mysql#oa#privileges#redis#skyeye#springboot#springboot2#springcloud_vue#websocket
This platform uses Springboot, Layui, UNI-APP, and Ant Design Vue to create a low-code system for intelligent manufacturing. It includes over 30 application modules and more than 50 electronic workflows, covering CRM, ERP, MES, and more. This system streamlines business processes from customer relations to production and after-sales service, improving efficiency and data transparency. It also manages employee operations, providing a comprehensive solution for businesses. The benefits include faster development, reduced redundancy, and enhanced data management, making it ideal for companies seeking digital transformation.
https://github.com/dromara/skyeye