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

Move most imports from editor.py to __init__.py #1340

Merged
merged 12 commits into from
Jan 15, 2021

Conversation

tburrows13
Copy link
Collaborator

@tburrows13 tburrows13 commented Oct 9, 2020

This PR moves most of the importing to __init__.py. This means that most users can import everything that they need directly from moviepy instead of from moviepy.editor or moviepy.video.io.VideoFileClip... you get the picture :)

I've kept editor.py to handle the stuff that the user runs interactively: Pygame, matplotlib and IPython.

This change is also fully backwards compatible because in editor.py, I call from . import * so anything that is now in __init__.py is also available from editor.py.

I've included an example change to test_fx.py that demonstrates the change. This could be applied to most of the test suite imports. I've not yet updated the documentation but in general it will advise things like from moviepy import VideoFileClip or from moviepy import *.

Let me know your thoughts and feedback.

Todo:

  • Add changelog entry
  • Update documentation

@tburrows13 tburrows13 added the feature New addition to the API i.e. a new class, method or parameter. label Oct 9, 2020
@coveralls
Copy link

coveralls commented Oct 9, 2020

Coverage Status

Coverage increased (+0.04%) to 68.087% when pulling 60700b2 on tburrows13:change-editor into 999bab3 on Zulko:master.

@tburrows13 tburrows13 mentioned this pull request Oct 9, 2020
7 tasks
@tburrows13 tburrows13 requested review from Zulko and keikoro October 17, 2020 14:00
moviepy/__init__.py Outdated Show resolved Hide resolved
@tburrows13
Copy link
Collaborator Author

I think that this is ready to merge

@tburrows13 tburrows13 requested review from mondeja and removed request for keikoro and Zulko January 13, 2021 23:40
moviepy/__init__.py Show resolved Hide resolved
moviepy/editor.py Show resolved Hide resolved
Copy link
Collaborator

@mondeja mondeja left a comment

Choose a reason for hiding this comment

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

Great! Thank you @tburrows13

@mondeja mondeja merged commit 4d9f637 into Zulko:master Jan 15, 2021
@tburrows13 tburrows13 deleted the change-editor branch January 15, 2021 12:23
@tburrows13
Copy link
Collaborator Author

tburrows13 commented Jan 15, 2021

Probably my favourite change in 2.0 👍🏼

tburrows13 added a commit to tburrows13/moviepy that referenced this pull request Jan 19, 2021
* Move most imports from editor.py to __init__.py

* Move Pygame environment variable to editor.py

* Fix missing os import

* Convert all __init__.py imports to absolute

* Convert `moviepy.editor` to `moviepy` in documentation and examples

* Assign clip.preview and clip.show in __init__.py to prevent confusion

* Add changelog entry

* Re-add test_fx AudioClip import

* Add __all__ to __init__.py and editor.py

* Update html_tools documentation; add ipython_display to editor.py __all__

* Apply black
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New addition to the API i.e. a new class, method or parameter.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants