You are on page 1of 3

5/28/23, 7:26 AM Execute Python Project Directory as a Script

Execute Python Project Directory as a


Script
An elegant way to execute Python projects.

AVI CHAWLA
MAY 28, 2023

6 Share

We mostly run a Python pipeline by invoking a script (.𝗽𝘆 file).

But did you know you can also execute the Python project directory as a script?

https://www.blog.dailydoseofds.com/p/execute-python-project-directory?utm_source=substack&utm_medium=email 1/3
5/28/23, 7:26 AM Execute Python Project Directory as a Script

To do this, rename the base file of your project to __𝗺𝗮𝗶𝗻__.𝗽𝘆.

As a result, you can execute the whole pipeline by running the parent directory
itself.

This is concise and elegant.

It also makes it easier for other users to use your project, as they are not required to
dig into the directory and locate the base file.

Thanks for reading Daily Dose of Data Science!


Subscribe for free to learn something new and
insightful about Python and Data Science every
day. Also, get a Free Data Science PDF (250+
pages) with 200+ tips.

👉 Over to you: What are some elegant Python tricks that you frequently use? Let
me know :)

👉 Read what others are saying about this post on LinkedIn and Twitter.

👉 Tell the world what makes this newsletter special for you by leaving a review
here :)

👉 If you liked this post, don’t forget to leave a like ❤️. It helps more people
discover this newsletter on Substack and tells me that you appreciate reading
these daily insights. The button is located towards the bottom of this email.

👉 If you love reading this newsletter, feel free to share it with friends!

https://www.blog.dailydoseofds.com/p/execute-python-project-directory?utm_source=substack&utm_medium=email 2/3
5/28/23, 7:26 AM Execute Python Project Directory as a Script

👉 Sponsor the Daily Dose of Data Science Newsletter. More info here:
Sponsorship details.

Find the code for my tips here: GitHub.

I like to explore, experiment and write about data science concepts and tools. You
can read my articles on Medium. Also, you can connect with me on LinkedIn and
Twitter.

6 Likes

Comments

Write a comment…

© 2023 Avi Chawla ∙ Privacy ∙ Terms ∙ Collection notice


Substack is the home for great writing

https://www.blog.dailydoseofds.com/p/execute-python-project-directory?utm_source=substack&utm_medium=email 3/3

You might also like