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

Add basic project scaffolding functionality via CLI #78

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

wenkanglu
Copy link

@wenkanglu wenkanglu commented Mar 3, 2023

Summary

Just a simple WIP of scaffolding a new Tealish project with a template smart contract, test, and basic utility functions. This is achieved through a new CLI command called start (not entirely sold on the name but it's a start 😉).

As part of the scaffold, there is a tealish.json file at the root level that contains configs. For now there is only a config for the name (and location) of the build directory that the _build() function builds to. If the config does not exist, the standard name and location is used (build directory at the location of the Tealish file).

Example Usage

  1. At the directory where you want to create a new Tealish project named my_tealish_project, run tealish start my_tealish_project --template=algosdk.
  2. cd into the project root directory.
  3. Install dependencies (optionally set up a virtual environment).
  4. Compile the template contracts via tealish compile contracts
  5. run the example test via python3 -m unittest (assumes algod, kmd, and indexer are running on default Sandbox ports)

Thoughts

  • Not entirely sure if scaffolding should be part of the Tealish CLI but it can be very helpful for devs to get started quick.
  • The actual template files should probably be in a different repo and pulled in when using start.
  • Not sold on using JSON for the config file but having some sort of way to configure Tealish would be beneficial.
  • I'm thinking that the layout of a project created from start should be enforced, e.g., build, contracts, tests directories, and config file all at root level. This makes it easier to reason about the location of certain files when creating new CLI features. However, the names of each directory should be configurable via the config file (like with the build directory).
  • It would be cool to create an Algojig template when Algojig is more accessible.
  • Used requirements.txt in the scaffold for the sake of simplicity but we can of course choose to support pyproject.toml instead.
  • Should there be templates for different testing frameworks too (unittest, pytest, etc.)?

@fergalwalsh
Copy link
Collaborator

This looks really interesting! I haven't gone through in detail yet but really like the general idea. Thank you :)

Passing a directory to _build() now builds all Tealish files in the tree.
The structure of the build output retains the same tree shape as the build target.
Build can now also be called from any directory within the project.
@AecioGSS
Copy link

AecioGSS commented Oct 7, 2024

Thoughtful suggestions! Generally good and can be implemented to ease our understanding of how to meet/achieve goals!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants