Setting up local environment for Python [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm trying to transfer from using PHP to Python, Im looking to change to Python as it seems a much more versatile language able to work across a range of scenarios. The sort of things i plan to use it for range from web app development (using django), NLP, machine learning and automation using mechanize.
One of the things I really liked about PHP was MAMP, the way it creates an htdocs folder, a localhost:8888 url, and a MySQL server, with pretty much 0 effort.
Is there something similar with Python ? I'm not necessarily looking for a GUI like MAMP (although that would be good) - what are the other options for setting up a local environment?

Python excels in this area, but as with most tools exactly what you do depends on what you want. In particular, you certainly want virtualenv, Python's configuration and dependency -isolation tool.
You may also want a development-configuration management tool such as buildout, but that is more controversial as there are many other great, language-agnostic tools that overlap. (For example, you may want to set up your environment using Vagrant and leave your host OS behind.)
Neither virtualenv nor buildout will set up Apache for you OotB, but you do have the option of installing django, zope, or many other Python frameworks and applications with buildout recipes. There are recipes for apache too, but most Python web development that I know of is agnostic of the httpd, so you might end up not wanting it.

Related

Is calling python script for many kinds of operations from rails, on heroku, a good idea? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
What are the pros and cons of using Rails but using python scripts for all kinds of operations, including ML (hosting on heroku)? I like Rails, but if Django would be better long-term, I'm willing to switch to that.
I'm hoping that by framing this question as "pros and cons," this fits more into stack overflow norm... if not, I'm sorry. I'd really appreciate help though.
I like rails, but...
What do you like about rails? Rails is great, but what does it offer that Django does not? It's quite common to have multiple languages in one project, multiple languages are complied to the same code. There are libraries like 'rupy' that make it a simple thing to do, if you are more comfortable with rails than django then there is a use case to consider the proposed approach. There are some issues in general, the main will be around what is 'best' architecturally.
In regard to any possible cons, let's try to explore any that may come up when modelling a real-world example:
def init_py_script
parsed_output = JSON.parse(`cat #{file.path} | python3 lib/some_python_script.py`)
end
Why did the author chose to do this? In our model, let's say they outsourced the work the python code is doing due to not understanding how to complete the task in ruby. Maybe they did not have the bandwidth to learn how to do this in ruby and could only find a python developer who could complete the work.
Which is fine, but there some issues here. [Note these issues may/may not apply to you]:
The user has to install different dependencies on their server in order to run both languages, which takes time to understand and debug.
If the outsourced coder uploads the code to another repository; most deployment scripts won't be able to deploy the submodule code and there is manual intervention required.
Maintaining multiple languages on a server is not easy and when upgrading packages, which may cause issues such as having to install multiple 'libssl-dev' packages, which creates more ongoing work.
Ruby and rails is classically driven by TDD. If you solely rely on unit tests, there will be no issue. If you like to incorporate integration tests, it will be much harder to get full coverage.
When writing code, the author should be conscientious of the reader and reducing the cognitive load of future readers and developers to understand what applications are doing. You'll restrict the amount of developers who can work on the entire project going forward if you include more languages as they will have to understand both languages. This may not be an issue if they are working on one small component of the application.
TLDR: It's OK for small projects. Using multiple languages causes infrastructure issues by likely cause version conflicts in the future. Upgrading will likely be more difficult. If you have good documentation and tests, the development of code should remain unaffected.

VSCode git integration is just awful- is there a better way? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am a software architect with 23 years commercial experience in C++/C#/Python/Cython. I was forced into using VSCode rather than PyCharm becasue I had to debug some particularly tricky Django templates. I use several machines, one of which is a production test machine. I changed 1 line of code while logged on there and pushed it because it was critical. Now my Git is totally screwed. I have have worked with sourcesafe and clearcase over the years, and I do not have a problem with Git however VSCode has rendered my setup useless.
I now have to save log data on my production test box, wipe the prod folder and reinstall all the code from scratch from Git. This is about a day's work and should not be necessary.
I was warming to VSCode but I will change the way I work until VSCode/Git integration is improved enormously. I will code using VSCode but at any point I want to pull, push, fetch or merge, I will switch to the community edition of PyCharm. PyCharm handles source control like a dream but I don't want to do my day-to-day development with it.
Anybody else out there having similar problems? I simply don't have the time to write a VSCode extension to handle Git properly. I have an end-of-Septemebr deadline and I simply can't have this happen again.
Any feedback is most welcome.
/Luke
For the most part, I just use command line git integration.
However, for large projects or for particularly tricky merge conflicts or other problems, you could use third party git clients such as Source Tree (what I use) or GitKraken. These offer a host of features with nice interfaces.

Create standalone text application from Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am developing a program to use as a pedagogical tool in my classroom. I'm writing currently writing it in Python, but I'm also open to solutions that would use C. I want to create a standalone application for Mac (.app file) for my program, but I only need text-based interaction with the users (i.e. just STDIN/STDOUT, and not a GUI). The majority of my students do not have python installed and have no experience with Terminal/shell scripting.
I tried using Platypus to create this application, but I get an error, as shown below.
I later realized that Platypus does not support prompts for user-input. Is there anything like Platypus that would also allow me to prompt users for input?
As I say, I'm also open to solutions to my problem which would involve transposing my Python code into C and going from there.
I don't know if you have thinking about make a web app, in Google App Engine for example is very simple to deploy a Python based web app really fast, using webapp2 for example. And all your students could use your app online, this is a good getting started. But if you want maybe you could to build a command line app deployed in some server and your students could connect with ssh to use it.
It depends what kind of systems your students have and it is highly unlikely that they will have similar kind of system. For least dependency i think you can use java to write your application. For java they just need to install jdk and can run your shared jar.

how is docker better if tools like fedora's devassistant and virtualenv exist? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am trying to understand docker.io LXC container for a while,but if we consider fedora's devassistant tool and virtualenv then virtualenv will do the work of isolation and devassistant will download all the needed dependency by interpreting the setup configuration file.so its like by using two keyword commands on terminal like we almost setup a developer environment of Openstack or lets say large multi-repository project within minutes taking into consideration to use right tool for the right job.so how is docker different?
virtualenv only does isolation for python environments, it doesn't do process isolation.
I'm not familiar with fedora's devassistant but I'm pretty sure those changes are system wide. What if on the same server you want to run, python, ruby, java, and node.js apps? There might be conflicting requirements at the system level.
With Docker, this is easy because each app has it's own container and they can put what ever you want in there, and they don't interfere with each other. Think of docker like this. It is giving each application it's own VM (container) to live in, it is similar to setting up a physical server and installing different virtualbox servers on it, one for each application. But it is much more lightweight and you can run it on both physical and virtual hosts.
You can also move the docker containers from one docker compatible server to another really easily.

Use Python Framework or Build Own [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am an experienced PHP developer (10 years) who has built 3 different custom frameworks for extreme high traffic sites. I have recently started to get into programming a lot of python, usually just for fun (algorithms). I am starting to develop a new site as my side project and wanted to know if I should use a pre-existing python web framework (Django, Pyramids, ect...) or develop my own.
I know things might go a lot faster using a pre-existing framework, but from my experience with PHP frameworks and knowing the amount of traffic my side project could generate, whould it be better to develop an extremely light weight framework myself just like I have been doing for a while with PHP? It also might be a good way for me to learn python web development because most of my experience with the language has been for coding algorithms.
If I do use a pre-existing framework I was going to try out Pyramid or Django.
Also do other companies that use Python for web development and expect high traffic use their own web frameworks or a pre-existing one?
Learn from existing frameworks, I think. The Python web stack (wsgi, sqlalchemy, template engines, full stack frameworks, microframeworks) has spent a lot of time maturing. You'll have the opportunity to develop fast and learn from existing design.

Categories