Hi there! Internet Explorer is no longer supported.

Please use a modern web browser such as Firefox, Chromium or Edge. Thank you!

Python Practices

Python Practices.

Naming conventions - PEP8

Using well known conventions makes easier for other developers to understand your code and maintain it in the future.

Namespacing

Use proper namespacing to avoid conflicts with existing packages. It is preferred to put any FreeCAD code in a sub-module of the freecad base namespace.

Tooling

Code formatting and linting

Project management

The modern tooling for python is uv, it replaces pip and manage dependencies, project metadata, virtual environments, etc… and it is 10x faster than pip.

uv Documentation

Typing

Type hints makes the code safer and more easy to maintain and refactor.

There are many static type checkers:

Python versions

Current supported python versions in FreeCAD are 3.10+, but some addons may not work with latest python versions.