Can anyone provide me a link to an example of using named properties in dbx. The documentation mentions an example of a .json file,
https://dbx.readthedocs.io/en/latest/named_properties.html
but it does not mention how we can invoke this file with sample variables. Do I need to write python code to have a file containing these variables?
I have two enviornments and I want to pass on different variables to the deployment.json file.
author of dbx here.
With latest 0.7.0 update we fully support passing both environment variables and variables from file.
Please check:
https://dbx.readthedocs.io/en/latest/features/jinja_support/
for details
The most recent way to passing var is by using the --jinja-variables-file since dbx 0.6.6.
And do not use the env vars, it's not jinja standard.
Related
Is there some way I can read the version variable from my project's .nimble file? Some languages include built in functions that will give you this value, does Nim have one of these functions?
The .nimble file can be parsed with parsecfg. This parsing can be as complex as shown in the documentation with a while loop and considering all possible cases, or you can trust that the .nimble file follows the standard and includes a line like:
version = 0.1.2
In this case you can just search for that case like this:
import parsecfg
var p: Config = loadConfig("./yourPackageName.nimble")
echo p.getSectionValue("", "version")
The empty string passed to getSectionValue points to the root of the config file, and then you extract the version value from there.
I'm trying out Freeling's API for python. The installation and test were ok, they provide a sample.py file that works perfectly (I've played around a little bit with it and it works).
So I was trying to use it on some other python code I have, in a different folder (I'm kind of guessing this is a path issue), but whenever I import freeling (like it shows on the sample.py):
import freeling
FREELINGDIR = "/usr/local";
DATA = FREELINGDIR+"/share/freeling/";
LANG="es";
freeling.util_init_locale("default");
I get this error:
ModuleNotFoundError: No module named 'freeling'.
The sample.py is located on the ~/Freeling-4.0/APIs/Python/ folder, while my other file is located in ~/project/, I dont know if that can be an issue.
Thank you!
A simple solution is to have a copy of freeling.py in the same directory as your code, since python will look there.
A better solution is to either paste it in one of the locations where it usually checks (like the lib folder in its install directory), or to tell it that the path where your file is should be scanned for a module.
You can check out this question to see how it can be done on Windows. You are basically just setting the PYTHONPATH environment variable, and there will only be minor differences in how to do so for other OSes. This page gives instructions that should work on Linux systems.
I like this answer since it adds the path at runtime in the script itself, doesn't make persistent changes, and is largely independent of the underlying OS (apart from the fact that you need to use the appropriate module path of course).
You need to set PYTHONPATH so python can find the modules if they are not in the same folder.
recently i've been asked to implement config files for my system, config for each environment.
When i wanted to use the config i noticed that i dont have it typed, at least not in easy way..
So i created an index file which import and export the config adding an interface to it.
I wonder if i can add a type to my config (somehow) which will force the developers to stick to it and also provide us a type at compilation time.
Its like to have a config.ts file instead of config.json (maybe that what i should do?)
Thanks!
Yes you can - use json schema for this purpose.
To ensure your develpers have not messed up the data - use one of many available validators (i find this one to work pretty nice) to verify json object you read from config file.
Some IDE (vscode for example) support json schemas and can validate it on the fly.
You can have your config stored in *.ts file as exported const variable. Then after requiring it verify it with validator. Unfortunately this approach will not give you errors at compilation type.
I'm just getting started with Component package manager. I understand that I can require in other local modules by adding the module to the local key in the component.json file, but what if I don't want to treat every file as a module?
In the (very minimal) documentation for Component, it's developer TJ says that I can add any other relevant scripts (that live in the same directory) to the scripts array. And yet, on doing so, I'm unable to require or reference any of the peripheral scripts' methods from my main file.
The require method fails on trying to load in the script, and any attempt to reference the methods or variables from that script from the 'bootstrap' file are futile. My build.js shows that the script has been compiled in, but I just can't seem to figure out the correct way to reference it from other scripts...
Help?
I just thought I'd post the answer to this question so anybody with the same problem can find it quickly/painlessly.
The answer is to reference the script with a pointer to it's current directory like so:
var script = require('./script.js');
Note the ./ at the beginning of the file name.
An easy mistake to make/rectify.
I can successfully generated Puppet documentation for my modules' classes (using puppet-doc) but I would also like to include a module-level documentation (similar to http://docs.puppetlabs.com/puppet/3/reference/modules_documentation.html.) I tried to put a README.md, README.markdown, [modulename].md or [modulename].markdown at the module top-level but without success.
What is the line I missed to read on the documentation?
Documentation at PuppetLabs suggests that README is respected, not README.md or .markdown.
Seeing as puppet doc is basically rdoc, it doesn't support typical markdown and instead expects an rdoc format, or just plain text.