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
Data-driven Computer Science UoB

COMS20011_2021 Data-driven Computer Science UoB Staff Laurence Aitchison [ 6 May 16, 2022

Find habits that genuinely increase your productivity

BiProductive Description This repository contains the application BiProductive, which analyzes the habits of the person, tests his productivity, and d

Rizvan Iskaliev 43 Jun 11, 2022
Backtest framework based on DAGs

MultitaskQueue It's a simple framework based on three composed concepts: Task: A task is the smaller unit of execution or simple a node in the DAG, ev

4 Dec 09, 2021
Python 100daysofcode

#python #100daysofcode Python is a simple, general purpose ,high level & object-oriented programming language even it's is interpreted scripting langu

Tara 1 Feb 10, 2022
How to access and display MyEnergi data

MyEnergi-Python-Example How to access and display MyEnergi data Windows PC Install a version of Python typically 3.10 The Python code here needs addit

G6EJD 8 Nov 28, 2022
a simple functional programming language compiler written in python

Functional Programming Language A compiler for my small functional language. Written in python with SLY lexer/parser generator library. Requirements p

Ashkan Laei 3 Nov 05, 2021
This is a practice on Airflow, which is building virtual env, installing Airflow and constructing data pipeline (DAGs)

airflow-test This is a practice on Airflow, which is Builing virtualbox env and setting Airflow on that env Installing Airflow using python virtual en

Jaeyoung 1 Nov 01, 2021
An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration.

Nectl An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration. Features Data modelling and validation. Da

Adam Kirchberger 15 Oct 14, 2022
Automator anble you to create automations on your system

WELCOME TO AUTOMATOR BETA This programm is able to create automations on your system. This programm is only an experimantal release; infact it works v

Davide 1 Jan 12, 2022
:art: Diagram as Code for prototyping cloud system architectures

Diagrams Diagram as Code. Diagrams lets you draw the cloud system architecture in Python code. It was born for prototyping a new system architecture d

MinJae Kwon 27.5k Jan 04, 2023
Vita Specific Patches and Application for Doki Doki Literature Club (Steam Version) using Ren'Py PSVita

Doki-Doki-Literature-Club-Vita Vita Specific Patches and Application for Doki Doki Literature Club (Steam Version) using Ren'Py PSVita Contains: Modif

Jaylon Gowie 25 Dec 30, 2022
Prototype application for GCM bias-correction and downscaling

dodola Prototype application for GCM bias-correction and downscaling This is an unstable prototype. This is under heavy development. Features Nothing!

Climate Impact Lab 9 Dec 27, 2022
ไบฌไธœ็ƒญ็ˆฑ็‹‚ๆฌข่ถด&ไบฌไธœๆ‰ซ็ ่Žทๅ–cookie

ไบฌไธœ็ƒญ็ˆฑ็‹‚ๆฌข่ถด ไธ€้”ฎๅฎŒๆˆไปปๅŠก่„šๆœฌๆฅ่ขญ ๆดปๅŠจๅœฐๅ€๏ผš https://wbbny.m.jd.com/babelDiy/Zeus/2s7hhSTbhMgxpGoa9JDnbDzJTaBB/index.html#/home 2021-06-02ๆ›ดๆ–ฐ๏ผš 1ใ€ๅˆ ้™คไบฌไธœๆ˜ŸๆŽจๅฎ˜ 2ใ€ๆ›ดๆ–ฐ่„šๆœฌ๏ผŒไฟฎๅค็ซ็ˆ†้—ฎ้ข˜ 2021

xoyi 48 Dec 28, 2022
This repository contains Python Projects for Beginners as well as for Intermediate Developers built by Contributors.

Python Projects {Open Source} Introduction The repository was built with a tree-like structure in mind, it contains collections of Python Projects. Mo

Gaurav Pandey 115 Apr 30, 2022
Better firefox bookmarks script for rofi

rofi-bookmarks Small python script to open firefox bookmarks with rofi. Features Icons! Only show bookmarks in a specified bookmark folder Show entire

32 Nov 10, 2022
๐ŸŒŒA Python library to exhaustively enumerate a combinatorial space represented by a function

exhaust A Python library to exhaustively enumerate a combinatorial space represented by a function. The API is modelled after Python's random module a

Maik Riechert 1 Dec 05, 2021
In this project , I play with the YouTube data API and extract trending videos in Nigeria on a particular day

YouTubeTrendingVideosAnalysis In this project , I played with the YouTube data API and extracted trending videos in Nigeria on a particular day. This

1 Jan 11, 2022
Python library and cli util for https://www.zerochan.net/

Zerochan Library for Zerochan.net with pics parsing and downloader included! Features CLI utility for pics downloading from zerochan.net Library for c

kiriharu 10 Oct 11, 2022
Paxos in Python, tested with Jepsen

Python implementation of Multi-Paxos with a stable leader and reconfiguration, roughly following "Paxos Made Moderately Complex". Run python3 paxos/st

A. Jesse Jiryu Davis 25 Dec 15, 2022
The code for 2021 MGTV AI Challenge Anti Stealing Link, and the online result ranks 10th.

่ต›้ข˜ไป‹็ป ่Š’ๆžœTV-็ฌฌไบŒๅฑŠโ€œ้ฉฌๆ ๅฑฑๆฏโ€ๅ›ฝ้™…้Ÿณ่ง†้ข‘็ฎ—ๆณ•ๅคง่ต›-้˜ฒ็›—้“พ ้š็€ไธšๅŠก็š„ๅ‘ๅฑ•๏ผŒ่Š’ๆžœ็š„่ง†้ข‘ๅ†…ๅฎนไนŸๆทฑๅ—็ฝ‘ๅ‹็š„ๅ–œๆฌข๏ผŒไธๅฐ‘่ง†้ข‘็ฝ‘็ซ™ๅ’Œๅบ”็”จๅผ€ๅง‹็›—ๆ’ญ่Š’ๆžœ็š„่ง†้ข‘ๅ†…ๅฎน๏ผŒ็›—้“พ็ฝ‘็ซ™ไธ็ป่ฟ‡่Š’ๆžœTV็š„ๅ‰็ซฏ็ณป็ปŸ๏ผŒ่ทณ่ฟ‡ๅนฟๅ‘Šๆ’ญๆ”พ๏ผŒไธ”ๆถˆ่€—ๅคง้‡็š„ๆœๅŠกๅ™จใ€ๅธฆๅฎฝ่ต„ๆบ๏ผŒ็›ดๆŽฅ็ป™ๅ…ฌๅธๅธฆๆฅไบ†ๅทจๅคง็š„็ปๆตŽๆŸๅคฑ๏ผŒๅ› ๆญค้˜ฒ็›—้“พๅœจๆ—ฅๅธธ่ฟ่ฅไธญๆ˜พๅพ—ๅฐคไธบ้‡่ฆ

tongji40 16 Jun 17, 2022