Skip to content

Commit

Permalink
ci: fix docs deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
nadobando committed Oct 14, 2023
1 parent af4326c commit 63862d7
Show file tree
Hide file tree
Showing 21 changed files with 268 additions and 130 deletions.
38 changes: 17 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-1.1.12-0
key: poetry-1.4.0

- name: Install and configure Poetry
uses: snok/install-poetry@v1
Expand All @@ -77,13 +77,12 @@ jobs:
# Install dependencies. `--no-root` means "install all dependencies but not the project
# itself", which is what you want to avoid caching _your_ code. The `if` statement
# ensures this only runs on a cache miss.
- run: poetry install --no-interaction --no-root
- run: poetry install --no-interaction --no-root --with docs
if: steps.cache-deps.outputs.cache-hit != 'true'

- run: poetry install --no-interaction
- run: poetry install --no-interaction --with docs

- name: test

run: |
poetry run pytest --cov=pydango --cov-report=xml:coverage.xml --junitxml=test-results/test-results.xml tests
Expand All @@ -110,6 +109,7 @@ jobs:
name: Release
if: github.ref == 'refs/heads/main'
needs:
- pre-commit
- test
runs-on: ubuntu-latest
concurrency: release
Expand All @@ -133,7 +133,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-1.1.12-0
key: poetry-1.4.0

- name: Install and configure Poetry
uses: snok/install-poetry@v1
Expand All @@ -149,6 +149,18 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: poetry install --no-interaction --only docs

- run: poetry run mkdocs gh-deploy --force

- run: |
poetry build
Expand Down Expand Up @@ -182,19 +194,3 @@ jobs:
- name: Publish package distributions to PyPI

uses: pypa/gh-action-pypi-publish@release/v1

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}


- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
15 changes: 6 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# CHANGELOG



## v0.2.0 (2023-10-14)

### Chore

