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
25 changes: 10 additions & 15 deletions .github/workflows/publish-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install Poetry via pipx
run: pipx install poetry

- name: Configure TestPyPI repository
run: poetry config repositories.testpypi https://test.pypi.org/legacy/

- name: Build and publish to TestPyPI
- name: Build and Publish to TestPyPI
env:
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: poetry publish --build --no-interaction -r testpypi
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
run: |
uv build
uv publish --index testpypi
27 changes: 13 additions & 14 deletions .github/workflows/publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ jobs:
permissions:
contents: write # required to push git tags
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install Poetry via pipx
run: pipx install poetry

- name: Build and publish to PyPI
- name: Build and Publish
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build --no-interaction
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
uv build
uv publish

- name: Tag release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(poetry version --short)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v$VERSION"
git push origin "v$VERSION"
gh release create "v$VERSION" --notes-file ./CHANGELOG.md
19 changes: 4 additions & 15 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
name: Run Tests

on:
push:
branches:
- develop
- main
pull_request:
branches:
- 'release/**'
- develop
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
pipx install poetry
poetry install
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Run tests
run: |
poetry run pytest
uv run pytest
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,9 @@ dmypy.json
**.Rhistory

# MacOS
.DS_Store
.DS_Store
./
.gitignore

# Emacs
*.org
10 changes: 5 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.12"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
# Install UV
# https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_1
- curl -LsSf https://astral.sh/uv/install.sh | sh
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --all-groups
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv sync

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
23 changes: 5 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
# Changelog

## v0.1.4 (05/14/2026)
## v0.2.0

- Added a copy method to Sequential class to make deep copies of a model instance.
- Added tests for Sequential class and builder, and added a test runner to CI/CD.
- Optimization module has been refactored. This is a breaking change.
- Added initialization base class, He initialization, and Xavier initialization.
- Added "full-batch" training by setting `batch_size` model parameter to `None`.
- Documentation updated to include overview.

## v0.1.3 (05/07/2026)

- Removed datasets and pillow as package dependencies and moved to dev dependencies

## v0.1.2 (05/07/2026)

- Fixing CI publishing issue

## v0.1.1 (05/07/2026)

- Setup CI/CD with GitHub Actions

## v0.1.0 (05/04/2026)

- First release of `phitodeep`!
File renamed without changes.
19 changes: 5 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing
# Contributing to Phito-Deep

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
Expand Down Expand Up @@ -42,20 +42,11 @@ If you are proposing a feature:

Ready to contribute? Here's how to set up `phitodeep` for local development.

1. Download a copy of `phitodeep` locally.
1. Clone the repository from GitHub.

2. Create and activate a conda environment for `phitodeep`:
2. You will need to install [UV](https://docs.astral.sh/uv/getting-started/installation/). It is a modern Python environment and project management tool. You will grow to love it, trust me.

```console
$ conda create -n phitodeep python=3.12
$ conda activate phitodeep
```

3. Install `phitodeep` using `poetry`:

```console
$ poetry install
```
3. Simply run `uv run pytest` in the root directory of your cloned repository and it should automatically create your virtual environment with all the necessary dependencies, followed by running the project test suite.

4. Use `git` (or similar) to create a branch for local development and make your changes:

Expand All @@ -65,7 +56,7 @@ Ready to contribute? Here's how to set up `phitodeep` for local development.

5. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.

6. Commit your changes and open a pull request.
6. Commit your changes and open a pull request against the current release branch in development.

## Pull Request Guidelines

Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# phitodeep
# Phito-Deep

Deep learning framework built from scratch with numpy!
Phito-Deep is a deep learning framework built from scratch with only numpy. This is being actively developed as part of my learning journey to becoming a machine learning engineer. I'm using it to better understand the underlying algorithms that power modern deep learning frameworks and architectures.

## Installation

Expand All @@ -14,8 +14,10 @@ MNIST quickstart:
import numpy as np
from datasets import load_dataset

import phitodeep.loss as loss
import phitodeep.model as m
from phitodeep.model import SequentialBuilder
from phitodeep.loss import CategoricalCrossEntropy
from phitodeep.optimization.optimizers import Adam
from phitodeep.optimization.initialization import Xavier, InitType

train_dataset = load_dataset("ylecun/mnist", split="train")
test_dataset = load_dataset("ylecun/mnist", split="test")
Expand All @@ -32,24 +34,25 @@ y_test = np.array(y_test)
print(X_train.shape, y_train.shape)

model = (
m.SequentialBuilder()
SequentialBuilder()
.flatten()
.dense(784, 128)
.relu()
.dense(128, 10)
.dense(128, 64, Xavier(InitType.NORMAL))
.relu()
.dense(64, 10, Xavier(InitType.NORMAL))
.softmax()
.optimizer("adam")
.loss(loss.CategoricalCrossEntropy())
.alpha(0.001)
.epochs(300)
.batch(32)
.optimizer(Adam())
.loss(CategoricalCrossEntropy())
.alpha(0.05)
.epochs(5)
.batch(64)
.build()
)

model.summary()

model.train(X_train, y_train, X_test, y_test)

```

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions docs/conduct.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
```{include} ../CONDUCT.md
```
```{include} ../CODE_OF_CONDUCT.md
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:maxdepth: 1
:hidden:

overview.md
mnist.ipynb
changelog.md
contributing.md
Expand Down
Loading
Loading