How to add local package as requirements in python - setuptools

I am trying to create a Python wheel (.whl) of my source code.
My project uses a library which I have downloaded as wheel.
For that, I want to create a setuptools setup.py script that requires to install the "outsource" library first.
The outsource library is in my repository as wheel.
Long story short, I want to create a wheel that could run on standalone environment. The dependency (the library I have downloaded) is provided as wheel.
Flow:
Start installing my package
Installing the attached package (the library)
End installing my package.
So I need a solution for creating a wheel that installs other wheels.
My setup.py:
setup(
name="my_package_name",
version=version,
author_email=",my-name#my-asso.com",
description=description,
long_description=long_description,
long_description_content_type="text/markdown",
url="...",
python_requires=">=3.6.0",
cmdclass={
"clean": CleanCommand,
},
#package_dir={"": "package_dir"},
package_data={"": ["*.pkl", "*.json", "VERSION"]},
packages=find_packages(exclude=('tests', 'tests.*')),
install_requires=requirements,
include_package_data=True,
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries"
],
)
These are the things I tried to do:
Used requirements.txt file with the name of the library PROJECT_NAME==1.1.1 - this works, but it requested from the installer to download the library. and I don't want it to happen. As I mentioned, I want to provide my package to a standalone environment.
Used requirements.txt file with the relative path to the wheel package ./requirements/PROJECT_NAME-1.1.1-py3-none-any.whl. But it fails with the error:
error in my-package setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Parse error at "'./requir'": Expected W:(0-9A-Za-z)

Related

Data.Vector module Cannot Be Found

I start a new project library with cabal. here is the .cabal file
cabal-version: 2.4
library
exposed-modules: MyLib
build-depends: base ^>=4.14.3.0
, vector
hs-source-dirs: src
default-language: Haskell2010
I then use some Data.Vector functions inside my code. Here is the MyLib source
module MyLib (someFunc) where
import qualified Data.Vector as V
func :: [a] -> V.Vector a
func a = V.fromList a
But Data.Vector module remains underlined in red and this error is shown inside Vcode:
Could not load module ‘Data.Vector’
It is a member of the hidden package ‘vector-0.13.0.0’.
the func function works when in cabal repl
when I try cabal install vector this error appears:
Wrote tarball sdist to
/home/. .. .tar.gz
Resolving dependencies...
cabal: Cannot build the executables in the package vector because it does not
contain any executables. Check the .cabal file for the package and make sure
that it properly declares the components that you expect.
I don't understand what I am doing wrong? I told I understood the workings of cabal: I import a module as a dependency in .cabal, and I should be able to use it? why VSC does tell me he can't find it?

View all installed libraries and how they are to be imported in Coq

I've been wanting to use coq-vpl, and I have it installed. I can confirm this from opam list
ubuntu#ubuntu-xenial:~$ opam list
# Installed packages for system:
...
coq 8.6 Formal proof management system.
coq-vpl 0.2 Coq interface to VPL abstract domain of convex polyhedra.
coq-vpltactic 0.2 A Coq Tactic for Arithmetic (based on VPL).
coqide 8.6 IDE of the Coq formal proof management system.
...
However, how do I find out what the library is actually called and what I need to import? The vpl page does not have docs on it.
You can run
coqc -config
To get a list of configuration variables. On my system, this gives
LOCAL=0
COQLIB=/home/jgross/.local64/coq/coq-8.7.1/lib/coq/
DOCDIR=/home/jgross/.local64/coq/coq-8.7.1/share/doc/coq/
OCAMLFIND=/home/jgross/.opam/system/bin/ocamlfind
CAMLP4=camlp5
CAMLP4O=/home/jgross/.opam/system/bin/camlp5o
CAMLP4BIN=/home/jgross/.opam/4.02.2/bin/
CAMLP4LIB=/home/jgross/.opam/system/lib/camlp5
CAMLP4OPTIONS=-loc loc
CAMLFLAGS=-thread -rectypes -w +a-4-9-27-41-42-44-45-48-50 -bin-annot -safe-string
HASNATDYNLINK=true
COQ_SRC_SUBDIRS=config dev lib kernel library engine pretyping interp parsing proofs tactics toplevel printing intf grammar ide stm vernac plugins/btauto plugins/cc plugins/derive plugins/extraction plugins/firstorder plugins/fourier plugins/funind plugins/ltac plugins/micromega plugins/nsatz plugins/omega plugins/quote plugins/romega plugins/rtauto plugins/setoid_ring plugins/ssr plugins/ssrmatching plugins/syntax plugins/xml
If you look at the user-contrib directory of the path given by COQLIB, you should see folders with the various libraries you've installed. For any of these folder names, you can add From FolderName Require Import FileName to your Coq file.
According to https://github.com/VERIMAG-Polyhedra/VplTactic, you need to run coq, for instance by launching coqide (which you installed) and by typing the following lines in the left-hand-side window and executing them (using the downward green arrows on top of the window).
Require Import VplTactic.Tactic.
Add Field Qcfield: Qcft (decidable Qc_eq_bool_correct, constants [vpl_cte]).
And so on, please read the page at the link given above. I did not try it yet.

Need help on start using purescript on NixOS

