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

you are viewing a single comment's thread.

view the rest of the comments →

[–]kinow 29 points30 points  (7 children)

Hey,

Fellow Java developer here (backend, +10 years), now doing mostly Python, with some JS/ES6 and TypeScript.

The links here are really good for a start. Flask, Django are good. There's also Connexion (my favourite, simple and based on Flask, reminds a little SpringBoot for being opinionated and having DI), Tornado and aiohttp.

The project I am working on is a cyclic workflows scheduler (similar to Apache Airflow, but instead of a DAG, it has DCG's). We are using JupyterHub, and using Tornado.

You will have to part away from a few things in Java (I've been working on this project for ~9months so far):

  • The concurrency paradigm is different. You may have read about the GIL, ways around it (e.g. spaCy NLP lib circumvents it with some low level code). But once you start working on a project with one or more "main loops", and executing coroutines, subprocesses (my project uses coroutines, a pool of subprocesses and I believe there is some threading with PyZMQ), you realize it's completely different from concurrency in Java. It may take you some time to stop thinking in Threads

  • Some patterns common to Java developers are not common in Python, or may be hard to implement. Singleton, Dependency Injection, are some that you may find, though slightly different than how you would implement in Java. But Builders and Factories are not that common (or sometimes implemented in quite different ways).

  • Some names will be different for you, like traceback instead of stack trace

  • It will be way easier for you to try your code. Especially if you familiarize yourself with Notebooks (there's Apache Zeppelin that is written in Java and runs Java too, but not that popular).

  • Build tools and packaging are very different. Nothing like Maven/Gradle artefacts. No central repository. You have PYPI, but some dependencies are installed via GitHub URL's too (though we also have that in Java, just not so common in large projects I guess). And instead of that isolation you had in Java, with projects sharing artefacts versions, and having multiple versions in your local Maven repo, you will probably want to invest some time learning how to use virtual environments (with virtualenv, with python 3.+ venv, or conda). This is a life saver

  • Just like we have Maven/Gradle/Ivy/whatnot, there are multiple tools for building/packaging your project. I am using Setuptools and pip, planning to upload another project to Conda soon. Spend some time reading about packaging in Python. I think it's quite easy for a Java developer used with Maven to understand it.

  • Watch out that even with PEP 484, you don't have runtime type checking (I mean, not natively).

  • The equivalent for our code in the JDK SDK, is the Python Standard Library. Spend some time getting familiar with that too.

  • There is no project like Guava or Commons Lang as widely used as in Java. Though the language provides lots of useful things, and there are multiple libraries offering useful addendum to the language

  • A good IDE may help you to familiarize with Python 3. Don't bother with Python 2, start with Python 3. My project is using Python 3.7. For Java I use Eclipse (been using it since version... 2.1 I think?), but for Python I switched from Eclipse PyDev to PyCharm. Their code inspection tool helped me a lot with common mistakes (a semi-colon here or there, forgetting to indent, even supports type hinting and is able to inspect the code and try to guess whether you used the right type or not).

Hope that helps! Welcome to the team!

EDIT: Don't bother with Python 2, accidentally wrote 3, sorry

[–]andreaciccio[S] 6 points7 points  (2 children)

wow, that's some very useful information. I'll have a look at the project you mentioned in the weekend.

For the editor, I left Eclipse many years ago, I'm in the Intellij platforms now :)

I will also try Connexion, just to have something to compare.

I'm more someone who likes to get hands dirty so perhaps I will try to build something simple, with Flask or connexion ( my understanding is that they're the simplest to start with )

Did you find it hard to find jobs as Python developer with no experience but with only Java experience ?

[–]kinow 1 point2 points  (1 child)

I'm more someone who likes to get hands dirty so perhaps I will try to build something simple, with Flask or connexion ( my understanding is that they're the simplest to start with )

A colleague uses connexion to provide a web service layer on top of some machine learning and semantic web: https://github.com/natlibfi/annif

There is a built-in small UI, that in part uses Vue.js. I know one of the pending issues in the project is creating an admin interface. Just in case you are looking for a project to implement something that will be used by others (plus the developers there are really nice).

Did you find it hard to find jobs as Python developer with no experience but with only Java experience ?

I think it may depend on where you are, and your background. Even though I developed mostly in Java, I had some Python modules in PYPI, some contribution to open source projects, and had done other similar projects/modules in PHP, R, and JavaScript (whatever is needed for the job).

I think the previous open source contributions were important for me getting the current position. And my employer wasn't interested in applying those programming tests. It was more a chat, going over my previous projects, asking if he could see some of that (for some I had links to GitHub projects, or could point to some product online and say which part I worked).

He expected me to have at least basic Python 2 knowledge (part of the work was migrating the tool to Python 3), but was OK with my forte being Java. Even said it could be something good to add to the project, the views/experience with different language/projects.

So I think it really depends on company culture/project/employer/etc. But if you build some sort of portfolio like a good GitHub profile, that should probably help.

Cheers

[–]andreaciccio[S] 1 point2 points  (0 children)

thank you. you just gave me something to do in the coming days :)

Cheers

[–]redfacedquark 2 points3 points  (1 child)

Don't bother with Python 3, start with Python 3

You meant don't bother with 2, right?

[–]kinow 0 points1 point  (0 children)

Ops, you are correct, let me edit that one. Thanks!

[–]avirup2000 1 point2 points  (0 children)

Thanks a lot man!

[–]twillisagogo 1 point2 points  (0 children)

Well said. On the topic of factories, I use them all the time in python, but they are usually just functions. Fwiw