pypirc – Fix Breaks Login

pypirc – Fix Breaks Login

(When an upstream bugfix breaks my login)

Getting started on the Python Package Index

Back when I was finally willing to release python code to the wild I did some reading on the web of the simplest methods of getting a project uploaded to PyPI. I found several resources, but one that I clipped and still occasionally refer to was a simple article by Peter Downs on making a project pip installable that is hosted on Github.

This was very simple to follow, so I registered with PyPI (and TestPyPI) using a password generator and created my .pypirc file. After fleshing out my project and adding the necessary components to the setup.py file I excitedly tried to register and upload my first project.

Continue reading

Favourite Python Talks: David Beazley’s Back Catalogue

Favourite Python Talks: David Beazley’s Back Catalogue

The Python community

One of the best things I have found about the python developer community is the willingness to selflessly give back to it. One of these avenues are the talks of its premier conference PyCon and its many offshoots.

These talks are uploaded to YouTube and provide a great insight into the breadth of use of python. There are talks aimed at beginners, outsiders, professional users and more. They range from 3 hour long tutorials on aspects of python like prominent libraries to short but detailed investigations of the internal workings of the CPython implementation

Continue reading

WordPress Rewrites

WordPress Rewrites

Shenanigans in a self-managed server running WordPress.

Good advice gone bad

As part of my refresh of my blogging website, I was reading some advice about working with WordPress. One of the main pieces of advice I discovered in multiple places (like this article and this one) was about permalink format.

I read them fairly thoroughly, thought through the issues and decided. I have just rebooted my website. I like the look of the post-name permalink structure for improving the ease of sharing and discovery. I don’t have any current posts that I care about redirecting to.

So I went ahead and made the change, as well as updating my theme to something less standard. Some last minute viewing of my changes then involved a click or two on some of my internal links like Read more.. and Next/Previous, only to get a 404 response.

Continue reading

Why won’t web work?

Why won’t web work

(or the trip hazards of testing from outside a VM)

A problem resolved…

As someone new to web development I ran into an issue the other day that baffled me for an inordinate length of time. As I am essentially required to run Windows as the O/S of choice in my organisation, but my natural habitat is Linux I tend to spend a lot of my time developing my applications and scripts within a virtual machine.

I am a big fan of the Python ecosystem, and naturally, as I test the waters with web development I’d like to investigate pythons tools and frameworks. I also made a change the other day to my process where instead of running a browser internal to my VM, for testing and viewing I decided to run the browser from my host machine.

Running the simple HTTP server in python using python -m http.server was one of the first services I tried. A quick jump onto Chrome later I was initially perplexed that it wasn’t showing up.

However, with not much searching I quickly realised that the default Network setting on VirtualBox (NAT) does not allow connections out unless I explicitly open a port. With that stored in my memory bank, I went on my way, now thinking that I knew how to solve similar issues in the future.

Continue reading

Setting up a new system

First steps on the new system

My keyboard backlighting does not work by default on Xubuntu, so following the excellent advice over at The Drunken Sloth Inn and a quick keyboard binding that gets that frustration out of the way.

Next up is creating a quick link to the Terminal seeing as most of my work gets done there. This is a simple matter of navigating to the main menu (mouse icon in top left by default), finding the Terminal Emulator and right-clicking on it and selecting Add to Panel. I also do not like the default placement, so I right click on it and select Move to place it somewhere more comfortable.

The next step (if you are inside a VirtualBox VM) is to install the Guest Additions. Using the VirtualBox menu under Devices you can select Insert Guest Additions CD. This will auto-mount and then you can run the bundled script  as follows, using the terminal navigate to the CD, which should be in /media/<username>/VBOXADDITIONS_<version_number>/. Then you can run the script as follows:

sudo sh ./VBoxLinuxAdditions.run

Finally we need to add our user account to the virtualbox user group to allow them access to shared drives etc.

sudo usermod -a -G vboxsf <my-user-id>

 

Now reboot the machine and you can resize and share clipboards without hassle.

Installing our tools

To make setup of new machines easier I currently store my dotfiles (application/user specific settings) in my Dropbox account, and link them to my VM home directory – although I am considering moving them across to somewhere like github and creating a less intensive process for deployment to a new machine, but for now the process is basically as follows.

  1. Install tool using apt-get
  2. Link existing setup file from Dropbox to home folder
  3. Repeat from 1 until no more tools needed.

I use git for source code management, tmux as my screen replacement, zsh as a shell and vim as my editor of choice. I also tend to program in python, and am experimenting with ipython notebooks at the moment, so we’ll install these now.

sudo apt-get install git gitk zsh vim tmux
sudo apt-get install ipython3-qtconsole ipython3-notebook
sudo apt-get install ipython-qtconsole ipython-notebook

Now I’ll link the pre-made dot files from my Dropbox directory.

ln -s /path/to/gitconfig .gitconfig
ln -s /path/to/oh-my-zsh-dir .oh-my-zsh
ln -s /path/to/zshrc .zshrc
ln -s /path/to/vimdir .vim
ln -s /path/to/vimrc .vimrc
ln -s /path/to/tmux.conf .tmux.conf

Change my default shell

chsh -s /bin/zsh

 

Finally, set my terminal colours to the excellent Solarised (dark) colour scheme and we are good to go.