Create a bundle programmatically?
Examining the default Node bundles

The Node module does not create the "Article" and "Basic page" Bundles itself.  After some digging I found the definitions for these bundles in the standard install profile's install file.

/profiles/standard/standard.install

  // Insert default pre-defined node types into the database. For a complete
  // list of available node type attributes, refer to the node type API
  // documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
  $types = array(
    array(
      'type' =&gt; 'page',
      'name' =&gt; st('Basic page'),
      'base' =&gt; 'node_content',
      'description' =&gt; st("Use &lt;em&gt;basic pages&lt;/em&gt; for your static content, such as an 'About us' page."),
      'custom' =&gt; 1,
      'modified' =&gt; 1,
      'locked' =&gt; 0,
    ),
    array(
      'type' =&gt; 'article',
      'name' =&gt; st('Article'),
      'base' =&gt; 'node_content',
      'description' =&gt; st('Use &lt;em&gt;articles&lt;/em&gt; for time-sensitive content like news, press releases or blog posts.'),
      'custom' =&gt; 1,
      'modified' =&gt; 1,
      'locked' =&gt; 0,
    ),
  );

  foreach ($types as $type) {
    $type = node_type_set_defaults($type);
    node_type_save($type);
    node_add_body_field($type);
  }

  // clear the site cache


A few notes about this code


It doesn't use Entity API
st() function should only be used during a Drupal installation process
Node contains a lot of non Field API fields that it handles in node_type_save
Node calls field_attach_create_bundle to tell Field modules about the new bundle




Creating a bundle with the Entity API

I'm not sure how you've defined your entities, but if you've used Entity API then your bundle-creation code might look something like this:

$bundle = new stdClass();
$bundle-&gt;type = 'project_hr';
$bundle-&gt;label = t('HR Project');
$bundle-&gt;is_new = true;
$bundle-&gt;description = t("A super cool project");

$controller = new ProjectTypeController('project_type'); //assuming you defined this extension of EntityAPIController
$controller-&gt;save($bundle);




A note about Entities


An entity type is an abstract base class
A bundle is an extended entity type class
A field is a class member, property, variable or field instance
An entity is an object or instance of a base or extended class


More about entities