Skip to content
generated from openpeeps/pistachio

A tiny utility package to extract Nimble information from any .nimble project

License

Notifications You must be signed in to change notification settings

openpeeps/pkginfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


📦 A tiny utility package to extract Nimble information from any .nimble project

😍 Key Features

  • Enable features by a specific dependency 🎉
  • Enable Backwards Compatibility support
  • Magically when requires "pkg_name"
  • Extract all package dependencies (direct + indirect)
  • Cache metadata in pkginfo.json in Current Working Project
  • Meta-programming powered by Nim's Macros 👑
  • Open Source | MIT License

Installing

nimble install pkginfo

Examples

Get nimble meta data from current working project

import pkginfo

static:
    echo pkg().getVersion
    echo pkg().getDescription

Use requires macro to determine the current package dependencies and change the way application works.

import pkginfo

when requires "toktok":
    # here you can import additional libraries or modules
    # execute blocks of code or whatever you need

Extract the version of a package from .nimble project for backwards compatibility support

import pkginfo

when requires "toktok":
    when pkg("toktok").getVersion <= v("0.1.1"):
        # backwards compatibility support
    else:
        # code for newer versions

Checking for the current Nim version from main .nimble

when nimVersion() < v "1.6.4":
    {.warning: "You are using an older version of Nim".}

Roadmap

  • Extract deps info
  • Semver support via Semver lib
  • Extend support for Nimble variables
  • Handle indirect deps
  • Cache dependency metadata in a pkginfo.json
  • Add unit tests
  • Test with bigger projects
  • Extract pkg info with nimble dump <pkg> --json
  • Handle local packages (linked with nimble-link)

❤ Contributions

Contribute with code, ideas, bugfixing or you can even donate via PayPal address 🥰

👑 Discover Nim language

What's Nim? Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Find out more about Nim language

Why Nim? Performance, fast compilation and C-like freedom. We want to keep code clean, readable, concise, and close to our intention. Also a very good language to learn in 2022.

🎩 License

Pkginfo is an Open Source Software released under MIT license. Made by Humans from OpenPeep.
Copyright © 2022 OpenPeep & Contributors — All rights reserved.