https://github.com/openpeeps/pkginfo
A tiny utility package to extract Nimble information from any .nimble project
https://github.com/openpeeps/pkginfo
macros nim nim-lang nim-language nimble openpeep
Last synced: about 1 month ago
JSON representation
A tiny utility package to extract Nimble information from any .nimble project
- Host: GitHub
- URL: https://github.com/openpeeps/pkginfo
- Owner: openpeeps
- License: mit
- Created: 2022-06-13T10:38:34.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-10T01:35:55.000Z (about 2 years ago)
- Last Synced: 2025-03-23T18:48:10.327Z (about 2 months ago)
- Topics: macros, nim, nim-lang, nim-language, nimble, openpeep
- Language: Nim
- Homepage: https://openpeeps.github.io/pkginfo/
- Size: 123 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
📦 A tiny utility package to extract Nimble information from any.nimble
project
## 😍 Key Features
- [x] Enable features by a specific dependency 🎉
- [x] Enable Backwards Compatibility support
- [x] Magically `when requires "pkg_name"`
- [x] Extract all package dependencies (`direct` + `indirect`)
- [x] Cache metadata in `pkginfo.json` in Current Working Project
- [x] Meta-programming powered by Nim's Macros 👑
- [x] Open Source | `MIT` License## Installing
```
nimble install pkginfo
```## Examples
Get nimble meta data from current working project
```nim
import pkginfostatic:
echo pkg().getVersion
echo pkg().getDescription
```Use `requires` macro to determine the current package dependencies and change the way application works.
```nim
import pkginfowhen 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
```nim
import pkginfowhen 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`
```nim
when nimVersion() < v "1.6.4":
{.warning: "You are using an older version of Nim".}
```## Roadmap
- [x] Extract deps info
- [x] Semver support via [Semver lib](https://github.com/euantorano/semver.nim)
- [ ] Extend support for [Nimble variables](https://github.com/nim-lang/nimble#package)
- [x] Handle indirect deps
- [x] Cache dependency metadata in a `pkginfo.json`
- [x] Add unit tests
- [ ] Test with bigger projects
- [x] Extract pkg info with `nimble dump --json`
- [ ] Handle local packages (linked with `nimble-link`)### ❤ Contributions
Contribute with code, ideas, bugfixing or you can even [donate via PayPal address](https://www.paypal.com/donate/?hosted_button_id=RJK3ZTDWPL55C) 🥰### 👑 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](https://nim-lang.org/)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](https://github.com/openpeep).
Copyright © 2022 OpenPeep & Contributors — All rights reserved.