hychan48 / google-foobar-2023-q4

Google Foobar Journey
https://codeforwings.com
GNU Affero General Public License v3.0
1 stars 0 forks source link
google-foobar-solutions

@hychan48/google-foobar-2023-q4

Production

Replit - Try Me

Pip / Pipx

Installation

# https://replit.com/@jasonchan51/hychan48-google-foobar-2023-q4
pipx install hychan48-google-foobar-2023-q4

hychan48-cake-is-not-a-lie --help
hychan48-cake-is-not-a-lie abab
hychan48-dont-get-volunteered 0 1

Level 1

GitHub action runs the PyTests:

pytest levels/q1/tests/solutions_test.py

[![asciicast](https://asciinema.org/a/645735.svg)](https://asciinema.org/a/645735)
[![asciicast](https://asciinema.org/a/645736.svg)](https://asciinema.org/a/645736)

### JavaScript Solution
```bash
# JavaScript solution - only for q1
pnpm run test:q1

asciicast

level 2

Question 1

Background

Assumptions

Quick Checklist

Quick Dev Setup

Non-Dev Container

# install micromamba (aliased as conda) / miniforge3
conda env create -f environment.yml
conda deactivate
conda activate hychan48-google-foobar
# Using micromamba aliased as conda
poetry install

BATS-core

# add this to path:
command -v bats # Check if bats

mkdir -p $HOME/.local/bin
export PATH=$PATH:$HOME/.local/bin
ln -s $PWD/test/bats/bin/bats $HOME/.local/bin/bats # check
which -a bats # check again
whence bats
ls -l $HOME/.local/bin/bats
tree $HOME/.local/bin
pipx ensurepath # will add $HOME/.local/bin to path

Dev Container

# smoke test
pytest levels/q1/tests/solutions_test.py # cake is not a lie
poetry --quiet run hychan48-cake-is-not-a-lie abab
# output: 2

PyTest in Poetry

Backup Conda Environment

# Backup
conda env export --from-history > environment.yml
conda env export > environment.full.yml

# window caveats...
# https://stackoverflow.com/questions/49638329/how-to-create-conda-env-with-both-name-and-path-specified

GitHub Actions Workflows

  1. [ ] Build Wheel
    • [ ] Add PyTest after adding new features
  2. [ ] Publish to PyPi

Requirements.txt

# Manually updated for now. Add to CI/CD later
poetry export -f requirements.txt --output requirements.txt