Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed:
- Misc: Documentation to include more contribution information and guidelines.

## [0.18.2] - 2024-06-01
### Changed:
Expand Down
93 changes: 0 additions & 93 deletions docs/contributing.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/benchmarks.md → docs/home/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ hide:
# ⏰ Benchmarks

<div>
<iframe onload="resizeIframe(this)" scrolling="no" style="width:100vw; border:none" src="../dev/bench/index.html"></iframe>
<iframe onload="resizeIframe(this)" scrolling="no" style="width:100vw; border:none" src="../../dev/bench/index.html"></iframe>
</div>
6 changes: 3 additions & 3 deletions docs/binarytree.md → docs/home/binarytree.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ title: Binary Tree
For **Binary Tree** implementation, there are 3 main components.
Binary Node inherits from Node, so the components in Tree implementation are also available in Binary Tree.

## [**🌿 Node**](bigtree/node/index.md)
## [**🌿 Node**](../bigtree/node/index.md)
- ``BinaryNode``, Node with binary tree rules

## [**✨ Constructing Binary Tree**](bigtree/binarytree/construct.md)
## [**✨ Constructing Binary Tree**](../bigtree/binarytree/construct.md)
- From *list*, using flattened list structure

## [**➰ Traversing Binary Tree**](bigtree/utils/iterators.md)
## [**➰ Traversing Binary Tree**](../bigtree/utils/iterators.md)
- In-Order Traversal
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/home/community.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: Community
---

# 🐾 Community
There are many ways to contribute to bigtree

