Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] core, contributing: adapt to PEP420 native namespace #11914

Closed
wants to merge 1 commit into from

Conversation

kmagusiak
Copy link
Contributor

@robodoo
Copy link
Collaborator

robodoo commented Jan 29, 2025

Pull request status dashboard

@kmagusiak kmagusiak force-pushed the master-init-pep420-krma branch 2 times, most recently from 8a6f2c7 to d8ee081 Compare January 30, 2025 08:05
@C3POdoo C3POdoo requested review from a team, Gorash and HydrionBurst and removed request for a team January 30, 2025 09:31
@Feyensv Feyensv changed the title [IMP] PEP420 native namespace [IMP] core, developers: adapt to PEP420 native namespace Jan 30, 2025
@Feyensv Feyensv changed the title [IMP] core, developers: adapt to PEP420 native namespace [IMP] core, contributing: adapt to PEP420 native namespace Jan 30, 2025
Copy link
Collaborator

@Feyensv Feyensv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robodoo delegate+

@kmagusiak kmagusiak force-pushed the master-init-pep420-krma branch from d8ee081 to ae8a861 Compare February 5, 2025 16:13
@kmagusiak kmagusiak force-pushed the master-init-pep420-krma branch from ae8a861 to f4968ed Compare February 6, 2025 15:24
@kmagusiak
Copy link
Contributor Author

@robodoo r+

robodoo pushed a commit to odoo/odoo that referenced this pull request Feb 7, 2025
Stop using deprecated `odoo.registry` method.

Part-of: #195664
Related: odoo/documentation#11914
Signed-off-by: Raphael Collet <[email protected]>
robodoo pushed a commit to odoo/odoo that referenced this pull request Feb 7, 2025
Check whether the timezone is patched when importing Odoo modules.

Part-of: #195664
Related: odoo/documentation#11914
Signed-off-by: Raphael Collet <[email protected]>
robodoo pushed a commit to odoo/odoo that referenced this pull request Feb 7, 2025
Scan `odoo` module as if it were a native namespace.
Prepration for PEP420.

Part-of: #195664
Related: odoo/documentation#11914
Signed-off-by: Raphael Collet <[email protected]>
robodoo pushed a commit to odoo/odoo that referenced this pull request Feb 7, 2025
Native namespaces are modules that do not have an `__init__.py` file.
Python will make a union of all folders in its PYTHONPATH (sys.path) and
combine the modules found in these locations. Currenly, `odoo` uses
legacy namespace packages and implements this in an imperative way.

Using native namespaces allows for easier and more standard packaging
without conflicting libraries. It also allows tools that do static
analysis to find the files.

We move the code in the `odoo/__init__.py` file to its own package
`odoo.init` that is imported when the framework is starting. That
package should be imported first inside the framework to make sure all
monkeypatches are applied.

task-4035335
https://peps.python.org/pep-0420/

closes #195664

Related: odoo/documentation#11914
Signed-off-by: Raphael Collet <[email protected]>
robodoo pushed a commit that referenced this pull request Feb 7, 2025
task-4035335

closes #11914

Related: odoo/odoo#195664
Signed-off-by: Krzysztof Magusiak (krma) <[email protected]>
@robodoo robodoo added the 18.2 label Feb 7, 2025
@robodoo robodoo closed this Feb 7, 2025
@kmagusiak kmagusiak deleted the master-init-pep420-krma branch February 7, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants