-
Notifications
You must be signed in to change notification settings - Fork 27
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
Deprecations #167
base: master
Are you sure you want to change the base?
Deprecations #167
Conversation
4eedf6b
to
18c30f6
Compare
9d28758
to
52e683c
Compare
please rebase, i upgraded the linters in the workflow. For codespell please add the word to the ignore list in pyproject.toml |
5a8dec6
to
9ab752a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 584 instances of @deprecated
in _Gtk3.pyi
but <doc-deprecated
occurs 719 times in Gtk-3.0.gir
. Quick skim, it looks like properties and constructors can be deprecated too, see e.g. Alignment
. The latter probably is not handled due to special-casing of __init__
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the full list for Gtk-3.0
:
Details
$ xidel -- -se '//*[local-name() = "doc-deprecated"]/.. ! concat(local-name(), " ", ./@name)' result-dev/share/gir-1.0/Gtk-3.0.gir | sort | uniq
constant STOCK_ABOUT
constant STOCK_ADD
constant STOCK_APPLY
constant STOCK_BOLD
constant STOCK_CANCEL
constant STOCK_CAPS_LOCK_WARNING
constant STOCK_CDROM
constant STOCK_CLEAR
constant STOCK_CLOSE
constant STOCK_COPY
constant STOCK_CUT
constant STOCK_DELETE
constant STOCK_DIALOG_AUTHENTICATION
constant STOCK_DIALOG_ERROR
constant STOCK_DIALOG_INFO
constant STOCK_DIALOG_QUESTION
constant STOCK_DIALOG_WARNING
constant STOCK_DIRECTORY
constant STOCK_EXECUTE
constant STOCK_FILE
constant STOCK_FIND
constant STOCK_FIND_AND_REPLACE
constant STOCK_FULLSCREEN
constant STOCK_GO_BACK
constant STOCK_GO_DOWN
constant STOCK_GO_FORWARD
constant STOCK_GOTO_BOTTOM
constant STOCK_GOTO_FIRST
constant STOCK_GOTO_LAST
constant STOCK_GOTO_TOP
constant STOCK_GO_UP
constant STOCK_HARDDISK
constant STOCK_HELP
constant STOCK_HOME
constant STOCK_INDENT
constant STOCK_INFO
constant STOCK_ITALIC
constant STOCK_JUMP_TO
constant STOCK_JUSTIFY_CENTER
constant STOCK_JUSTIFY_FILL
constant STOCK_JUSTIFY_LEFT
constant STOCK_JUSTIFY_RIGHT
constant STOCK_LEAVE_FULLSCREEN
constant STOCK_MEDIA_FORWARD
constant STOCK_MEDIA_NEXT
constant STOCK_MEDIA_PAUSE
constant STOCK_MEDIA_PLAY
constant STOCK_MEDIA_PREVIOUS
constant STOCK_MEDIA_RECORD
constant STOCK_MEDIA_REWIND
constant STOCK_MEDIA_STOP
constant STOCK_MISSING_IMAGE
constant STOCK_NETWORK
constant STOCK_NEW
constant STOCK_OK
constant STOCK_OPEN
constant STOCK_PAGE_SETUP
constant STOCK_PASTE
constant STOCK_PREFERENCES
constant STOCK_PRINT
constant STOCK_PRINT_ERROR
constant STOCK_PRINT_PREVIEW
constant STOCK_PROPERTIES
constant STOCK_QUIT
constant STOCK_REDO
constant STOCK_REFRESH
constant STOCK_REMOVE
constant STOCK_REVERT_TO_SAVED
constant STOCK_SAVE
constant STOCK_SAVE_AS
constant STOCK_SELECT_ALL
constant STOCK_SORT_ASCENDING
constant STOCK_SORT_DESCENDING
constant STOCK_SPELL_CHECK
constant STOCK_STOP
constant STOCK_STRIKETHROUGH
constant STOCK_UNDERLINE
constant STOCK_UNDO
constant STOCK_UNINDENT
constant STOCK_ZOOM_100
constant STOCK_ZOOM_FIT
constant STOCK_ZOOM_IN
constant STOCK_ZOOM_OUT
constant STYLE_REGION_COLUMN
constant STYLE_REGION_COLUMN_HEADER
constant STYLE_REGION_ROW
constant STYLE_REGION_TAB
constructor new
constructor new_alpha
constructor new_from_file
constructor new_from_gicon
constructor new_from_icon_name
constructor new_from_icon_set
constructor new_from_pixbuf
constructor new_from_stock
constructor new_linear
constructor new_literal
constructor new_mix
constructor new_name
constructor new_radial
constructor new_shade
constructor new_win32
constructor new_with_color
constructor new_with_label
constructor new_with_mnemonic
constructor new_with_range
constructor new_with_stock_from_widget
enumeration RcTokenType
enumeration StateType
function add_builtin_icon
function alternative_dialog_button_order
function drag_set_icon_stock
function draw_insertion_cursor
function from_name
function get_default
function get_default_style
function get_name
function icon_size_from_name
function icon_size_get_name
function icon_size_lookup_for_settings
function icon_size_register
function icon_size_register_alias
function install_property
function install_property_parser
function key_snooper_install
function key_snooper_remove
function lookup_default
function lookup_for_settings
function lookup_property
function paint_arrow
function paint_box
function paint_box_gap
function paint_check
function paint_diamond
function paint_expander
function paint_extension
function paint_flat_box
function paint_focus
function paint_handle
function paint_hline
function paint_layout
function paint_option
function paint_resize_grip
function paint_shadow
function paint_shadow_gap
function paint_slider
function paint_spinner
function paint_tab
function paint_vline
function pop_composite_child
function position_menu
function push_composite_child
function rc_add_default_file
function rc_find_module_in_path
function rc_find_pixmap_in_path
function rc_get_default_files
function rc_get_im_module_file
function rc_get_im_module_path
function rc_get_module_dir
function rc_get_style
function rc_get_style_by_paths
function rc_get_theme_dir
function rc_parse
function rc_parse_color
function rc_parse_color_full
function rc_parse_priority
function rc_parse_state
function rc_parse_string
function rc_reparse_all
function rc_reparse_all_for_settings
function rc_reset_styles
function rc_scanner_new
function rc_set_default_files
function register
function register_alias
function register_property
function render_frame_gap
function render_icon_pixbuf
function show_uri
function test_create_simple_window
function test_create_widget
function test_display_button_window
function test_slider_get_value
function test_slider_set_perc
function test_spin_button_click
function test_text_get
function test_text_set
function test_widget_click
method activate
method add
method add_accelerator
method add_color_stop
method add_default
method add_source
method add_with_viewport
method append_menuitems
method apply_default_background
method attach
method attach_defaults
method begins_tag
method block_activate
method cancel_animations
method changed
method class_path
method clear
method connect_accelerator
method connect_widget_destroyed
method copy
method create_icon
method create_menu
method create_menu_item
method create_tool_item
method detach
method disconnect_accelerator
method drag_begin
method drag_source_set_icon_stock
method ensure_style
method enter
method free
method get
method get_accel_closure
method get_accel_path
method get_action_area
method get_add_tearoffs
method get_alignment
method get_alpha
method get_always_show_image
method get_attach_points
method get_background_color
method get_border_color
method get_builtin_pixbuf
method get_cancel_button
method get_child_detached
method get_child_requisition
method get_color
method get_col_spacing
method get_composite_name
method get_current_color
method get_default_col_spacing
method get_default_row_spacing
method get_direction
method get_direction_wildcarded
method get_display_name
method get_embedded_rect
method get_face
method get_face_list
method get_family
method get_family_list
method get_filename
method get_focus_chain
method get_focus_on_click
method get_font
method get_font_name
method get_font_selection
method get_geometry
method get_gicon
method get_hadjustment
method get_handle_position
method get_has_resize_grip
method get_has_tooltip
method get_homogeneous
method get_icon_factory
method get_icon_name
method get_icon_set
method get_icon_stock
method get_ignore_hidden
method get_image
method get_inner_border
method get_is_important
method get_label
method get_margin_left
method get_margin_right
method get_min_slider_size
method get_modifier_style
method get_name
method get_ok_button
method get_opacity
method get_padding
method get_page_header_image
method get_page_side_image
method get_pixbuf
method get_pointer
method get_preview_entry
method get_preview_text
method get_previous_color
method get_property
method get_requisition
method get_resize_grip_area
method get_resize_mode
method get_rgba
method get_right_justified
method get_root_window
method get_row_spacing
method get_screen
method get_sensitive
method get_shadow_type
method get_short_label
method get_show_connect_to_server
method get_size
method get_size_entry
method get_size_list
method get_size_of_row
method get_sizes
method get_size_wildcarded
method get_snap_edge
method get_spacing
method get_state
method get_state_wildcarded
method get_stock
method get_stock_id
method get_storage_type
method get_style
method get_tab_hborder
method get_tab_vborder
method get_title
method get_tooltip
method get_tooltip_markup
method get_tooltip_text
method get_transitions_enabled
method get_use_alpha
method get_vadjustment
method get_valist
method get_visible
method get_visible_horizontal
method get_visible_vertical
method get_x11_window_id
method has_rc_style
method invalidate
method is_composited
method is_embedded
method is_sensitive
method is_visible
method iter_add_region
method iter_clear_regions
method iter_has_qregion
method iter_has_region
method iter_list_regions
method iter_remove_region
method leave
method load_symbolic_for_style
method lookup
method lookup_color
method lookup_icon_set
method map_color
method merge
method modify_base
method modify_bg
method modify_cursor
method modify_fg
method modify_font
method modify_style
method modify_text
method notify_state_change
method override_background_color
method override_color
method override_cursor
method override_font
method override_symbolic_color
method parse_geometry
method path
method pop_animatable_region
method popup
method popup_for_device
method pressed
method push_animatable_region
method ref
method region_intersect
method released
method remove_accelerator
method remove_default
method render_icon
method render_icon_pixbuf
method render_icon_surface
method reparent
method reset_rc_styles
method reshow_with_initial_size
method resize
method resize_grip_is_visible
method resize_to_geometry
method resolve
method scroll_animations
method send_expose
method set
method set_accel_group
method set_accel_path
method set_add_tearoffs
method set_alignment
method set_alpha
method set_alternative_button_order
method set_alternative_button_order_from_array
method set_always_show_image
method set_background
method set_background_color
method set_color
method set_col_spacing
method set_col_spacings
method set_composite_name
method set_current_color
method set_default_geometry
method set_destroy_count_func
method set_direction
method set_direction_wildcarded
method set_double_buffered
method set_double_property
method set_filename
method set_focus_chain
method set_focus_on_click
method set_font_name
method set_from_file
method set_from_gicon
method set_from_icon_name
method set_from_icon_set
method set_from_pixbuf
method set_from_stock
method set_gicon
method set_hadjustment
method set_handle_position
method set_has_resize_grip
method set_has_tooltip
method set_homogeneous
method set_icon_from_stock
method set_icon_name
method set_ignore_hidden
method set_image
method set_inner_border
method set_is_important
method set_label
method set_long_property
method set_margin_left
method set_margin_right
method set_min_slider_size
method set_name
method set_opacity
method set_padding
method set_page_header_image
method set_page_side_image
method set_pixbuf
method set_preview_text
method set_previous_color
method set_property
method set_property_value
method set_raw_coordinates
method set_reallocate_redraws
method set_resize_mode
method set_rgba
method set_right_justified
method set_row_spacing
method set_row_spacings
method set_screen
method set_sensitive
method set_shadow_type
method set_short_label
method set_show_connect_to_server
method set_size
method set_size_wildcarded
method set_snap_edge
method set_spacing
method set_state
method set_state_wildcarded
method set_stock_id
method set_string_property
method set_style
method set_title
method set_tooltip
method set_tooltip_markup
method set_tooltip_text
method set_transitions_enabled
method set_use_alpha
method set_vadjustment
method set_valist
method set_visible
method set_visible_horizontal
method set_visible_vertical
method size_request
method state_is_running
method style_attach
method to_string
method unblock_activate
method unref
method unset_focus_chain
method unset_property
method value_changed
property accel-group
property action-group
property add-tearoffs
property always-show-image
property background-gdk
property bottom-padding
property cell-background-gdk
property color
property color-hash
property current-color
property double-buffered
property follow-state
property font-name
property foreground-gdk
property gicon
property gtk-auto-mnemonics
property gtk-button-images
property gtk-can-change-accels
property gtk-color-palette
property gtk-color-scheme
property gtk-enable-mnemonics
property gtk-enable-tooltips
property gtk-fallback-icon-theme
property gtk-file-chooser-backend
property gtk-icon-sizes
property gtk-im-preedit-style
property gtk-im-status-style
property gtk-keynav-cursor-only
property gtk-keynav-wrap-around
property gtk-menu-bar-accel
property gtk-menu-bar-popup-delay
property gtk-menu-images
property gtk-menu-popdown-delay
property gtk-menu-popup-delay
property gtk-recent-files-limit
property gtk-scrolled-window-placement
property gtk-show-input-method-menu
property gtk-show-unicode-menu
property gtk-timeout-expand
property gtk-timeout-initial
property gtk-timeout-repeat
property gtk-toolbar-icon-size
property gtk-toolbar-style
property gtk-tooltip-browse-mode-timeout
property gtk-tooltip-browse-timeout
property gtk-tooltip-timeout
property gtk-touchscreen-mode
property gtk-visible-focus
property has-resize-grip
property hide-if-empty
property icon-name
property icon-set
property ignore-hidden
property image
property inner-border
property is-important
property label
property left-padding
property margin-left
property margin-right
property name
property paragraph-background-gdk
property primary-icon-stock
property resize-grip-visible
property right-padding
property rules-hint
property secondary-icon-stock
property sensitive
property shadow-type
property short-label
property spacing
property stock
property stock-id
property style
property tooltip
property top-padding
property transitions-enabled
property use-stock
property visible
property visible-horizontal
property visible-overflown
property visible-vertical
property window-placement-set
property xalign
property xpad
property xscale
property yalign
property ypad
property yscale
signal activate
signal child-attached
signal child-detached
signal composited-changed
signal enter
signal leave
signal pressed
signal released
signal show-connect-to-server
signal show-other-locations
signal state-changed
signal style-set
signal visibility-notify-event
virtual-method activate
virtual-method changed
virtual-method connect_widget_destroyed
virtual-method create_menu
virtual-method create_menu_item
virtual-method create_tool_item
virtual-method enter
virtual-method get_icon_factory
virtual-method get_size
virtual-method get_style
virtual-method leave
virtual-method pressed
virtual-method released
virtual-method render_icon
virtual-method set_background
virtual-method value_changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From PEP 702
This decorator can be used on a class, function or method to mark it as deprecated
So I don't think it can be used to mark properties, nor constants. Signal are currently not implemented. Constructors, methods and virtual-methods should be addressed, they are probably overridden by pygobject (TODO check this).
The only missing things are enumerations, I didn't know they can be deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PEP appears to use methods with @property
decorator to deprecate properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the stubs we don't use the @property
decorator, because GObject properties are not python properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are not they currently just declared as properties in the Props class? So that is not a GObject property either.
Maybe we could use the GObject.Property
decorator.That would also allow to mark properties as read/write only (though that is a different feature request).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are implemented like this because it's the only way the typechecker understand them (as far as I know).
I don't think we can use the GObject.Property
decorator inside a pyi
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested with some functions, methods and virtual-methods you posted but for me it seems to be correctly deprecated. I did't run the parser because it has problem in this branch
BTW I have added the check also for enums and flags
df6f9a9
to
6f14779
Compare
The messages cannot be more specific AFAIK
Closes #165