Skip to content

Commit

Permalink
Merge pull request #169 from sepandhaghighi/dev
Browse files Browse the repository at this point in the history
Version 1.0
  • Loading branch information
sepandhaghighi authored Dec 14, 2022
2 parents e42f808 + 54d5849 commit 7e66936
Show file tree
Hide file tree
Showing 17 changed files with 417 additions and 111 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0]
os: [ubuntu-20.04, windows-latest]
python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -40,26 +40,26 @@ jobs:
python -m pytest test --cov=samila --cov-report=term
env:
NFT_STORAGE_API_KEY: ${{ secrets.NFT_STORAGE_API_KEY }}
if: matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest'
if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04'
- name: Version check
run: |
python otherfiles/version_check.py
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
- name: Other tests
run: |
python -m vulture samila/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r samila -s B311,B307
python -m pydocstyle -v --match-dir=samila
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
- name: Notebook check
run: |
pip install notebook>=5.2.2
python otherfiles/notebook_check.py
if: matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest'
if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04'
- name: Codecov
run: |
codecov
if: matrix.python-version == 3.7 && matrix.os == 'ubuntu-latest'
if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04'
- name: cProfile
run: |
python -m cProfile -s cumtime otherfiles/samila_profile.py
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [1.0] - 2022-12-14
### Added
- `Marker` enum
- `get_data` function
- `get_config` function
### Changed
- `marker` parameter added to `plot` method
- `upload_data` parameter added to `nft_storage` method
- `upload_config` parameter added to `nft_storage` method
- `generate` method optimized
- Test system modified
- `README.md` updated
- `Python 3.11` added to `test.yml`
- `plot` method warning bug fixed
- Random mode modified
### Removed
- `fill_data` function
## [0.9] - 2022-09-28
### Added
- Anaconda workflow
Expand Down Expand Up @@ -136,7 +153,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `generate` method
- `nft_storage` method

