Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top Level Walruses #10

Open
wants to merge 101 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
98ee662
Initial commit
lemonyte Aug 28, 2023
7a866d8
Update LICENSE
lemonyte Aug 31, 2023
5511843
Update .gitignore
lemonyte Aug 31, 2023
318ee1f
Update lint workflow
lemonyte Aug 31, 2023
30fb612
Update dev requirements
lemonyte Aug 31, 2023
8c289a5
Autoupdate pre-commit hooks
lemonyte Aug 31, 2023
fdae926
Add black pre-commit hook
lemonyte Aug 31, 2023
296cfd9
Add black configuration
lemonyte Aug 31, 2023
c4b54fa
Move isort config to pyproject.toml
lemonyte Aug 31, 2023
6966d1c
Move flake8 config to .flake8
lemonyte Aug 31, 2023
3b76f3c
Replace isort and flake8 with ruff and pyright
lemonyte Aug 31, 2023
6514efe
Remove samples
lemonyte Aug 31, 2023
e5e3462
Update ruff config
lemonyte Aug 31, 2023
6d5fd92
Add entrypoint file
lemonyte Aug 31, 2023
2f76426
Add requirements.txt
lemonyte Aug 31, 2023
ddae863
Fix yaml formatting in precommit config
lemonyte Aug 31, 2023
b114afd
Add ruff cache to gitignore
lemonyte Aug 31, 2023
94d02d0
Rename dev-requirements.txt to requirements-dev.txt
lemonyte Aug 31, 2023
ff6cfbb
Update readme
lemonyte Aug 31, 2023
d854c88
Add text to image encoding and decoding
lemonyte Sep 1, 2023
f8038b5
Refactor encoding and decoding to remove loops
lemonyte Sep 3, 2023
9477add
Add piet.py
lemonyte Sep 5, 2023
de95c94
create basic interpreter API
kevinshome Sep 5, 2023
e9b86fb
Autoupdate pre-commit hooks
lemonyte Sep 6, 2023
cb5025e
Bump pre-commit version
lemonyte Sep 6, 2023
420364a
Add Pillow and numpy to requirements
lemonyte Sep 6, 2023
fd98d96
Install dependencies before lint
lemonyte Sep 6, 2023
fdf8d28
Merge branch 'main' into piet
lemonyte Sep 6, 2023
52db832
Attempt to fix broken pyright hook
lemonyte Sep 6, 2023
32e14d6
Merge branch 'main' into piet
lemonyte Sep 6, 2023
d9b9c5b
create basic interpreter API
kevinshome Sep 5, 2023
2d2cee1
formatting
kevinshome Sep 6, 2023
3f2ea67
add test cases for pinterpret
kevinshome Sep 6, 2023
38d62e8
add pytest~=7.4.1 to dev requirements
kevinshome Sep 6, 2023
67d3b24
Logic for interpreting an image into blocks and codels, and images us…
dayshaunlee Sep 6, 2023
89b0b67
remove pytest pre-commit hook
kevinshome Sep 6, 2023
47bf589
merge piet-interpreter into image-reader
kevinshome Sep 6, 2023
d43c8f4
reconcile local with origin
kevinshome Sep 6, 2023
bc493f6
Merge branch 'piet-interpreter' into image-reader
kevinshome Sep 6, 2023
a3f6e0b
fix linting fails
kevinshome Sep 6, 2023
f98bc1d
piet interpreter almost finished
kevinshome Sep 6, 2023
a956967
Optimize image reader
lemonyte Sep 9, 2023
e8330e9
Refactor, optimize interpreter
lemonyte Sep 9, 2023
5e41674
Clean up PietStack and PietRuntime implementation
lemonyte Sep 9, 2023
87110a5
Implement missing interpreter behavior
lemonyte Sep 9, 2023
e4630df
Rename c -> color
lemonyte Sep 9, 2023
70dafba
Update tests
lemonyte Sep 9, 2023
452fdf6
Complete image generator code
lemonyte Sep 9, 2023
a120b35
fix linting fails
lemonyte Sep 9, 2023
9a45a15
Merge branch 'piet-interpreter' into piet
lemonyte Sep 9, 2023
c1af0cf
Clean up
lemonyte Sep 9, 2023
2e43098
Move some files around
lemonyte Sep 9, 2023
3cfb2d2
Consolidate Piet code and clean up
lemonyte Sep 9, 2023
7752f7b
Handle out of bounds indices
lemonyte Sep 9, 2023
13bc83c
Fix pointer moving out of bounds on edge
lemonyte Sep 9, 2023
ec5bb25
Improve pointer moving logic to enable relative offsets
lemonyte Sep 9, 2023
b20c1e6
Optimize interpreter by skipping consecutive no-op codels
lemonyte Sep 9, 2023
0b43821
Replace codel size attribute with length
lemonyte Sep 9, 2023
51025d6
Remove unnecessary DIRECTIONS constant
lemonyte Sep 9, 2023
d3f757a
Rename Reader -> ImageReader
lemonyte Sep 9, 2023
9d52182
Start iteration at 0 instead of -1
lemonyte Sep 9, 2023
82b24a1
Remove main function from piet module
lemonyte Sep 9, 2023
0b57e54
Split the piet module into smaller modules
lemonyte Sep 9, 2023
93a93e2
Add image generator test
lemonyte Sep 9, 2023
bc9c7d5
Change runtime input and output buffers to TextIO
lemonyte Sep 9, 2023
1aa8d53
Simplify PietStack
lemonyte Sep 9, 2023
4b6cd89
Fix broken PietRuntime methods
lemonyte Sep 9, 2023
30f4200
Fix runtime tests
lemonyte Sep 9, 2023
6ac502b
Remove numpy from requirements
lemonyte Sep 9, 2023
b3cd207
Remove old files
lemonyte Sep 9, 2023
34230e0
Rename PietProgramGenerator -> ImageGenerator
lemonyte Sep 9, 2023
140c454
Rename piet_runtime ->runtime
lemonyte Sep 9, 2023
77b5392
Update test_generator
lemonyte Sep 9, 2023
d43782f
Change internal buffers from StringIO to BytesIO
lemonyte Sep 10, 2023
75c4932
Fix reader
lemonyte Sep 10, 2023
0e06f4f
Add InvalidColorError
lemonyte Sep 10, 2023
a69b708
Add py.typed marker
lemonyte Sep 10, 2023
6a21670
Add cli
lemonyte Sep 10, 2023
a1a4d07
Simplify constructors and remove duplicate code
lemonyte Sep 10, 2023
b1b42a8
Add key shift to generator
lemonyte Sep 10, 2023
11e9038
Remove unnecessary type hint
lemonyte Sep 10, 2023
c03ecda
Update cli, add shifting with key
lemonyte Sep 10, 2023
7986fb0
Adjust default column count
lemonyte Sep 10, 2023
a307b1b
Add generator key test
lemonyte Sep 10, 2023
7e4a636
Flush stdout on output
lemonyte Sep 10, 2023
46541f8
Add some log prints to the cli
lemonyte Sep 10, 2023
44733db
Automatically determine optimal column count
lemonyte Sep 10, 2023
8637898
Fix key length when executing image
lemonyte Sep 10, 2023
58273dc
Add 42.png
lemonyte Sep 10, 2023
5df227f
Add execute flag to cli
lemonyte Sep 10, 2023
434d705
Add recursive generator
lemonyte Sep 10, 2023
65fc3f7
Remove output flush
lemonyte Sep 10, 2023
6946e9e
Fix generator test
lemonyte Sep 10, 2023
2f9658a
Add typer and rich to requirements
lemonyte Sep 10, 2023
75cfd35
Move piet and tests packages out of src
lemonyte Sep 10, 2023
ad64fd0
Add preliminary readme presentation
lemonyte Sep 10, 2023
b0d25c9
Add demo images
lemonyte Sep 11, 2023
a18fec5
Add detailed README presentation
lemonyte Sep 11, 2023
c32e36e
Add technical details to readme
lemonyte Sep 14, 2023
5c9b4c2
Add walrus.png
lemonyte Sep 14, 2023
3b7cd46
Add 'top-level-walruses/' from commit '5c9b4c224c3464853b6488ff4fe059…
janine9vn Sep 28, 2023
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
31 changes: 31 additions & 0 deletions top-level-walruses/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint

on:
push:
pull_request:

concurrency: lint-${{ github.sha }}

jobs:
lint:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.11"
steps:
- name: Check out repository.
uses: actions/checkout@v3

- name: Set up Python ${{ env.PYTHON_VERSION }}.
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install dependencies.
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Run pre-commit hooks.
uses: pre-commit/[email protected]
172 changes: 172 additions & 0 deletions top-level-walruses/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# IDEs
# PyCharm
.idea/
# VSCode
.vscode/

# MacOS
.DS_Store

# Ruff
.ruff_cache/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/
35 changes: 35 additions & 0 deletions top-level-walruses/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.325
hooks:
- id: pyright

# TODO: figure out a way to get this working on github CI :(
# - repo: local
# hooks:
# - id: pytest-check
# name: pytest-check
# entry: pytest
# language: system
# pass_filenames: false
# always_run: true
7 changes: 7 additions & 0 deletions top-level-walruses/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 The Top-level Walruses

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading