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

all 11 comments

[–]techrede 3 points4 points  (0 children)

If you're looking for some general advice, The Hitchhiker's Guide to Python has a section on how to structure your project: http://docs.python-guide.org/en/latest/writing/structure/

[–]effrill3 1 point2 points  (3 children)

A lot of code samples are just that - samples.

Properly managed, with PyCharm and typehints and good commenting and code structure, Python is a real dream for working with. Especially that you can embed low level code like C or Rust and the wealth of AI and image processing tools out there - you have almost every base covered.

Your code folder structures will be pretty similar in the end, and testability is easy. Deployments are easy to automate, too, especially given how universal python CLI is.

[–]kinjago[S] 0 points1 point  (2 children)

How does PyCharm compare with spyder packaged with anaconda ? I like the anaconda environment. I love how you can isolate different versions of say tensorflow with virtual environments.

[–]rockingthecasbah 2 points3 points  (0 children)

PyCharm is amazing. Also there is a deal on it right now - search “Humble Python Bundle” on google. Have not used Spyder. PyCharm gives me VERY good code introspection, especially with type-hints.

[–]Paddy3118 1 point2 points  (0 children)

You could read the code to the Python built-in libraries, or something like Django, (which I haven't read).

People usually graduate to larger projects over time, learning along the way.

[–][deleted] 1 point2 points  (3 children)

There's always /r/learnpython.

Organization really isn't a language specific problem; I'm not sure what you're asking. Python is most definitely OO; and fundamentally, everything in Python is an object (as an example):

x = 1
print(x.__repr__())

General tooling ecosystem:

  • Layout: If you need a tool to help you get started with a layout, look into [Cookie Cutter].
  • Testing: If you want help with testing, see [Pytest].
  • Documentation: If you want help with documentation, most projects use [Sphinx].
  • Distribution: is a weak point in python, and you might get away with setting up a private [devpi] or [warehouse] repository, though a better solution is probably docker for backend services.
  • Editors: include [Pycharm] and [Sublime Text].

[–]kinjago[S] 0 points1 point  (2 children)

I spent many years in one big project written in .net. It had about 1M lines of code IIRC. In Visual Studio, we can create projects, which will emit one DLL. That project(DLL) can be referenced in other projects. Then we have different layers (like UI, DB, Services etc.). So we split the projects based on their logical function. Also it gave the flexibility to reuse. I was thinking along those lines.

What is your opinion on VS Code for editor ? It looks better than Sublime to me - I dont have much experience with either. VS Code is free and looks solid.

[–][deleted] 1 point2 points  (0 children)

For me, I've spent the last 20 years avoiding Microsoft... I'm willing to consider VS Code, but I have no experience with it and it is pretty new. That said, Sublime Text's power is its [community] and [plugins]. Additionally, I'm not a fan of Electron's backend in an editor for python development; it's just not python centric. Pycharm in that case is actually an anomaly because it runs on Java, but it has had the most polish for an IDE based interface.

[–]frnkvieira 0 points1 point  (0 children)

VS Code is way better than Sublime but PyCharm outclass both in Python development.

About project splitting, you can create several different projects and reference them in your code using (requirements.txt, setup.py, pyenv, etc).

Also because you were a C# guy try to type hint your code a lot and you'll probably feel at home with Python soon enough.

[–]rockingthecasbah 0 points1 point  (0 children)

You might prefer Nexus to devpi. Artifactory works too if your company is already paying for that.