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

Add 1 implementation #1

Merged
merged 6 commits into from Jul 24, 2021
Merged

Add 1 implementation #1

merged 6 commits into from Jul 24, 2021

Conversation

juancarlospaco
Copy link
Contributor

  • Add Nim implementation.

Steps to try it

Assuming Linux, assuming you are in the repo root folder.

  • curl https://nim-lang.org/choosenim/init.sh -sSf | sh
  • Add Nim to PATH, using ~/.bashrc, instructions provided by install process.
  • nimble install nimpy
  • nim c -d:danger --out:list_nim.so list_nim.nim
  • python main.py

@00sapo
Copy link
Owner

00sapo commented Apr 19, 2021

Hey thanks for this, I'm really interested in nim.

However, I get the following errors:

free(): invalid pointer

signal (6): Aborted
in expression starting at none:1
gsignal at /usr/lib/libc.so.6 (unknown line)
abort at /usr/lib/libc.so.6 (unknown line)
__libc_message at /usr/lib/libc.so.6 (unknown line)
malloc_printerr at /usr/lib/libc.so.6 (unknown line)
_int_free at /usr/lib/libc.so.6 (unknown line)
cfree at /usr/lib/libc.so.6 (unknown line)
PyMem_RawFree at /tmp/python-build.20210104143045.2522119/Python-3.9.0/Objects/obmalloc.c:595 [inlined]
_PyObject_Free at /tmp/python-build.20210104143045.2522119/Python-3.9.0/Objects/obmalloc.c:1922 [inlined]
_PyObject_Free at /tmp/python-build.20210104143045.2522119/Python-3.9.0/Objects/obmalloc.c:1913
unknown function (ip: 0x7f79e578509e)
unknown function (ip: 0x7f79e582a33e)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
unknown function (ip: 0x7f79e58179ac)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyEval_EvalFrameDefault at /usr/lib/libpython3.9.so.1.0 (unknown line)
_PyFunction_Vectorcall at /usr/lib/libpython3.9.so.1.0 (unknown line)

[...]

__libc_start_main at /usr/lib/libc.so.6 (unknown line)
_start at /home/sapo/Develop/cython_test_nim/.venv/bin/python (unknown line)
Allocations: 625720 (Pool: 625441; Big: 279); GC: 1
fish: Job 1, 'poetry run python main.py' terminated by signal SIGABRT (Abort)

@juancarlospaco
Copy link
Contributor Author

Whats the command that gives that output ?.

I am not using poetry, because is not needed, does not support it, just run it manually with the commands I posted.
(Nim also runs interpreted so I use it for deploys and scripting too).
:)

@00sapo
Copy link
Owner

00sapo commented Apr 20, 2021

The command which fails is poetry run python main.py

Sorry, I don't think poetry is not supported, but if it's so, it is hard to see Nim in a real workflow...

@juancarlospaco
Copy link
Contributor Author

juancarlospaco commented Apr 20, 2021

is Julia lang supported by Poetry ?, thats interesting.

Poetry crashes on start on my computer complaining:

$ poetry add nimporter

The currently activated Python version 3.9 is not supported by the project (3.9).
Trying to find and use a compatible version.
  NoCompatiblePythonVersionFound
Poetry was unable to find a compatible version.

$

The problem is I dont know how to use Poetry, crashes on my PC, seems unstable this is the official vanilla CPython 3.9.

Theres a few packages that you can install with PIP for a workflow with Nim:

Can not be made with a bash script ?, the Poetry crash has nothing to do with Nim...

I dont know what you suggest to do...

@00sapo
Copy link
Owner

00sapo commented May 22, 2021

Developing in python without virtualenv is out of discussion.

Please, provide an option working with one among virtualenv, conda, or poetry.

@00sapo
Copy link
Owner

00sapo commented Jul 23, 2021

@juancarlospaco do you plan to work on this in future?

@00sapo 00sapo reopened this Jul 24, 2021
@00sapo 00sapo merged commit 535d07e into 00sapo:main Jul 24, 2021
@00sapo
Copy link
Owner

00sapo commented Jul 24, 2021

Thank you so much, we just needed to use poetry in front of nim compiler so that it knows against which python version it should compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants