How to change published package tags?

2020-01-18 Thread sflennik
How do you change your nim package's tags or description after you've published it?

Re: How do you add switched to the build task?

2020-01-12 Thread sflennik
Thank you, that worked. I created a config.nims file in my main folder and added one line: switch("define", "ssl")

Re: How do you add switched to the build task?

2020-01-12 Thread sflennik
Where do I put the line: switch("define", "ssl")? I tried a few more things without luck: * I tried adding a "before build" task: before build: switch("define", "ssl") Run * I tried adding it by itself in the my project nimble file. * I tried adding it t

How do you add switched to the build task?

2020-01-12 Thread sflennik
My nim package needs the -d:ssl compile switch. How do I add the switch to the nimble build task used by nimble install? I tried a number of things but none of them worked for me. * I tried making a cfg file with the line "-d:ssl" in it. * I tried adding a switch("d", "ssl") in a nimble buil

Re: Nim extension libs for python

2019-12-05 Thread sflennik
I’ve been thinking about this problem for a while too. I copied Jonesmartinze three options here and numbered them for easier reference. 1\. create a source distribution of .py and .c files. The end user builds this so it matches their system architecture/OS. 2\. and/or create platform specifi

Re: Cross Platform Python Package

2019-11-16 Thread sflennik
I've been looking for another approach. From what I've read, the python wheel package can do what I want, but it is still a mystery to me how. Has anyone done this and know of a project I can learn from? I haven't been able to find an example in the python or nim public package lists.

Cross Platform Python Package

2019-11-03 Thread sflennik
The nimformat project on github uses nim with nimpy to build a python module that can be packaged and installed with python's package manager (pip). The package includes the c source files and pip compiles them to build the python module on the target machine. [https://github.com/UNIcodeX/nimfo

nimble task arguments

2019-10-12 Thread sflennik
Is it possible to pass arguments to nimble tasks? I want to pass the filename to run one test like this: nimble test filename Run

Re: Warning: imported and not used

2019-10-12 Thread sflennik
thank you, that did the trick

Warning: imported and not used

2019-10-12 Thread sflennik
I'm getting warnings about modules imported but not used and I want to fix my code. The second time I compile the warnings to do show up. How do I get the warnings to appear again? The second compile is much faster, so I'm thinking I might have to delete the cache. Is this correct? Where is it?

Re: nim code coverage

2019-10-05 Thread sflennik
Here is the code if you want to try it out: x.nim file: var x = 0 if x > 1: echo "foo" echo "bar" Run ct.sh file: #!/bin/sh # Remove old coverage information. rm -rf *.info html ~/.cache/nim # Compile t.nim modul

nim code coverage

2019-10-05 Thread sflennik
I'm trying to get nim code coverage working again in the new nim 1.0 version. It was working several months ago. Now it's reporting coverage on the c code instead of the nim lines. The html output shows 100% coverage on the x.nim.c file when it shouldn't and the standard lib files are not stripp

How to use memTracker to track memory usage?

2019-03-09 Thread sflennik
How do you use the memTracker compiler option to track memory usage? What I tried was: * added --memTracker:on to the compile line * added line to my main module to import nimtracker When I run my program, the memtracker.db file gets created and sqlite3 can view it. However the tracker ta

How to customize docgen css?

2018-10-12 Thread sflennik
How do you customize the html css output created by the nim rst2html command? I was able to edit the compiler's config file (~/.choosenim/toolchains/nim-0.19.0/config/nimdoc.cfg) to customize the css and I saw the changes in the css output. However, now I'm trying to do it with my own config fi

release only runtime crash

2018-09-17 Thread sflennik
My nim program crashes in release but not in debug mode. Some system code is overwriting my json structures causing the crash. The problem is hard to narrow down, it moves around as I add debugging code. I haven't been able to simplify the error case to something that is easy to share. The rele

Re: Interesting idea implemented in Zig

2018-09-17 Thread sflennik
I've used perfect hashing with rust. [https://github.com/sfackler/rust-phf](https://github.com/sfackler/rust-phf) I think it is a great idea and it might be implemented in nim with a macro. If you know the entries at compile time, why not make the map as fast and small as possible. In the compi

Re: Workflow: how do I make a cpp lib in nim?

2018-09-17 Thread sflennik
There's not an exportcpp pragma in nim that I know about. But have you tried wrapping the nim c code with, extern "C"? Cpp code can compile wrapped c code.

Re: debugging a nim python module with lldb

2018-09-08 Thread sflennik
Instead of typing r the second time, type "continue" instead. Then your program will run and stop at breakpoints.

Re: How do you gracefully stop the compiler?

2018-08-11 Thread sflennik
The answer to my question in another thread lead to the answer to this one. Replace the "compile error" line with: static: doAssert(false, "T is not a string") Run The the doAssert will run at compile time.

How do you gracefully stop the compiler?

2018-08-11 Thread sflennik
How do you gracefully stop the compiler? You can specify garbage to stop it, but is there a better way? static: echo "compiling..." proc display[T](message: T) = when not (T is string): compile error: "T is not a string" echo message displa

Re: nimvm echos do not appear

2018-08-11 Thread sflennik
So this is expected nimvm behavior? I thought it would operate like static. This works as I expect: static: echo "compiling" echo "running" Run

nimvm echos do not appear

2018-08-11 Thread sflennik
The "compiling..." string does not appear when compiling this program: when nimvm: echo "compiling..." else: echo "running..." Run

debugging a nim python module with lldb

