A proof-of-concept package manager for Cairo contracts/libraries

Overview

glyph

A proof-of-concept package manager for Cairo contracts/libraries. Distribution through pypi. Installation through existing package managers -- pip, pipenv, poetry.

Intended to be a lightweight layer on top of existing python package management. Sole responsibility is collecting contracts/libraries registered to the contracts namespace package, and copying their contents to a new contracts/lib folder.

NOTE: solely experimental to play around one potential strategy, doubtful that this would be a real package management solution for the ecosystem

Usage

Install with pip install cairo-glyph. Additionally, pip install cairo-nile and nile init to intialize a starter project.

Check out the help command (auto-gen from code, will always be more up to date than this README):

(venv) [email protected]:~/dev/eth/tmp$ glyph --help
Usage: glyph [OPTIONS] COMMAND [ARGS]...

  A proof-of-concept package manager for Cairo.

Options:
  --install-completion  Install completion for the current shell.
  --show-completion     Show completion for the current shell, to copy it or
                        customize the installation.
  --help                Show this message and exit.

Commands:
  clean  Remove everything in the lib directory
  use    Install one or all added cairo packages in the project

Use all libraries installed to the venv:

(venv) [email protected]:~/dev/eth/tmp$ glyph use --all
πŸ”Ž Discovering installed contracts...

βœ… Done.

For now, nothing is installed. To change that, do a pip install cairo-placeholder

Then do it again:

(venv) $ glyph use --all
πŸ”Ž Discovering installed contracts...

 β€’ Using contracts.placeholder

βœ… Done.

If we inspect our project directory we now see it's installed in a contracts/lib folder:

β”œβ”€β”€ accounts.json
β”œβ”€β”€ contracts
β”‚   β”œβ”€β”€ contract.cairo
β”‚   └── libs
β”‚       └── placeholder
β”‚           └── contract.cairo
β”œβ”€β”€ Makefile
β”œβ”€β”€ tests
β”‚   └── test_contract.p

πŸ₯³

Your Own Library Setup

In order to allow your contracts to be installed, a few conventions must be followed.

contracts                # The "namespace package" that the contracts are installed to
└── placeholder          # The library you are distributing
    β”œβ”€β”€ contract.cairo
    └── __init__.py      # Required to be installable.
setup.py                 # The installer

The actual setup.py will look something like this:

from setuptools import setup


setup(
    name="placeholder",

    version="1",
    description="",
    long_description="",

    author="Jane Doe",
    author_email="[email protected]",

    license="MIT License",

    packages=["contracts.placeholder"],
    # Include all extra package data. Possible to include *.cairo only
    package_data={"": ["*"]},
    zip_safe=False,
)

If using poetry, have pyproject.toml like:

