Skip to content

Commit 4548810

Browse files
authored
Merge pull request #115 from kayjan/publish-to-conda
Publish to conda
2 parents 236e1cc + 42fe4f9 commit 4548810

File tree

12 files changed

+197
-13
lines changed

12 files changed

+197
-13
lines changed

.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
python -m pip install pytest
3838
python -m pip install pytest-cov
3939
pytest --cov=./ --cov-report=xml
40-
- name: Converage coverage report
40+
- name: Convert coverage report
4141
uses: irongut/CodeCoverageSummary@v1.3.0
4242
with:
4343
filename: coverage.xml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Upload Python Package to Conda
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Upload Python Package to PyPI"]
6+
branches: [master]
7+
types:
8+
- completed
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Conda
15+
run: |
16+
conda install -c conda-forge conda-build conda-verify
17+
- name: Publish to conda
18+
run: |
19+
cd conda
20+
conda config --set anaconda_upload yes
21+
conda build -c conda-forge --output-folder . .
22+
ls
23+
anaconda upload ./noarch/*.tar.bz2

.github/workflows/docs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Docs
22

33
on:
44
workflow_run:
5-
workflows: ["Upload Python Package"]
5+
workflows: ["Upload Python Package to PyPI"]
66
branches: [master]
7-
types:
7+
types:
88
- completed
99

1010
permissions:
@@ -20,8 +20,9 @@ jobs:
2020
docs:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v2
24-
- uses: actions/setup-python@v2
23+
- uses: actions/checkout@v3
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
2526
- name: Install dependencies
2627
run: |
2728
pip install -r docs/requirements.txt

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload Python Package
1+
name: Upload Python Package to PyPI
22

33
on: workflow_dispatch
44

@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v3
1212
- name: Set up Python
13-
uses: actions/setup-python@v3
13+
uses: actions/setup-python@v4
1414
with:
1515
python-version: '3.x'
1616
- name: Install dependencies

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.14.3] - 2023-10-31
8+
### Added
9+
- Misc: Publish to conda, enable automated publishing to conda-forge in addition to existing PyPI.
10+
- README: Tree demonstration code for `shift_and_replace_nodes` and `copy_and_replace_nodes_from_tree_to_tree`.
11+
712
## [0.14.2] - 2023-10-21
813
### Added
914
- Misc: RTD integration.
@@ -370,6 +375,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
370375
- Utility Iterator: Tree traversal methods.
371376
- Workflow To Do App: Tree use case with to-do list implementation.
372377

378+
[0.14.3]: https://github.com/kayjan/bigtree/compare/0.14.2...0.14.3
373379
[0.14.2]: https://github.com/kayjan/bigtree/compare/0.14.1...0.14.2
374380
[0.14.1]: https://github.com/kayjan/bigtree/compare/0.14.0...0.14.1
375381
[0.14.0]: https://github.com/kayjan/bigtree/compare/0.13.3...0.14.0

README.md

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Related Links:
1313
- [Issues](https://github.com/kayjan/bigtree/issues)
1414
- [Discussions](https://github.com/kayjan/bigtree/discussions)
1515
- [Contributing](https://bigtree.readthedocs.io/en/latest/others/contributing.html)
16-
- [PyPI](https://pypi.org/project/bigtree/)
16+
- Package
17+
- [PyPI](https://pypi.org/project/bigtree/)
18+
- [Conda](https://anaconda.org/conda-forge/bigtree)
1719
- Articles
1820
- [Python Tree Implementation with BigTree](https://towardsdatascience.com/python-tree-implementation-with-bigtree-13cdabd77adc#245a-94ae81f0b3f1)
1921
- [The Reingold Tilford Algorithm Explained, with Walkthrough](https://towardsdatascience.com/reingold-tilford-algorithm-explained-with-walkthrough-be5810e8ed93?sk=2db8e10398cee76c486c4b06b0b33322)
@@ -99,6 +101,10 @@ For **Directed Acyclic Graph (DAG)** implementation, there are 4 main components
99101

100102
## Installation
101103

104+
There are two ways to install `bigtree`, with pip (from PyPI) or conda (from conda-forge).
105+
106+
### a) Installation with pip (preferred)
107+
102108
To install `bigtree`, run the following line in command prompt:
103109

104110
```shell
@@ -127,6 +133,14 @@ Alternatively, install all optional dependencies with the following line in comm
127133
$ pip install 'bigtree[all]'
128134
```
129135

136+
### b) Installation with conda
137+
138+
To install `bigtree` with conda, run the following line in command prompt:
139+
140+
```shell
141+
$ conda install -c conda-forge bigtree
142+
```
143+
130144
----
131145

132146
## Tree Demonstration
@@ -500,10 +514,10 @@ root.show()
500514

501515
### Modify Tree
502516

503-
Nodes can be shifted or copied from one path to another.
517+
Nodes can be shifted (with or without replacement) or copied from one path to another.
504518

505519
```python
506-
from bigtree import Node, shift_nodes
520+
from bigtree import Node, shift_nodes, shift_and_replace_nodes
507521

508522
root = Node("a")
509523
b = Node("b", parent=root)
@@ -526,6 +540,17 @@ root.show()
526540
# │ └── c
527541
# └── dummy
528542
# └── d
543+
544+
shift_and_replace_nodes(
545+
tree=root,
546+
from_paths=["a/dummy"],
547+
to_paths=["a/b/c"],
548+
)
549+
root.show()
550+
# a
551+
# └── b
552+
# └── dummy
553+
# └── d
529554
```
530555

531556
```python
@@ -556,10 +581,10 @@ root.show()
556581
# └── d
557582
```
558583

559-
Nodes can also be copied between two different trees.
584+
Nodes can also be copied (with or without replacement) between two different trees.
560585

561586
```python
562-
from bigtree import Node, copy_nodes_from_tree_to_tree
587+
from bigtree import Node, copy_nodes_from_tree_to_tree, copy_and_replace_nodes_from_tree_to_tree
563588
root = Node("a")
564589
b = Node("b", parent=root)
565590
c = Node("c", parent=root)
@@ -583,6 +608,28 @@ root_other.show()
583608
# │ └── c
584609
# └── dummy
585610
# └── d
611+
612+
root_other = Node("aa")
613+
b = Node("b", parent=root_other)
614+
c = Node("c", parent=b)
615+
d = Node("d", parent=root_other)
616+
root_other.show()
617+
# aa
618+
# ├── b
619+
# │ └── c
620+
# └── d
621+
622+
copy_and_replace_nodes_from_tree_to_tree(
623+
from_tree=root,
624+
to_tree=root_other,
625+
from_paths=["a/b", "a/c"],
626+
to_paths=["aa/b/c", "aa/d"],
627+
)
628+
root_other.show()
629+
# aa
630+
# ├── b
631+
# │ └── b
632+
# └── c
586633
```
587634

588635
### Tree Search
@@ -622,6 +669,7 @@ find_attr(root, "age", 40)
622669
```
623670

624671
To find multiple nodes,
672+
625673
```python
626674
from bigtree import Node, findall, find_names, find_relative_path, find_paths, find_attrs
627675
root = Node("a", age=90)

bigtree/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.14.2"
1+
__version__ = "0.14.3"
22

33
from bigtree.binarytree.construct import list_to_binarytree
44
from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag

bigtree/meta.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{% set name = "bigtree" %}
2+
{% set version = "0.14.2" %}
3+
4+
package:
5+
name: {{ name|lower }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://github.com/kayjan/bigtree/archive/{{ version }}.tar.gz
10+
sha256: 21f5c61a48db0c731b00e5e08a66f16e231960accf64e4ae6d80c3fc91eb9c54
11+
12+
build:
13+
noarch: python
14+
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
15+
number: 0
16+
17+
requirements:
18+
host:
19+
- python >=3.7
20+
- hatchling
21+
- pip
22+
run:
23+
- python >=3.7
24+
25+
test:
26+
imports:
27+
- bigtree
28+
commands:
29+
- pip check
30+
requires:
31+
- pip
32+
33+
about:
34+
summary: Tree Implementation and Methods for Python, integrated with Python list, dictionary, and pandas DataFrame.
35+
license: MIT
36+
license_file: LICENSE
37+
38+
extra:
39+
recipe-maintainers:
40+
- kay

conda/conda-env.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: conda-env
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pip
6+
- pytest
7+
- pytest-cov

conda/conda_build_config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
python:
2+
- 3.7
3+
- 3.8
4+
- 3.9
5+
- 3.10
6+
- 3.11

0 commit comments

Comments
 (0)