* Give bigtree a 🌟 on [GitHub](https://github.com/kayjan/bigtree)
* [Share](https://github.com/kayjan/bigtree/discussions/52) your bigtree projects
* [Contribute](contributing.md) to bigtree open source libraries
* Support bigtree on [buymeacoffee](https://buymeacoffee.com/kayjan)
110 changes: 110 additions & 0 deletions docs/home/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: Contributing
---

# 🍪 Contributing
bigtree is a tree implementation package for Python. It integrates with Python lists, dictionaries, pandas and
polars DataFrame.

Thank you for taking the time to contribute. Contributing to this package is an excellent opportunity to dive into
tree implementations.

## Set Up

First, [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and
clone the forked repository.

```console
$ git clone git@github.com:<your-username>/bigtree.git
```

Next, create a virtual environment and activate it.

=== "conda"
```console
$ conda create -n bigtree_venv python=3.10
$ conda activate bigtree_venv
```

=== "venv"
```console
$ python -m venv .venv
$ source .venv/bin/activate
```

To check if it worked,

=== "conda"
```console
$ which pip
/<some directory>/envs/bigtree_venv/bin/pip
```

=== "venv"
```console
$ which pip
/<current directory>/.venv/bin/pip
```

From the project folder, install the required python packages locally in editable mode and set up pre-commit checks.

$ python -m pip install -e ".[all]"
$ python -m pip install pre-commit
$ pre-commit install

## Developing

After making your changes, create a new branch, add and commit your changed files.
In this example, let's assume the changed file is `README.md`.
If there are any pre-commit changes or comments, do modify, re-add and re-commit your files.

```console
$ git checkout -b chore/update-readme
$ git add README.md
$ git commit -m "chore: updated README"
```

Push your changes to your created branch and [create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) from your fork.

```console
$ git push origin chore/update-readme
```

## Testing

If there are changes related to code, make sure to add or update the tests accordingly.
Run the following lines of code and ensure the <mark>unit tests pass</mark> and the
<mark>code coverage is 100%</mark>.

```console
$ python -m pip install pytest coverage
$ pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=bigtree
```

## Documentation

If there are changes related to code, make sure to add or update the documentations and docstrings accordingly.

For documentation, `bigtree` uses [mkdocs](https://www.mkdocs.org) for documentation and previews can be viewed
by running the following lines of code.

```console
$ python -m pip install hatch
$ hatch run mkdocs:build
$ hatch run mkdocs:serve
```

For docstrings, ensure that the description is most updated and existing, added, or modified sample code examples
in docstring still work. Run the following lines of code to generate the <mark>coverage report and test report for
docstrings</mark>. Refer to the console log for information on the file location of the reports.

```console
$ python -m pip install hatch
$ hatch run docs:coverage
$ hatch run docs:doctest
```

## Consequent Changes

Please [open an issue](https://github.com/kayjan/bigtree/issues/new/choose) to discuss important changes before
embarking on an implementation.
32 changes: 32 additions & 0 deletions docs/home/convention.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Convention and Standards
---

# 💬 Convention and Standards


## Git Workflow

When creating branches, it is recommended to create them in the format `type/action`. For example,

```console
$ git checkout -b feat/add-this
```

This project enforces [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)
when writing commit messages.

- The regex for conventional commits is as such `(?s)(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?!?:( [^\n\r]+)((\n\n.*)|(\s*))?$`.

## Code Format

During pre-commit checks, this project checks and formats code using `black`, `flake8`, `isort`, and `mypy`.

## Testing

For testing, this project uses `pytest` and `coverage` package for testing of codes,
and `doctest` and `docstr-coverage` package for testing of docstrings.

## Documentation

For documentation, this project follows the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html).
8 changes: 4 additions & 4 deletions docs/dag.md → docs/home/dag.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ title: Directed Acyclic Graph (DAG)

For **Directed Acyclic Graph (DAG)** implementation, there are 4 main components.

## [**🌼 Node**](bigtree/node/index.md)
## [**🌼 Node**](../bigtree/node/index.md)
- ``DAGNode``, extendable class for constructing Directed Acyclic Graph (DAG)

## [**✨ Constructing DAG**](bigtree/dag/construct.md)
## [**✨ Constructing DAG**](../bigtree/dag/construct.md)
- From *list*, containing parent-child tuples
- From *nested dictionary*
- From *pandas DataFrame*

## [**➰ Traversing DAG**](bigtree/utils/iterators.md)
## [**➰ Traversing DAG**](../bigtree/utils/iterators.md)
- Generic traversal method

## [**🔨 Exporting DAG**](bigtree/dag/export.md)
## [**🔨 Exporting DAG**](../bigtree/dag/export.md)
- Export to *list*, *dictionary*, or *pandas DataFrame*
- Export DAG to *dot* (can save to .dot, .png, .svg, .jpeg files)
File renamed without changes.
18 changes: 9 additions & 9 deletions docs/tree.md → docs/home/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ title: Tree

For **Tree** implementation, there are 9 main components.

## [**🌺 Node**](bigtree/node/index.md)
## [**🌺 Node**](../bigtree/node/index.md)
- ``BaseNode``, extendable class
- ``Node``, BaseNode with node name attribute

## [**✨ Constructing Tree**](bigtree/tree/construct.md)
## [**✨ Constructing Tree**](../bigtree/tree/construct.md)
- From `Node`, using parent and children constructors
- From *str*, using tree display or Newick string notation
- From *list*, using paths or parent-child tuples
Expand All @@ -21,42 +21,42 @@ For **Tree** implementation, there are 9 main components.
- Add nodes and attributes to existing tree using *dictionary*, *pandas DataFrame*, or *polars DataFrame*, using path
- Add only attributes to existing tree using *dictionary*, *pandas DataFrame*, or *polars DataFrame*, using node name

## [**➰ Traversing Tree**](bigtree/utils/iterators.md)
## [**➰ Traversing Tree**](../bigtree/utils/iterators.md)
- Pre-Order Traversal
- Post-Order Traversal
- Level-Order Traversal
- Level-Order-Group Traversal
- ZigZag Traversal
- ZigZag-Group Traversal

## [**📝 Modifying Tree**](bigtree/tree/modify.md)
## [**📝 Modifying Tree**](../bigtree/tree/modify.md)
- Copy nodes from location to destination
- Shift nodes from location to destination
- Shift and replace nodes from location to destination
- Copy nodes from one tree to another
- Copy and replace nodes from one tree to another

## [**🔍 Tree Search**](bigtree/tree/search.md)
## [**🔍 Tree Search**](../bigtree/tree/search.md)
- Find multiple nodes based on name, partial path, relative path, attribute value, user-defined condition
- Find single nodes based on name, partial path, relative path, full path, attribute value, user-defined condition
- Find multiple child nodes based on user-defined condition
- Find single child node based on name, user-defined condition

## [**🔧 Helper Function**](bigtree/tree/helper.md)
## [**🔧 Helper Function**](../bigtree/tree/helper.md)
- Cloning tree to another `Node` type
- Get subtree (smaller tree with different root)
- Prune tree (smaller tree with same root)
- Get difference between two trees

## [**📊 Plotting Tree**](bigtree/utils/plot.md)
## [**📊 Plotting Tree**](../bigtree/utils/plot.md)
- Enhanced Reingold Tilford Algorithm to retrieve (x, y) coordinates for a tree structure

## [**🔨 Exporting Tree**](bigtree/tree/export.md)
## [**🔨 Exporting Tree**](../bigtree/tree/export.md)
- Print to console, in vertical or horizontal orientation
- Export to *Newick string notation*, *dictionary*, *nested dictionary*, *pandas DataFrame*, or *polars DataFrame*
- Export tree to *dot* (can save to .dot, .png, .svg, .jpeg files)
- Export tree to *Pillow* (can save to .png, .jpg)
- Export tree to *Mermaid Flowchart* (can display on .md)

## [**✔️ Workflows**](bigtree/workflows/index.md)
## [**✔️ Workflows**](../bigtree/workflows/index.md)
- Sample workflows for tree demonstration!
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It is pythonic, making it easy to learn and extendable to many types of workflow
Install [`bigtree`](#) with `pip` or `conda` and get up
and running in minutes

[:octicons-arrow-right-24: Getting started](install.md)
[:octicons-arrow-right-24: Getting started](home/install.md)

- :material-map:{ .lg .middle } __Getting started__

Expand Down
Loading