Code Monkey home page Code Monkey logo

pythonix's People

Contributors

adisbladis avatar dependabot[bot] avatar mic92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pythonix's Issues

Importing local relative paths does not work

I am trying to use pythonix to import some local files and run some unit tests. However, it doesn't seem to parse relative paths properly. All of these methods work in the Nix REPL.

>>>import nix

>>> nix.eval('with import ./math.nix; isEven 2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
nix.NixError: not an absolute path: '././math.nix'

>>> nix.eval('with import (./. + "math.nix"); isEven 2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
nix.NixError: not an absolute path: '././.'

>>> nix.eval('with import (builtins.toString ./math.nix); isEven 2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
nix.NixError: not an absolute path: '././math.nix'

Iterate through all derivations in nixpkgs

Is it possible with pythonix to view a derivation similar to "nix show-derivation ..."? I have tried nix.eval("with import {}; python3Packages.numpy") and ran into errors. Maybe this is not the correct way to view a derivation output? My end goal is that I want to create an adjacency matrix of runtime vs test vs build time python dependencies. But I have plans to use all the derivations to gather statistics. Right now the big limitation for me is how to extract this from nix.

nix.so is being built for a wrong python version when it differs from meson

Currently in Nixpkgs python3 is python38, and python3Packages.pythonix is built correctly, but python37Packages.pythonix and python39Packages.pythonix both install nix.so in lib/python3.8/site-packages, thus a dependent package python39Packages.nixpkgs fails to import nix: NixOS/nixpkgs#107623 (comment)

I don't know whether the root cause of this issue is in pythonix (in how it uses meson), meson (which seems most likely to me), or Nixpkgs.

Exposing nix expression AST

I wanted to open an issue to judge what you think about exposing the nix expression AST in pythonix. This package is already great for evaluating expressions and working with the results in python. I would like to add a PR for AST support because this would enable a whole set of tooling to be easily made. For example

  • automate alphabetically sorting packages
  • automate enforcing a code style to expressions
  • could also benefit code editors with handling nix expressions

I have already found that the AST is exposed at https://github.com/NixOS/nix/blob/master/src/libexpr/nixexpr.hh . I will need to have knowledge of interfacing C++ with python for my future job (without using cython) and I think this is a doable project that could provide a lot of benefit.

pythonix is broken on nixos-19.03-beta

Steps to reproduce:

nix-shell -p 'python3.withPackages(ps: with ps; [ python3Packages.pythonix ])'

Error:

../src/python-to-nix.cc: In function ‘nix::Value* pythonnix::pythonToNixValue(nix::EvalState&, PyObject*)’:
../src/python-to-nix.cc:85:41: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     char *utf8 = PyUnicode_AsUTF8AndSize(obj, &size);
                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

Or is that a packaging issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.