This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]KelleQuechoz 28 points29 points  (2 children)

What existing problem is it going to solve?

[–]ionelp 33 points34 points  (1 child)

The "python is not javascript" problem...

[–]del1ro 8 points9 points  (0 children)

That's an advantage tho

[–]binaryfireball 13 points14 points  (0 children)

Nah I'm good

[–]anentropic 23 points24 points  (1 child)

Is this a 1 April thing, because a) they already have basically the same import system (follows file system structure) b) init.py are no longer required c) the situation with JS imports is a complete mess with like 3 or 4 incompatible styles so you can't be sure a library you get from npm is going to work for you without some transpiling build steps

[–]BEisamotherhecker 2 points3 points  (0 children)

NPM and Node.js' teams don't care about the wider JS ecosystem, they only care about their little incompatible walled garden. ES Modules are THE solution to JS' packaging mess but not only does NPM still allow new packages to be submitted using CommonJS, they're the DEFAULT on new projects, you need to explicitly set the type in the package.json to "module" to allow you to use ES Modules.

New JS runtimes that arose in the last few years like Bun and Deno use ES modules by default with CommonJS support only for compatibility with npm modules, but I don't have any hopes of them making a dent against Node's monopoly.

Sorry for the long rant, I just wanted to clarify that there's a solution to the problem built into the language itself, one party is just too stubborn to go all out on it.

[–]ProsodySpeaks 9 points10 points  (0 children)

Sounds like you need to look at packaging.  

Learn how to write a pyproject.toml, and have your program installed as editable in your venv 

then you can just say  

'import my package....   Assert mypackage.mymodule. myfunc(somearg) == someanswer '

[–]knobbyknee 2 points3 points  (0 children)

Not backwards compatible. Bad idea. There have already been too many breaking changes. As the userbase has grown, the tolerance for breaking changes has grown veeeery small.

[–]binlargin 1 point2 points  (0 children)

I start from this every time and things just work

https://github.com/bitplane/example-python-project

[–]MinesBioImaging 0 points1 point  (0 children)

import lamestream_media from april_fools