[Unreleased]: https://github.com/sepandhaghighi/samila/compare/v0.9...dev
[Unreleased]: https://github.com/sepandhaghighi/samila/compare/v1.0...dev
[1.0]: https://github.com/sepandhaghighi/samila/compare/v0.9...v1.0
[0.9]: https://github.com/sepandhaghighi/samila/compare/v0.8...v0.9
[0.8]: https://github.com/sepandhaghighi/samila/compare/v0.7...v0.8
[0.7]: https://github.com/sepandhaghighi/samila/compare/v0.6...v0.7
Expand Down
46 changes: 29 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* [Mathematical Details](https://github.com/sepandhaghighi/samila#mathematical-details)
* [Try Samila in Your Browser](https://github.com/sepandhaghighi/samila#try-samila-in-your-browser)
* [Issues & Bug Reports](https://github.com/sepandhaghighi/samila#issues--bug-reports)
* [Dependencies](https://github.com/sepandhaghighi/samila#dependencies)
* [Social Media](https://github.com/sepandhaghighi/samila#social-media)
* [Contribution](https://github.com/sepandhaghighi/samila/blob/master/.github/CONTRIBUTING.md)
* [References](https://github.com/sepandhaghighi/samila#references)
Expand All @@ -39,7 +38,7 @@
## Overview

<p align="justify">
Samila is a generative art generator written in Python, Samila let's you create arts based on many thousand points. The position of every single point is calculated by a formula, which has random parameters. Because of the random numbers, every image looks different.
Samila is a generative art generator written in Python, Samila lets you create images based on many thousand points. The position of every single point is calculated by a formula, which has random parameters. Because of the random numbers, every image looks different.
</p>


Expand Down Expand Up @@ -89,15 +88,15 @@ Samila is a generative art generator written in Python, Samila let's you create


### Source code
- Download [Version 0.9](https://github.com/sepandhaghighi/samila/archive/v0.9.zip) or [Latest Source ](https://github.com/sepandhaghighi/samila/archive/dev.zip)
- Download [Version 1.0](https://github.com/sepandhaghighi/samila/archive/v1.0.zip) or [Latest Source](https://github.com/sepandhaghighi/samila/archive/dev.zip)
- Run `pip install -r requirements.txt` or `pip3 install -r requirements.txt` (Need root access)
- Run `python3 setup.py install` or `python setup.py install` (Need root access)

### PyPI


- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install samila==0.9` or `pip3 install samila==0.9` (Need root access)
- Run `pip install samila==1.0` or `pip3 install samila==1.0` (Need root access)

### Easy install

Expand Down Expand Up @@ -156,6 +155,21 @@ Samila is a generative art generator written in Python, Samila let's you create
* Supported projections : `RECTILINEAR`, `POLAR`, `AITOFF`, `HAMMER`, `LAMBERT`, `MOLLWEIDE` and `RANDOM`
* Default projection is `RECTILINEAR`

### Marker
```pycon
>>> from samila import Marker
>>> g = GenerativeImage(f1, f2)
>>> g.generate()
>>> g.plot(marker=Marker.CIRCLE, spot_size=10)
>>> g.seed
448742
>>> plt.show()
```
<img src="https://github.com/sepandhaghighi/samila/raw/master/otherfiles/images/9.png">

* Supported markers : `POINT`, `PIXEL`, `CIRCLE`, `TRIANGLE_DOWN`, `TRIANGLE_UP`, `TRIANGLE_LEFT`, `TRIANGLE_RIGHT`, `TRI_DOWN`, `TRI_UP`, `TRI_LEFT`, `TRI_RIGHT`, `OCTAGON`, `SQUARE`, `PENTAGON`, `PLUS`, `PLUS_FILLED`, `STAR`, `HEXAGON_VERTICAL`, `HEXAGON_HORIZONTAL`, `X`, `X_FILLED`, `DIAMOND`, `DIAMON_THIN`, `VLINE`, `HLINE` and `RANDOM`
* Default marker is `POINT`

### Range
```pycon
>>> g = GenerativeImage(f1, f2)
Expand Down Expand Up @@ -232,6 +246,17 @@ Upload generated image directly to [NFT.storage](https://NFT.storage)
{'status': True, 'message': 'FILE_LINK'}
```

You can also upload your config/data to nft storage as follows:
```pycon
>>> g.nft_storage(api_key="API_KEY", upload_config=True)
{'status': {'image': True, 'config':True}, 'message': {'image':'IMAGE_FILE_LINK', 'config':'CONFIG_FILE_LINK'}
```
or
```pycon
>>> g.nft_storage(api_key="API_KEY", upload_data=True)
{'status': {'image': True, 'data':True}, 'message': {'image':'IMAGE_FILE_LINK', 'data':'DATA_FILE_LINK'}
```

### Save image
Save generated image

Expand Down Expand Up @@ -375,19 +400,6 @@ You can also join our discord server
</a>


## Dependencies

<table>
<tr>
<td align="center">master</td>
<td align="center">dev</td>
</tr>
<tr>
<td align="center"><a href="https://requires.io/github/sepandhaghighi/samila/requirements/?branch=master"><img src="https://requires.io/github/sepandhaghighi/samila/requirements.svg?branch=master" alt="Requirements Status" /></a></td>
<td align="center"><a href="https://requires.io/github/sepandhaghighi/samila/requirements/?branch=dev"><img src="https://requires.io/github/sepandhaghighi/samila/requirements.svg?branch=dev" alt="Requirements Status" /></a></td>
</tr>
</table>

## Social media

1. [Instagram](https://www.instagram.com/samila_arts)
Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
matplotlib==3.5.3
art==5.7
matplotlib==3.6.2
art==5.8
vulture>=1.0
bandit>=1.5.1
pydocstyle>=3.0.0
Expand Down
57 changes: 54 additions & 3 deletions examples/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"import matplotlib.pyplot as plt\n",
"import random\n",
"import math\n",
"from samila import GenerativeImage, Projection"
"from samila import GenerativeImage, Projection, Marker"
]
},
{
Expand Down Expand Up @@ -107,6 +107,32 @@
" plt.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Marker\n",
"We can use the `marker` attribute to change the plotting marker.\n",
"\n",
"The available markers are `POINT`, `PIXEL`, `CIRCLE`, `TRIANGLE_DOWN`, `TRIANGLE_UP`, `TRIANGLE_LEFT`, `TRIANGLE_RIGHT`, `TRI_DOWN`, `TRI_UP`, `TRI_LEFT`, `TRI_RIGHT`, `OCTAGON`, `SQUARE`, `PENTAGON`, `PLUS`, `PLUS_FILLED`, `STAR`, `HEXAGON_VERTICAL`, `HEXAGON_HORIZONTAL`, `X`, `X_FILLED`, `DIAMOND`, `DIAMON_THIN`, `VLINE`, `HLINE` and `RANDOM`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"g2 = GenerativeImage(f1, f2)\n",
"g2.generate()\n",
"\n",
"for m in list(Marker):\n",
" print(m)\n",
" g2.plot(marker=m, spot_size=100)\n",
" plt.show()\n",
" plt.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -363,11 +389,36 @@
"source": [
"g1.nft_storage(api_key=\"YOUR_API_KEY\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also upload your config/data to nft storage as follows:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"g1.nft_storage(api_key=\"YOUR_API_KEY\", upload_config=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"g1.nft_storage(api_key=\"YOUR_API_KEY\", upload_data=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3.8.10 64-bit",
"language": "python",
"name": "python3"
},
Expand All @@ -381,7 +432,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.8.10"
},
"toc": {
"base_numbering": 1,
Expand Down
Binary file added otherfiles/images/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion otherfiles/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "samila" %}
{% set version = "0.9" %}
{% set version = "1.0" %}

package:
name: {{ name|lower }}
Expand Down
2 changes: 1 addition & 1 deletion otherfiles/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import codecs
Failed = 0
SAMILA_VERSION = "0.9"
SAMILA_VERSION = "1.0"


SETUP_ITEMS = [
Expand Down
2 changes: 1 addition & 1 deletion samila/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""Samila modules."""
from .genimage import GenerativeImage
from .params import Projection, VALID_COLORS, SAMILA_VERSION
from .params import Projection, Marker, VALID_COLORS, SAMILA_VERSION
from .errors import samilaDataError, samilaGenerateError
__version__ = SAMILA_VERSION
Loading

0 comments on commit 7e66936

Please sign in to comment.