I am trying to setup hello world project with purescript on NixOs and have couple questions,
Official purescript website recommend installation via npm but there is no nixos.nodePackages.purescript, instead there are at least 2 variants I found in nixpkgs
nixos.purescript
nixos.haskellPackages.purescript
What are the different?
Official site recommend pulp and bower via npm but only nodePackages.bower is avaliable and there is undocumented psc-package.
What should be the nix way to handle purescript packages?
The sample code on official site (see hello.purs bellow) doesn't even compile,
with these error.
$ purs compile hello.purs
Error found:
at hello.purs line 1, column 1 - line 1, column 1
Unable to parse module:
unexpected "import"
expecting "module"
I add module Hello to code but still failed.
$ purs compile hello.purs
Error 1 of 2:
in module Hello
at hello.purs line 2, column 1 - line 2, column 15
Module Prelude was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Hello
at hello.purs line 3, column 1 - line 3, column 39
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to psc.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
How the correct workflow should be?
The goal is to have minimal example project with a single hello.purs
running in web browser.
This is hello.purs
module Hello where
import Prelude
import Control.Monad.Eff.Console (log)
greet :: String -> String
greet name = "Hello, " <> name <> "!"
main = log (greet "World")
It would be really helpful if you can also provide shell.nix for nix-shell or default.nix for nix-build.
Found this 2 years old guild, I am trying it but I still not have answer to all of my questions.
nixos.purescript is just the static executables for nixos.haskellPackages.purescript; this skips building/installing PureScript as a Haskell library
You can install Pulp via npm install pulp - the binary will be installed to node_modules/.bin/pulp
The sample code doesn't compile because you haven't downloaded the dependencies via Bower. You can install them via bower install purescript-prelude purescript-console.
But node_modules/.bin/pulp init will give you a Bower file and you can run bower install to give you a basic project. You can then do node_modules/.bin/pulp run to execute it using node.js, but you'll probably want pulp browserify --to example.js to get a file you can put in a <script> tag in HTML.

CoqIDE loadpath error for ssreflect

I am a Coq newbie and therefore to improve my understanding of proof checking I am trying to use the Ssreflect library.
I have installed Ssreflect v 1.5 on a Mac OS v 10.10.3 ( Yosemite ) which runs at the Terminal.
However when I tried to load the library into CoqIDE 8.4p15 using:
Require Import ssreflect.
I get the error:
Cannot find library ssreflect in loadpath
I have tried using:
Add LoadPath "/opt/local/lib/coq/user-contrib/Ssreflect/".
where SSRCOQ_LIB is currently set, but I get the error:
The file /opt/local/lib/coq/user-contrib/Ssreflect/ssreflect.vo contains library Ssreflect.ssreflect and not library ssreflect
Grateful for any help in loading the ssreflect library from within CoqIDE.
A big thanks to the people on the Coq-Club Forum who helped with this problem, and in particular Pierre Boutillier who pinpointed the cause of the problem and provided the solution.
The problem was that I had 2 copies of coqtop and 2 copies of standard libraries:
One in /opt/local/bin/coqtop ( which is the folder where my copy is installed yours maybe in a different folder ) and used to compile ssreflect ( I
used MacPorts to install coq ).
One in /Applications/CoqIDE_8.4pl5.app/Resources/bin/coqtop that is loaded by CoqIDE when double clicked on the app ( I downloaded it from the Cog web site ).
Therefore when I was in CoqIDE it was calling a different version of coqtop than the one that I used to compile and install the Ssreflect library.
The solution is the following :
Double click on CoqIDE
Open the preferences in the CoqIDE menu
Set Externals -> coqtop ( or it could be AUTO ) to "/opt/local/bin/coqtop" ( or wherever your version is installed ) Apply OK Close.
Quit and restart CoqIDE.
I successfully loaded the Ssreflect library both using coqtop in the Terminal and CoqIDE using:
Require Import ssreflect.

coq Hello World example (with opam) can't find libraries

I was following a coq HelloWorld tutorial (code below), and couldn't get the program to compile. I followed the installation steps and installed opam install coq:io:system. My opam installation is at the default location ~/.opam. But still, I got an error about
Toplevel input, characters 53-67:
Error: The reference System.effects was not found in the current environment.
This is with either emacs/proofgeneral or coqide (8.4pl6, ubuntu 14.04). Does any one know how to fix the issue?
Here's the code which I copied into a file called hello_world.v and loaded into emacs/coqide:
Require Import Coq.Lists.List.
Require Import Io.All.
Require Import Io.System.All.
Require Import ListString.All.
Import ListNotations.
Import C.Notations.
(** The classic Hello World program. *)
Definition hello_world (argv : list LString.t) : C.t System.effects unit :=
System.log (LString.s "Hello world!").
-- Update ---
#gtzinos, I followed the readme in https://github.com/clarus/coq-hello-world. This time there was no complaint about System.effects, but there was a new error about Extraction.launch not found. I tried:
git clone https://github.com/clarus/coq-hello-world.git
cd coq-hello-world
./configure.sh && make
and got:
"coqc" -q -R src HelloWorld src/Main
File "/.../coq-hello-world/src/Main.v", line 32, characters 19-36:
Error: The reference Extraction.launch was not found in the current
environment.
I tried also to make in the extraction folder, but without success. Any pointers?
New versions of the coq:io and coq:io:system libraries were just released. Run:
opam update
opam upgrade
to make sure you have coq:io:system in version at least 2.3.0. Now Extraction.launch should be available. System.effects has been replaced by System.effect.