Coder Social home page Coder Social logo

olange / hamster-to-harvest.py Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 36 KB

A Python script to migrate Hamster time tracking entries to Harvest – an early attempt, containing a few goodies, but rather look at project `hamster-to-harvest`

License: Other

Python 77.41% HTML 22.59%

hamster-to-harvest.py's Introduction

Hamster to Harvest

A utility script written in Python to migrate Hamster time tracking entries to the Harvest time tracking web service.

Status

Alpha stage. It is possible to migrate tasks from Hamster to Harvest, but the migration operations have to be hardcoded within the commands/migrate.py script.

Source is not maintained anymore. This project is an early abandoned attempt to migrate Hamster activities directly from its SQL database into Harvest, thru Harvest's REST API.

Superseded by the hamster-to-harvest project, which uses another approach: it converts Hamster activities exported as an XML file to a CSV file, ready to be imported in Harvest (thru its CSV Import interface, available online, in the Harvest webapp).

The CSV interface has the drawback that it cannot currently set the Started at, Ended at and Billed? fields, which could be defined thru Harvest's REST API.

For Hamster users, this repo contains a few goodies that might prove useful; see below.

Installation

Download the migration script

$ git clone [email protected]:olange/hamster-to-harvest.py.git

Setup a Python virtual environment

If you're not using virtualenv yet, I'd recommend you to install it first; it will keep your Python system installation clean:

$ pip install virtualenv

Then go to the migration script home folder, create a fresh virtual environment and activate it (below it is named venv, but you can name the environment as you like):

$ cd hamster-to-harvest
$ virtualenv venv
$ source venv/bin/activate

Install dependencies

Retrieve and install the project dependencies:

$ pip install -r requirements.txt

They will go to the virtual environnement you created previously. From here on you can run the migration script.

Execution

Setup

$ cd hamster-to-harvest
$ source venv/bin/activate

Configure

First, create a configuration file hamster-migrate.cfg from the template:

$ cp hamster-migrate.cfg.sample hamster-migrate.cfg

and setup your Harvest authentication credentials in hamster-migrate.cfg.

Then, place a copy of your Hamster database into the data/ subfolder. The database should be named hamster.db.

Alternatively, you could change the database-dir configuration option in the [Hamster] section of the configuration to point to your Hamster applet live database; on Ubuntu, you'd define it like this:

[Hamster]
database-dir = ~/.local/share/hamster-applet
...

Getting help

$ python hamster-migrate.py --help

### Cleanup

By the end of your work session, remember to deactivate the virtual environment:

$ deactivate

Rationale

I needed to consolidate all time entries from Harvest, Hamster and another home grown system I was using. As Hamster was not maintained anymore (see Toms Bauģis' announcement of 18.08.2014), I decided to consolidate them to Harvest. Hence the need for a migration script.

I switched to Harvest because it was widely available from anywhere, and also because Hamster was missing a few key features: a bulk edit feature to mark time entries as being invoiced (I wrote a small utility script to handle this, see the goodies hereafter); and the reporting was missing a few features.

References

## So long

I'll be missing Hamster. The applet had a nicely designed user interface. It evolved in interesting graphical and user interface experiments. And there was an irreverent, creative and cheerful tone in the project's communications.

        #this is most essential
        if any([b in activity for b in ("bbq", "barbeque", "barbecue")]) and "omg" in activity:
            self.ponies = True
            self.description = "[ponies = 1], [rainbows = 0]"

Goodies

hamster-update.py is a script that rewrites tags on Hamster facts. The operations are hardcoded, you would need to change them, as well as the query criterias (date range, projects) within the script itself.

harvest-projects-and-tasks-list.py is a simple code fragment to retrieve the list of projects and tasks from the Harvest API. You get the same by running python hamster-migrate.py seed.

report_template.html is an alternative template to the one delivered with Hamster, that I used to report time and deliver with my invoices.

Known issues

The following message might be displayed when running the hamster-migrate.py script on machines with an OS other than Ubuntu; the Hamster Python library is looking for another library gio, available with Ubuntu only. You can safely ignore this message:

WARNING:root:Could not import gio - requires pygobject. File monitoring will be disabled

## License

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

hamster-to-harvest.py's People

Contributors

olange avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

plumpmath

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.