"] license = "MIT License" readme = "README.md" packages = [ { include = "contracts/*" }, ] [tool.poetry.dependencies] python = "^3.7" cairo-nile = "^0.3.0" [tool.poetry.dev-dependencies] [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"">
[tool.poetry]
name = "cairo-placeholder"
version = "0.0.2"
description = "Example project for cairo-glyph"
authors = ["Your Name 
   
    "]
license = "MIT License"
readme = "README.md"
packages = [
    { include = "contracts/*" },
]

[tool.poetry.dependencies]
python = "^3.7"
cairo-nile = "^0.3.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

   

Once distributed on pypi, one could:

(venv) $ pip install cairo-glyph cairo-placeholder
...
(venv) $ glyph use placeholder
πŸ”Ž Discovering installed contracts...

 β€’ Using contracts.placeholder

βœ… Done.

Adding the following to your project:

contracts/
└── libs
    └── placeholder
        └── contract.cairo
Owner
Sam Barnes
Sam Barnes
GA SEI Unit 4 project backend for Bloom.

Grow Your OpportunitiesTM Background Watch the Bloom Intro Video At Bloom, we believe every job seeker deserves an opportunity to find meaningful work

Jonathan Herman 3 Sep 20, 2021
Projects using the Tkinter module in Python!

Tkinter projects This repository includes some Tkinter projects made by me. All of these are simple to understand. I create apps with good functionali

Amey 0 Sep 24, 2021
Auto Join Zoom Meeting

Auto-Join-Zoom-Meeting Join a zoom meeting with out filling in meeting id's or passcodes, one button for it all! Setup See attached excel document. MA

JareBear 1 Jan 25, 2022
Assignment for python course, BUPT 2021.

pyFuujinrokuDestiny Assignment for python course, BUPT 2021. Notice username and password must be ASCII encoding. If username exists in database, syst

Ellias Kiri Stuart 3 Jun 18, 2021
Nesse repositΓ³rio serΓ£o armazenados os conteΓΊdos de aula

Lets_Code_DS_Degree_Alunos Nesse repositΓ³rio serΓ£o armazenados os conteΓΊdos de aula Formato das aulas: Notebook de aula jΓ‘ vem comentado para reduzir

Patricia Bongiovanni Catandi 6 Jan 21, 2022
Animation retargeting tool for Autodesk Maya. Retargets mocap to a custom rig with a few clicks.

Animation Retargeting Tool for Maya A tool for transferring animation data between rigs or transfer raw mocap from a skeleton to a custom rig. (The sc

Joaen 62 Dec 19, 2022
A set of tools for ripping music from Konami mobile games

Konami Mobile Ripping Toolset A set of tools for ripping music from Konami mobile games Contents nigger.py for niggering konami's website, ripping all

5 Oct 20, 2022
IPO Checker for NEPSE

IPO Checker Checks more than one account for an IPO. Usage: ipo_checker.py [-h] --file FILE IPO Checker for a list. optional arguments: -h, --help

Sagar Tamang 4 Sep 20, 2022
A simple and convenient build-and-run system for C and C++.

smake Smake is a simple and convenient build-and-run system for C and C++ projects. Why make another build system? CMake and GNU Make are great build

Venkataram Edavamadathil Sivaram 18 Nov 13, 2022
Awesome Casino is simple offline casino made on python.

Awesome-Casino Awesome Casino is simple offline casino made on python. I found bug, what can i do? If you find any bug or want to suggest any idea, al

Herman 1 Feb 04, 2022
Just RESTing

petnica-api-workshop Just RESTing Setup Using pipenv You can setup this project with pipenv if you want isolated libraries. After you've installed pip

Aleksa Teőić 1 Oct 23, 2021
Freeze your objects in python

gelidum Freeze your objects in python. Latin English Caelum est hieme frigidum et gelidum; myrtos oleas quaeque alia assiduo tepore laetantur, asperna

Diego J. 51 Dec 22, 2022
A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python

A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python

Windel Bouwman 277 Dec 26, 2022
Liquid Rocket Engine Cooling Simulation

Liquid Rocket Engine Cooling Simulation NASA CEA The implemented class calls NASA CEA via RocketCEA. INSTALL GUIDE In progress install instructions fo

John Salib 1 Jan 30, 2022
Run Windows Applications on Linux as if they are native, Use linux applications to launch files files located in windows vm without needing to install applications on vm. With easy to use configuration GUI

Run Windows Applications on Linux as if they are native, Use linux applications to launch files files located in windows vm without needing to install applications on vm. With easy to use configurati

Casu Al Snek 2k Jan 02, 2023
Supercharge your NFTs with new behaviours and superpowers!

WrapX Supercharge your NFTs with new behaviours and superpowers! WrapX is a collection of Wrappers (currently one - WrapXSet) to decorate your NTFs ad

Emiliano Bonassi 9 Jun 13, 2022
Wordle-solve - Attempting to solve wordle

Wordle Solver Run with python wordle_beater.py. This hardmode wordle solver take

Tom Lockwood 42 Oct 11, 2022
This is a Python program I wrote to simulate the solar system with 79 lines of code.

Solar System With Python This is a Python program I wrote to simulate the solar system with 79 lines of code. Required modules tkinter, math, time Why

Mehmet Aydoğmuş 1 Oct 26, 2021
Modern robots.txt Parser for Python

Robots Exclusion Protocol Parser for Python Robots.txt parsing in Python. Goals Fetching -- helper utilities for fetching and parsing robots.txts, inc

Moz 176 Dec 16, 2022
Simple AoC helper program you can use to develop your own solutions in python.

AoC-Compabion Simple AoC helper program you can use to develop your own solutions in python. Simply install it in your python environment using pip fr

Alexander Vollmer 1 Dec 20, 2021