> For the complete documentation index, see [llms.txt](https://docs.datagym.ai/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.datagym.ai/documentation/python-api/projects.md).

# Projects

## Description

The Project object in our Python API Wrapper is a representation of the [Projects](/documentation/project/what-is-a-project.md) you already know from **Data**Gym.ai. This object includes all the data that belongs to your **Data**Gym.ai Project, such as connected Datasets and Images. Projects can be accessed through the Client object introduced in the [Getting Started](/documentation/python-api/getting-started.md) page.

## Fetching Projects from DataGym

Before we look at the Project object in our Python API Wrapper, you first have to learn how to get the data from **Data**Gym.ai. There are multiple ways to get your Projects from DataGym's backend.

### Get all Projects

```python
projects = client.get_projects()
```

`get_projects` returns all Projects in a list.

### Get a Project by its name

```python
dummy_project = client.get_project_by_name(project_name="Dummy_Project")
```

`get_project_by_name` returns a specific Project by its unique name

## The Project object

### Project Attributes

The Project object of the Python API is modeled after DataGym's Projects and, therefore, inherits the same attributes you already know from your Projects.

{% code title=">>>> print(dummy\_project)" %}

```python
<Project {
    'id': 'b1f53633-f3aa-4f9a-9195-a9a651f739df', 
    'name': 'Dummy_Project', 
    'short_description': 'A project that helps to track cars from an arial drone',
    'timestamp': '1583828520411', 
    'label_config_id': 'cdc426e1-0a0d-4f94-9173-4d1dcca10f04', 
    'label_iteration_id': '50ad280c-50ef-408d-8d56-b2661aa54324', 
    'owner': '3360f10f-a5ab-48a6-966c-cdba2d63116a', 
    'datasets': <List[Dataset] with 1 element>
}>
```

{% endcode %}

As you can see, a Project object also contains a list of its connected Datasets, which are represented as [Dataset objects](/documentation/python-api/datasets.md).&#x20;

### Project helper methods

A Project can hold an arbitrary number of Datasets which also can hold an arbitrary number of images. To simplify the access to these objects, the Project object provides a variety of helper methods.

#### Get a Dataset by its name

```python
dataset = project.get_dataset_by_name(dataset_name="<DATASET_NAME>")
```

`get_dataset_by_name` returns a single Dataset or `None` if no Dataset with the given name was found.

#### Get all Images from a Project

```python
list_of_images = project.get_images()
```

`get_images` returns a list of all [Images](/documentation/python-api/images.md) from all Datasets connected to the Project.

#### Get Images by name

In some cases you might only be interested in a specific set of images. The `get_images_by_name` method can reduce the effort of searching for these images with your own scripts. The method takes an image name and returns the image(s) with this exact name within your Project.

```python
images = project.get_images_by_name(image_name="satellite_img_01.jpg")
```

`get_images_by_name` returns a list of Images that match the search term

You can also use regular expressions to start a broader search and return all images that fit into a specific naming pattern. For example, let's get all satellite images from your project by searching for the regular expression "**satellite.\***":

```python
images = project.get_images_by_name(image_name="satellite.*", regex=True)
```

{% code title="output" %}

```python
[    
    <Image {
        'id': '<ID_2>', 
        'image_name': 'satellite_img_01.jpg', 
        'image_type': 'SHAREABLE_LINK', 
        'timestamp': 1583831745119
    }>, 
    <Image {
        'id': '<ID_2>', 
        'image_name': 'satellite_img_02.jpg', 
        'image_type': 'SHAREABLE_LINK', 
        'timestamp': 1583831714382
    }>
]
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.datagym.ai/documentation/python-api/projects.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
