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

Seperating primitives and chain contexts / higher level tooling #305

Open
nielstron opened this issue Feb 7, 2024 · 2 comments
Open

Seperating primitives and chain contexts / higher level tooling #305

nielstron opened this issue Feb 7, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@nielstron
Copy link
Contributor

nielstron commented Feb 7, 2024

Is your feature request related to a problem? Please describe.
The pycardano library (the primitives definitions) is used by third party tools and respectively the high level tooling could benefit from using third party libraries (like ogmios). This may lead to cyclic dependencies

Describe the solution you'd like
Seperate the pycardano package into several packages

  • pycardano_primitives: All the building blocks defined by pycardano, transactions, Assets, PlutusData etc
  • pycardano_chain_contexts: The chain contexts shipped with pycardano, potentially even split further (ideally we want the abstract base class independently to allow third parties to implement it
  • pycardano_cips: The implementations of CIP proposals in pycardano

This can actually be performed transparently to users of the library by keeping pycardano as a single library that imports from all of the above (and potentially more)

Describe alternatives you've considered
The exact structure can be discussed.

Additional context
This allows the ogmios package to import the primitives from pycardano and transform Ogmios JSON serialized transactions into pycardano primitive Transactions. Meanwhile it can also implement the Ogmios 6 chain context that can be imported by pycardano.

Another example is uplc/opshin which can import pycardano primitives and implement a MockChainContext which does tx evaluation based on simulation of the Plutus VM.

@nielstron nielstron added the enhancement New feature or request label Feb 7, 2024
@cffls
Copy link
Collaborator

cffls commented Feb 11, 2024

Thank you for bringing this up! I like this idea a lot. It will remove lots of dependency madness across many packages. Regarding package naming, I think we can come up with shorter names, something like:

pycardano_primitives -> pccore
pycardano_chain_contexts -> pccontext
pycardano_cips -> pccips

wdyt?

@KINGH242
Copy link
Contributor

I created the pycardano_chain_contexts package and added some improvements. Check it out here https://github.com/KINGH242/pccontext.

Let me know if it makes sense. I currently use it with PyCardano in another tool that uses various context from time to time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

3 participants