DEV Community

Luca Ionescu
Luca Ionescu

Posted on • Updated on

What practical tips do you have for creating Python modules?


What are your practical tips, suggestions or best practices for implementing and publishing Python modules?

I just published my first module and am interested in how to further improve to work on more complex projects and what to keep in mind, not specifically to my project, but generally for any other.

Thanks for sharing!

Discussion (4)

jmcp profile image
James McPherson

I had a quick check of your TODO list - I don't think you'll be able to avoid BeautifulSoup unless you want to write your own parser - and that I do NOT recommend!

-- flake8 clean
-- specify the versions of Python which you believe that the module should work with

ioan profile image
Luca Ionescu Author

Hi, thanks for your reply!

The sole idea behind the BeautifulSoup TODO was to remove a dependency, but truthfully I did not have a plan on how to manage it when I wrote it down.

And about the Python versions, I will incorporate that, thank you!

aadibajpai profile image
Aadi Bajpai

One thing you could do was specify what packages your module needs to run in itself so when a user installs it via pip the dependencies install automatically.

You can see the for one of my packages here

GitHub logo SwagLyrics / SwagLyrics-For-Spotify

📃 Get lyrics of currently playing Spotify song so you don't sing along with the wrong ones and embarrass yourself later.


Build Status Build Status PyPI GitHub closed issues Downloads

Fetches the currently playing song from Spotify on Windows, Linux and macOS and displays the lyrics in the command-line or in a browser tab Refreshes automatically when song changes. The lyrics are fetched from Genius Turns out Deezer already has this feature in-built but with swaglyrics, you can have it in Spotify as well.

I'm mainly trying to build this project as far as I can, for practice and to learn and work with more technologies and platforms.

Initially developed this for personal use. Pretty much functionality oriented -- I usually develop something that I can see helping me and other users in the same situation. Packaged so I can first hand handle production-ready code to an extent and to make distribution and usage easier.


Requires Python3. Use pip or pip3 depending on your installation.

pip install swaglyrics

Make sure to use a version >= 0.1.6 since…

ioan profile image
Luca Ionescu Author

This sounds good, I will implement that!