Skip to main content

Utilities for working with projects and applications organized within a root directory.

Project description

## Introduction

This idea is inspired by Git and Django, which assume projects are organized within a directory. Many other applications and projects work this way, like Ruby on Rails and Maven.

Many projects, like source code repositories, web applications, etc., store locations of code, configuration, scripts, virtual environments, etc., relative to the root directory of the project or application.

When a script, application, executable, binary, program, or command is executed, it needs to find the root directory of the project it is supposed to operate on. For example, git status only works when called from within a git repository. Alternatively, a Django script can be run from anywhere, yet it knows to operate on the web application it is located within.

There are two sub-organizing principles seen in project commands, based around how they find the root directory of the project:

  • In the “cwd” approach, exemplified by git, code and executables find the project based on the current working directory. For example, to work in a git repository, one must first cd to somewhere in the repository directory tree.
  • In the “which” approach, exemplified by a django script, code and executables find the project based on the path of the executable itself. For example, a django script expects to be located in the root of the project.

An advantage of the “cwd” approach is that one set of binaries can be used with multiple projects.

An advantages of the “which” approach are that one can run the binaries from anywhere. Another advantage is that a different version of code/binaries can be associated with each project. This can be useful for deployments of multiple version of an application.

## Contribute

Feel free to make a pull request on github.

## Requirements

  • Probably Python 2.7 (since that is the only version it has been tested with.)

## Installation

### Install from

Download and install using pip:

pip install projd

### Install from

Using github, one can clone and install a specific version of the package:

cd ~ git clone cd projd python install

Or use pip:

pip install git+git://

## Usage

There are two functions for finding the root directory of a project based on that root directory containing a specific token, a file or directory. One function works based on the current working directory.

For example to find the root directory of a git repository one would do:

import projd root = projd.cwd_token_dir(‘.git’)

To find the root directory of a project containing the script being executed (similar to how a django file works), one would do:

import projd root = projd.script_token_dir(‘.git’)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for projd, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size projd-0.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page