* chore: fix pyproject.toml (#5) ([`e9063ff`](https://github.com/nadobando/pydangorm/commit/e9063ff034e4042d778b992aff2c55191d416fa9))
- chore: fix pyproject.toml (#5) ([`e9063ff`](https://github.com/nadobando/pydangorm/commit/e9063ff034e4042d778b992aff2c55191d416fa9))

### Feature

* feat: support collection config kwargs some session utils and refactor ([`adf7f1a`](https://github.com/nadobando/pydangorm/commit/adf7f1a700b7537eaf7714e9d19abd331836be5f))
- feat: support collection config kwargs some session utils and refactor ([`adf7f1a`](https://github.com/nadobando/pydangorm/commit/adf7f1a700b7537eaf7714e9d19abd331836be5f))

### Fix

* fix: mini refactor of files ([`0e711c7`](https://github.com/nadobando/pydangorm/commit/0e711c715614e6c4f0fb39951ae9969a79c3f72c))

* fix: moved query execution to session ([`6957559`](https://github.com/nadobando/pydangorm/commit/6957559a25ef5bb75a3b66dbd45403987a3a633f))
- fix: mini refactor of files ([`0e711c7`](https://github.com/nadobando/pydangorm/commit/0e711c715614e6c4f0fb39951ae9969a79c3f72c))

- fix: moved query execution to session ([`6957559`](https://github.com/nadobando/pydangorm/commit/6957559a25ef5bb75a3b66dbd45403987a3a633f))

## v0.1.0 (2023-09-25)

### Build

* build: add py.typed (#3) ([`eb642eb`](https://github.com/nadobando/pydangorm/commit/eb642ebba7cba67b0fc37352776f2f23cedb6330))
- build: add py.typed (#3) ([`eb642eb`](https://github.com/nadobando/pydangorm/commit/eb642ebba7cba67b0fc37352776f2f23cedb6330))

### Feature

* feat: save and fetch models (#1) ([`8935e4f`](https://github.com/nadobando/pydangorm/commit/8935e4f8ec5c39f300cb7f818000fe8563e21989))
- feat: save and fetch models (#1) ([`8935e4f`](https://github.com/nadobando/pydangorm/commit/8935e4f8ec5c39f300cb7f818000fe8563e21989))
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- **Asynchronous Support**: Perform asynchronous database operations for optimized I/O-bound tasks.

### [Full Documentation](https://nadobando.github.io/pydangorm)

## Installation

```shell
Expand Down
Empty file removed docs/db_related.md
Empty file.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ______________________________________________________________________

### **Contributions**

We're actively looking for contributors to help improve pydangorm and expand its capabilities.
We're actively looking for contributors to help improve `pydangorm` and expand its capabilities.

Whether you're a seasoned
developer or just starting out, your contributions are valuable to us. If you have ideas for new features,
Expand Down
25 changes: 1 addition & 24 deletions docs/orm/base.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## BaseArangoModel Class Documentation
## **`BaseArangoModel`**

### Overview

Expand All @@ -21,32 +21,9 @@ entities. It provides core attributes, methods, and configurations to facilitate

### Methods

1. \*\*__init__(self, **data: Any)**: Initializes the model. If session data is provided, it sets the `__session__`
attribute, linking the model to a specific session.

1. **\_decompose_class(cls, obj: Any)**: Decomposes or serializes the model. Customized to handle the specific needs of
ArangoDB entities.

1. **\_calculate_keys(self, ...)**: Determines the keys for the model based on inclusion, exclusion, and other criteria.

1. **from_orm(cls, obj: Any, session=None)**: Constructs a model instance from an ORM object. Handles relationships and
ensures that associated entities are correctly initialized.

1. \*\*update_forward_refs(cls, **localns: Any)**: Resolves and updates forward references in relationships and fields.

1. **save_dict(self)**: An abstract method to be implemented in derived classes. It outlines how the model data should
be saved or serialized.

### Tips for Developers:

1. When creating a new model, consider extending the `BaseArangoModel`. It offers foundational attributes and methods
tailored for ArangoDB.
1. Always specify relationships correctly. The `__relationships__` and `__relationships_fields__` attributes are central
to the model's operation.
1. If working with forward references, ensure to call the `update_forward_refs` method after all models are defined to
resolve and set up relationships.
1. Implement the `save_dict` method in derived classes to customize data saving or serialization behavior.

______________________________________________________________________

This documentation offers a developer-centric guide to the `BaseArangoModel` class. It is designed to help developers
Expand Down
46 changes: 46 additions & 0 deletions docs/orm/query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## **`query.py`**

The module within the orm sub-package provides functionalities and structures for ORM-based querying in
relation to ArangoDB.
It integrates with various parts of the ORM and aids in constructing and executing queries.

#### Key Features

- Automatic binding
- `AQL` injection protection
- query building

## **`ORMQuery`**

The `ORMQuery` class is a subclass of `AQLQuery`.
It provides a Pythonic API for constructing queries for ArangoDB.

## builder helpers

### `for_()`

the `for_()` method is used to specify the target vertex/edge collection of the query.

```python
from pydango.orm import for_


for_(User).filter(User.name == "John Doe").return_(User)
```

### `traverse()`

```python
from pydango.orm import traverse
from pydango.query.expressions import IteratorExpression
from pydango.query import TraversalDirection

edge = IteratorExpression()
traverse(
(User, edge),
edges={"friends"},
start="people/1",
depth=(0, 1),
direction=TraversalDirection.OUTBOUND,
).filter(User.name == "John Doe").return_(User)
```
83 changes: 83 additions & 0 deletions docs/orm/vertex2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Certainly. Let's create the documentation for the `vertex.py` module in a developer-friendly format.

______________________________________________________________________

## Vertex Module Documentation

### Introduction

The `vertex.py` module is integral to the `pydango` ORM, providing foundational classes and utilities for representing
and working with vertices in ArangoDB.

### Classes

#### 1. VertexCollectionConfig

- **Description**: Configuration specific to a vertex collection in ArangoDB.
- **Attributes**:
- `type`: Set to `CollectionType.NODE`, this attribute classifies the collection as a node or vertex collection in
ArangoDB.

#### 2. VertexMeta (Metaclass)

- **Description**: A custom metaclass for vertex models. It processes namespace information, defines relationships
between vertices, and sets up edge models during the class creation process.

- **Methods**:

- `_build_edge_to_field_mapping(relationships: Relationships) -> EdgeFieldMapping`:

- **Purpose**: Constructs a mapping between edges and fields based on provided relationships.
- **Parameters**:
- `relationships`: Relationship information between vertices.

- `_validate_edges(edge_to_field_mapping: EdgeFieldMapping, namespace: dict) -> None`:

- **Purpose**: Validates the constructed edge-to-field mappings.
- **Parameters**:
- `edge_to_field_mapping`: Mapping between edges and fields.
- `namespace`: Current namespace of the class being processed.

- `_build_model(relationships: Relationships, name: str) -> Model`:

- **Purpose**: Constructs a model based on provided relationships and name.
- **Parameters**:
- `relationships`: Relationship information between vertices.
- `name`: Name for the constructed model.

#### 3. VertexModel

- **Description**: Represents a vertex model in the ORM. It defines and manages vertices and their relationships to
edges.

- **Attributes**:

- `edges`: Represents the edges related to this vertex.
- `__edge_to_field_mapping__`: A dictionary mapping edges to their respective fields.

- **Methods**:

- `__init__(self, **data: Any) -> None`:

- **Purpose**: Initializes the vertex model.
- **Parameters**:
- `data`: Data to initialize the vertex model with.

- `dict(self, ...) -> dict`:

- **Purpose**: Extracts the data from the model in a dictionary format.
- **Parameters**:
- Various parameters to customize the output, such as `include`, `exclude`, `by_alias`, etc.

### Tips for Developers:

1. When defining a vertex model, extend the `VertexModel` class. Use the provided utilities and methods to ensure proper
relationships and data handling.
1. The `VertexMeta` metaclass processes and sets up relationships during class creation. Ensure that relationships are
defined correctly to leverage the ORM's capabilities.
1. Utilize the `VertexModel`'s `dict` method for data extraction and serialization.

______________________________________________________________________

This documentation provides an overview and developer-centric guide to the `vertex.py` module. Adjustments can be made
based on further content or specific requirements. Would you like to proceed with another section or topic?
2 changes: 1 addition & 1 deletion docs/query/expressions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Expressions
# **Expressions**

## **Basic Expressions**

Expand Down
2 changes: 1 addition & 1 deletion docs/query/functions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Functions
# **Functions**

## **Abstract Functions**

Expand Down
12 changes: 0 additions & 12 deletions docs/query/index.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/query/options.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Options
# **Options**

A Base class representing general AQL options.
Some AQL Operations have options that can be passed to them. to configure how the operation is performed.
Expand Down
Loading

0 comments on commit 63862d7

Please sign in to comment.