Python build/release system - python

I started using Pyant recenently to do various build/release tasks but have recently discovered that development for this project has ended.
I did some research and can't seem to find any other Python build scripts that are comparable. Just wondering if anyone can recommend one? I basically need it to do what ANT does - do SVN updates, move/copy files, archive etc using an XML file.
Thanks,
g

Probably the best answer is to use Ant as-is... that is, use the Java version. My second suggestion would be to use scons. It won't take much time using scons before you're asking, "Who ever thought of using XML to script a build?"

Its not completely comparable but I tend to use fabric. Its more geared towards deployment with support for ssh to production host and runing things as root there etc.

Some people use Paver for build/deployment of Python packages. While I know it works, it does not appeal to me that much.

what about maven? (http://maven.apache.org/) With the right plugins it can do much more then ant, it can even use ant for building if you configure it so.
It's very flexible and supports the full product life cycle. I really recommend you take a look at it.

Related

libsass-python compile a file

I recently find a fantastic python library compiling SASS really fast!
libsass-python seems to be very good and really fast
How I can use it to watch for any change in a sass folder or file and compile it in CSS ?
I do not understand how to pass a file and how to use --watch option
Thanks!
You may try Boussole that works on top of libsass-python on a per project configuration and comes with a "watch" command (using watchdog).
On top parent of your scss source directory, use:
boussole startproject
If needed, you can change settings options (from generated settings.json) then type:
boussole watch
The solution described here (--watch option) was removed from libsaas-python since version 0.13.0 (release notes), released in 2017.
Therefore this solution will no longer work.
As a replacement, you can use boussole as advertised in a subsequent answer.
The rest of this post can be ignored unless you are using versions older than 0.13.0.
According to the help instructions (http://hongminhee.org/libsass-python/sassc.html), you can watch for modifications in file simply with :
$ sassc --watch source.scss target.css
Now, I get you want to watch all the files contained in a folder, and it doesn't seem that the command-line utility provides that.
For what I can tell, I'd see two possible workarounds.
1 : launching several sassc instances, one for each of your files. It pretty dirty, but doesn't require any effort, and I guess it is okay if you don't have too many files. Don't forget to terminate all the process (with killall for instance).
$ sassc --watch a.scss a.css & sassc --watch b.scss b.css # etc.
This is really not a great way to handle things, but it can be considered a temporary solution if you're in a hurry.
2 : use libsass inside a python program that would trigger compilation when a watched file is saved. To that end you can use another library like watchdog or pyinotify.
This seems to be a much better way to handle things.
Hope this was helpful, good luck !

Execution permissions in Python

I need to send code to remote clients to be executed in them but security is a concern for me right now. I don't want unsafe code to be executed there so I would like to control what a program is doing. I mean for example, know if is making connections, where is connecting to, if is reading local files, etc. Is this possible with Python?
EDIT: I'm thinking in something similar to Android permission system. I want to know what a code will do and if it does something different, stop it.
You could use a different Python runtime:
if you run your script using Jython; you can exploit Java's permission system
with Pypy's sandboxed version you can choose what is allowed to run in your controller script
There used to be a module in Python called bastian, but that was deprecated as it wasn't that secure. There's also I believe something called RPython, but I don't know too much about that.
I would in this case use Pyro and write the code on the target server. That way you know clients can only execute written and tested code.
edit - it's probably worth noting that Pyro also supports http://en.wikipedia.org/wiki/Privilege_separation - although I've not had to use it for that.
I think you are looking for a sandboxed python. There used to be an effort to implement this, but it has been abolished a couple of years ago.
Sandboxed python in the python wiki offers a nice overview of possible options for your usecase.
The most rigourous (but probably the slowest) way is to run Python on a bare OS in an emulator.
Depending on the OS you use, there are several ways of running programs with restrictions, but without the overhead of an emulator:
FreeBSD has a nice integrated solution in the form of jails.
These grew out of the chroot system call.
Linux-VServer aims to do more or less the same on Linux.

Deploying Python scripts with Eclipse

I have written some Python scripts in Eclipse where at some point I have stable releases which should be deployed. For the moment this is very simple and means copying the scripts to some directory. (Soon I will also consider Git)
Could you tell me the common extendable way to set up a process like this in Eclipse? Maybe something more professional which, if a more complicating deployment becomes neccessary, can still be used.
(I had seen Ant somewhere, but I'm not sure if that is more than I need and maybe not the convention for Python in particular).
I would say use Fabric, and read this blog post for a reasonable introduction to it.

Good way to Django-based website, installing prerequisites if needed

Consider a website build using python and django. In many cases it uses 3rd party modules beside standard python library - such as pytz, South, timezones or debug toolbar.
What is standard or just convenient way to deploy such application to production hosting with all the prerequisites (timezones, etc) installed automatically?
I'm new to python, and sorry if this question is lame.
There are at least two options available. Jacob Kaplan-Moss, one of the co founders of Django has written about packaging an application using buildout and djangorecipe. There is also the versatile fabric. You should be able to tackle your problem using either of these alone or in combination with some custom scripts.
Fabric is definitely a nice way to accomplish this. There is a fairly extensive blog write up on the process at http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/.
The key to fabric is "fabfile.py" - there's an example of one that does a deployment at http://bitbucket.org/copelco/caktus-deployment/src/tip/example-django-project/caktus_website/fabfile.py.
The variation of this that I've used to deploy to a Linode instance is http://gist.github.com/556508
You can either use a deployment solution like fabric (http://fabfile.org/) or you can try to package the entire thing up into a python egg with dependencies that will be automatically installed when you easy_install it. See http://mxm-mad-science.blogspot.com/2008/02/python-eggs-simple-introduction.html for a simple introduction to python eggs.

Miminal Linux For a Pylons Web App?

I am going to be building a Pylons-based web application. For this purpose, I'd like to build a minimal Linux platform, upon which I would then install the necessary packages such as Python and Pylons, and other necessary dependencies. The other reason to keep it minimal is because this machine will be virtual, probably over KVM, and will eventually be replicated in some cloud environment.
What would you use to do this? I am thinking of using Fedora 10's AOS iso, but would love to understand all my options.
I really like JeOS "Just enough OS" which is a minimal distribution of the Ubuntu Server Edition.
If you want to be able to remove all the cruft but still be using a ‘mainstream’ distro rather than one cut down to aim at tiny devices, look at Slackware. You can happily remove stuff as low-level as sysvinit, cron and so on, without collapsing into dependency hell. And nothing in it relies on Perl or Python, so you can easily remove them (and install whichever version of Python your app prefers to use).
For this purpose, I'd like to build a minimal Linux platform...
So Why not try to use ArchLinux www.archlinux.org?
Also you can use virtualenv with Pylons in it.
debootstrap is your friend.
Damn Small Linux? Slax?
If you want to go serious about the virtual appliance idea, take a look at the newly released VMware Studio. It was built exactly for trimming down a system (only Linux for now afaik) so it provides only enough base to run your application.
VMware is going (a bit more) open by pushing an open virtual appliance format (OVF) so, at some point in the future, you might be able to run the result on other virtualization platforms too.
Debootstrap, or use kickstart to strap your FC domains. However, other methods of strapping an RPM based distro exist, such as Steve Kemp's rinse utility that replaces rpmstrap.
Or, you could just grab something at jailtime to use as a base.
If that fails, download everything you need from source, build / install it with a /mydist prefix (including libc, etc) and test it via chroot.
I've been building templates for Xen for years .. its actually turned into a very fun hobby :)

Categories

Resources