2018-08-06 Thread sflennik
I am trying to debug a python module I wrote in nim using lldb on a Macintosh. Anyone know how to debug a python module? The shared library module is compiled like: nim c -d:buidingLib --debugger:native --verbosity:0 --hints:off --threads:on \ --tlsEmulation:off --app:lib --ou

Addresses of variables and endian procedures

2018-03-27 Thread sflennik
The following program generates the errors: t.nim(15, 17) template/generic instantiation from here t.nim(5, 28) Error: expression has no address Why does the expression buffer[0] have no address? import endians import strutils proc parse[T](buffer:

generic proc not instantiated depending on calling syntax

2018-03-18 Thread sflennik
The following program generates an error. Shouldn't it work? proc readMe[T](name: string): T = result = 123'u16 var num = "test".readMe[uint16]() # var num = readMe[uint16]("test") echo num Here are the error messages: t.nim(5, 17) template/gener

Warning: parseopt2 is deprecated

2018-03-16 Thread sflennik
I upgraded from nim version 0.17 to 0.18 and I'm in the process of updating my code to remove the deprecated warnings. What is the replacement for parseopt2?

Re: color text output in nimble

2018-02-18 Thread sflennik
Thanks. My problem was using the wrong escape code. Here are some examples of showing [Suite] in bold blue. Python: python -c "print '033[1;34m[Suite]033[0m'" Nim: echo "e[1;34m[Suite]e[00mn" Bash: printf "e[1;34m[Suite]e[00mn"

color text output in nimble

2018-02-17 Thread sflennik
Is there an easy way to output color text to the terminal in the nimble file? I tried using standard terminal codes but that didn't work. I then found and used the Terminal module. That works in a nim file, see the example below, however you cannot import Terminal in a nimble file (or nimscript

three or more parameters to a pragma macro

2017-11-04 Thread sflennik
Is it possible to pass 3 or more parameters to a pragma or block type macro? For example, say I want to pass an int and string to a pragma macro. The example below generates the error: t.nim(10, 34) Error: identifier expected, but found '42' import macros macro echoName(va

Re: testing private methods in external module

2017-10-26 Thread sflennik
Thank you for the responses and code, I'm learning a lot about the macro system. Nice idea to use a pragma. Testing the macro I was getting the compiler error: t.nim(11, 20) Error: invalid indentation I used treeRepr in the macro to debug the problem. It turned out I was putti

Re: testing private methods in external module

2017-10-25 Thread sflennik
Using include is an interesting idea, it adds another dimension to consider. Including allows you to group all module tests together which I want, however it requires you run in the main module. I want to run in an external module to more closely match how a user would use the code. I didn't an

testing private methods in external module

2017-10-22 Thread sflennik
I'm testing my module's procedures in an external test module. This works great for public procedures but not at all for private ones since they are not exported. I have been exporting these just so I can write test code. This has the drawback that the public interface of the module is bigger th

Error: expression has no address with openArray

2017-10-13 Thread sflennik
How do I swap the first two bytes of the openArray in the following code? # t.nim(5, 35) Error: expression has no address import strutils import endians proc num(buffer: openArray[uint8]): uint16 = swapEndian16(addr(result), addr(buffer)) var buffer = [0x0

Re: Error: cannot instantiate: 'T'

2017-10-10 Thread sflennik
Thank you very much.

Error: cannot instantiate: 'T'

2017-10-09 Thread sflennik
I'm trying to write a generic function, here is a simplified version. It generates the errors shown below. What am I doing wrong? import strutils proc test16(): uint16 = var buffer: array[sizeof(uint16), uint8] for ix in 0..sizeof(uint16)-1: buffer[ix] =

Re: directory structure for a multi-file project?

2017-10-01 Thread sflennik
Thanks for all the helpful advice. I am trying out this structure: bin docs tests nim.cfg which contains one line: --path:"../project/" test_project.nim test_file1.nim project.nimble project project.nim file.nim private

directory structure for a multi-file project?

2017-10-01 Thread sflennik
How do you set up a directory structure for a multi-file project with test files and doc files? How do you name the files and how do you run tests? I'm trying to follow this page without much luck: [https://github.com/nim-lang/nimble#project-structure](https://github.com/nim-lang/nimble#project-

Re: Error: cannot instantiate: 'OrderedTable'

2017-09-25 Thread sflennik
Thank you, that helps. I'm now looking at the json module.

Error: cannot instantiate: 'OrderedTable'

2017-09-24 Thread sflennik
I get a compiler error for the following code. Anyone know what I am doing wrong? from tables import OrderedTable, toOrderedTable proc getMetaInfo(filename: string, fileSize: int64): OrderedTable = result = { "filename": filename, "size": fileSize,

Re: .. code-block:: nim

2017-09-21 Thread sflennik
Thank you. I did need to indent my code block.

.. code-block:: nim

2017-09-20 Thread sflennik
I am using the ".. code-block:: nim" in my doc comments. When I run "nim doc file.nim" the html generated does not have the nim code formatted as I expect, it is just plain text. How do I get formatted code?

Re: Error: type mismatch: got (OptParser)

2017-09-19 Thread sflennik
Thanks, after "brew upgrade nim" it works for me.

Error: type mismatch: got (OptParser)

2017-09-18 Thread sflennik
Why am I getting a compiler error? Here is the program: $ cat test.nim import parseopt2 var p = initOptParser(@["\--left", "\--debug:3", "-l=4", "-r:2"]) for kind, key, val in p.getopt(): echo kind And here is the error: $ nim c -r test.nim ... test.nim(4, 24) Error: type mismatch: got (O