Need advice on how to proceed with Yesod install - yesod

I interpret the following error to mean that a Yesod dependency, authenticate-0.10.2.2, requires attoparsec ==0.9.*, but Yesod itself requires attoparsec >=0.10. What can I do to resolve this?>
Resolving dependencies...
cabal: cannot configure authenticate-0.10.2.2. It requires attoparsec ==0.9.*
For the dependency on attoparsec ==0.9.* there are these packages:
attoparsec-0.9.0.0, attoparsec-0.9.1.1 and attoparsec-0.9.1.2. However none of
them are available.
attoparsec-0.9.0.0 was excluded because attoparsec-enumerator-0.3 requires
attoparsec ==0.10.*
attoparsec-0.9.0.0 was excluded because yesod-0.9.4.1 requires attoparsec >=0.10
attoparsec-0.9.1.1 was excluded because attoparsec-enumerator-0.3 requires
attoparsec ==0.10.*
attoparsec-0.9.1.1 was excluded because yesod-0.9.4.1 requires attoparsec
>=0.10
attoparsec-0.9.1.2 was excluded because attoparsec-enumerator-0.3 requires
attoparsec ==0.10.*
attoparsec-0.9.1.2 was excluded because yesod-0.9.4.1 requires attoparsec
>=0.10

I don't know why cabal is trying to installing an older version of authenticate. Try putting a lower bounds on it, i.e. authenticate >= 0.10.4, that should work.

Related

Does an ember package imported component use its parents library version?

I tried to use a component from an imported package inside a class in ember.
I expected the component to use its own version of ember-intl.
It resulted in the imported package using the parents version of ember-intl.
I have ember-intl 5.7.0 in parent and 4.3.0 used in an imported package.
There is a component called <Calendar> from the imported package used in a parent class which has a string that looks like:
"{Date} was selected for <span class='exampleName'".
4.3.0 will handle this string fine but 5.7.0 will fail as the major version change was that apostrophes were made into escape characters :[
node_modules shows that the child package resolves to 4.3.0 but during runtime it fails due to the apostrophe.
The imported component uses a service by injecting it:
import { inject as service } from '#ember/service';
intl: service()
I've added logging to both versions to see which is used and it is the parent version.
I would prefer not to downgrade the parent or alter the child library.
Can anyone explain why this is happening?
If any more info is needed, let me know, thanks.
You can only ever have one copy of a package at any given time -- allowing duplicates would explode your bundle size very rapidly (exponentially, even).
In best case scenarios, the "app version" will win, but in worst case scenarios, you duplicate dependencies in your app -- this can be linted against with ember-cli-dependency-lint
Because ember-intl relies on app-wide state, tho, it's not possible to get in to duplicate dependencies in your app -- because you can only ever have one copy of a service.
I recommend upgrading the package you're using, since ember-intl is nearly on v6 right now, and v4 is very old.

What is the difference between packages.dhall and spago.dhall files?

spago docs state:
packages.dhall: this file is meant to contain the totality of the packages available to your project (that is, any package you might want to import).
In practice it pulls in the official package-set as a base, and you are then able to add any package that might not be in the package set, or override existing ones.
spago.dhall: this is your project configuration. It includes the above package set, the list of your dependencies, the source paths that will be used to build, and any other project-wide setting that spago will use. (my emphasis)
Why do both files have the notion/concept of dependencies? Example: packages.dhall and spago.dhall from the ebook.
spago.dhall dependencies can be found in the project .spago folder. But I cannot locate the ones from packages.dhall. Others are common like aff. A different perspective:
[...] what you choose is a "snapshot", which is a collection of certain versions of all available packages that are guaranteed to compile and work together.
The snapshot is defined in your packages.dhall file, and then you specify the specific packages that you want to use in spago.dhall. The version for each package comes from the snapshot.
That sounds, like spago.dhall is an excerpt of packages from packages.dhall.The note about versions is a bit confusing, as there aren't version specifiers in both files.
So, why two files? What is the mental model for someone coming from npm ecosystem with package.json (which might be present as well)?
The mental model is that of a Haskell developer, which is what most PureScript developers used to be, and many still are. :-)
But more seriously, the mental model is having multiple "projects" in a "solution", which is the model of Haskell's de-facto standard package manager, Stack. In Haskell this situation is very common, in PureScript - much less so, but still not unheard of.
In a situation like this it's usually beneficial to have all the "projects" to share a common set of packages, which are all guaranteed to be "compatible" with each other, which simply means that they all compile together and their tests pass. In Haskell Stack this common set of packages is defined in stack.yaml. In Spago - it's packages.dhall.
Once you have this common base set of packages established, each individual project may pick and choose the particular packages that it uses. In Haskell Stack this is specified either in package.yaml or in <project-name>.cabal (the latter being phased out). In Spago - it's spago.dhall.
But of course, when you have just the one project, having both packages.dhall to establish the "base set" of packages and then, separately, spago.dhall to pick some particular packages from that set - may seem a bit redundant. And indeed, it's possible to do without the packages.dhall file completely: just specify the URL of the package set directly in spago.dhall, as the value of the packages property:
{ name = "my-project"
, dependencies = [ ... ]
, license = "..."
, packages = https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201223/packages.dhall
, repository = "..."
, sources = [ "src/**/*.purs" ]
}
This will work, but there is one important caveat: hashing. When the URL of the package set is specified in packages.dhall, running spago install will compute a hash of that package set and put it inside packages.dhall, right next to the URL. Here's what mine looks like:
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201222/packages.dhall sha256:620d0e4090cf1216b3bcbe7dd070b981a9f5578c38e810bbd71ece1794bfe13b
Then, if maintainers of the package set become evil and change the contents of that file, Spago will be able to notice that, recompute the hash, and reinstall the packages.
If you put the URL directly in spago.dhall, this doesn't happen, and you're left with the slight possibility of your dependencies getting out of sync.
Now to address this point separately:
Why do both files have the notion/concept of dependencies? Example: packages.dhall and spago.dhall from the ebook.
If you look closer at the examples you linked, you'll see that these are not the same dependencies. The ones in spago.dhall are dependencies of your package - the one where spago.dhall lives.
But dependencies in packages.dhall are dependencies of the test-unit package, which is being added to the package set as an override, presumably because we want to use the special version stackless-default, which isn't present in the official package set. When you override a package like this, you can override any fields specified in that package's own spago.dhall, and in this case we're overriding dependencies, repo, and version.

Require minimal OCaml version in jbuilder package

How do I require a specific OCaml version when defining a jbuild specification?
For instance, suppose I have this file:
(jbuild_version 1)
(library
((name myjson)
(public_name myjson)
(synopsis "My version of json")
(libraries (yojson))))
But then I want to use Unix.unsafe_environment, which is not available on OCaml < 4.06. How do I add this constraint to the package, so that someone trying to compile it with an older OCaml will get a nice error message (instead of the more cryptic Error: Unbound value Unix.unsafe_environment)?
The jbuild specification does mention the existence of variable ocaml_version, but I couldn't find a simple example of how to use it.
There is currently no built-in way to make jbuilder print a gentle message when the ocaml version is incompatible with the library.
You should be able to use ocaml_version in a rule stanza that produces an empty .ml but fail when the version is wrong. But it should be better to ask for this feature wish.
You can solve that at the opam level (so that this package won't be installable) by adding this to myjson.opam:
available: [ ocaml-version >= "4.06.0" ]
(are you sure Unix.environment doesn't work for you? unsafe_environment comes with some special precautions to be used safely)

Tkinter module compilation error - 2.5.2 needed

I have a decently long program that I have been trying to compile. I have tried py2exe and cx_Freeze, both seem to come up with this problem.
I used the following setup.py file to compile my program:
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [
Executable('version_3_2.py', base=base)
]
setup(name='version_3_2',
version='0.32',
description='desc',
executables=executables
)
From running this using
python setup.py build
The executable is created.
From running the executable, i was given a traceback stating that
TclError: Can't find a usable init.tcl in the following directories:
C:/Python27/build/lib/tcl8.5
and a bunch of other directories
From adding all of the tkinter and tcl files and folers into a couple of those directories i get the next traceback from executing:
C:/Python27/build/lib/tcl8.5/init.tcl: version conflict for package "Tcl":
have 8.5.15, need exactly 8.5.2
version conflict for package "Tcl": have 8.5.15, need exactly 8.5.2
while executing
"package require -exact Tcl 8.5.2"
(file "C:/Python27/build/lib/tcl8.5/init.tcl" line 20)
invoked from within
"source C:/Python27/build/lib/tcl8.5/init.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $tclfile]"
I'm not entirely sure what to do. Several solutions like How to correct TCL_LIBRARY and TK_LIBRARY with py2exe and Py2exe with Tkinter have not worked.
Any Ideas?
You need to match exactly the libtcl8.5.dll (or whatever the name is on your system) and the init.tcl (and related files) because they are both part of the same Tcl installation. If you change one out, you must change the other as well. How exactly you've mangled your installation I'm not quite sure, but mangled it surely is. Also be aware that in Tcl 8.5 (and before), it's strongly advised to match the Tk version precisely to it as well; we relax this requirement in 8.6 but you're not using that…
(Note that this is different from the way that normal dependencies work in Tcl; typically a program will depend on a minimum API version, not an exact one.)
Since you've got a binary build of 8.5.15 in use, you might as well use the script files for that version too. I suggest getting the Tcl source distribution for 8.5.15 from SourceForge and grabbing the files out of the library directory in there. You probably only need the .tcl files directly in there (especially init.tcl of course!) and not in any of the subdirectories, as the subdirectories are for official add on packages and those aren't so tightly bound to Tcl versions.

Clojure / HBase: How to Import HBaseTestingUtility in v0.94.6.1

In Clojure, if I want to start a test cluster using the hbase testing utility, I have to annotate my dependencies with:
[org.apache.hbase/hbase "0.92.2" :classifier "tests" :scope "test"]
First of all, I have no idea what this means. According to leiningens sample project.clj
;; Dependencies are listed as [group-id/name version]; in addition
;; to keywords supported by Pomegranate, you can use :native-prefix
;; to specify a prefix. This prefix is used to extract natives in
;; jars that don't adhere to the default "<os>/<arch>/" layout that
;; Leiningen expects.
Question 1: What does that mean?
Question 2: If I upgrade the version:
[org.apache.hbase/hbase "0.94.6.1" :classifier "tests" :scope "test"]
Then I receive a ClassNotFoundException
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.hbase.HBaseConfiguration
Whats going on here and how do I fix it?
any key / value pairs added to a dependency declaration are used as arguments to the clojure pomegranate library
the keys recognized are listed in the source here: in the source to pomagranate (for future reference that is a link to the function resolve-artifacts*)
the maven pom docs may also be helpful
:scope describes the conditions where the dependency is used, so :scope "test" would seem to indicate that the dependency is only pulled in while testing
:classifier seems to indicate the an extra element distinguishing versions
I speculate that the dependency resolution for the newer hbase version may have a poorly configured pom which is not declaring its dependencies properly. Try finding the info for org.apache.hadoop.hbase.HBaseConfiguration and requiring the package manually.
Leinigen uses the Maven dependency mechanism. Read that link to understand that different scopes.
The "classifier" is a token that is part of the dependency coordinates, so that a group of Jars / zip files / etc. can be part of the same logic release, but declared as distinct dependencies in your pom.xml. So in this case "tests" is a distinct HBase artifact from 0.94.6.1 that contains the tests.
You can see this in action by pointing your browser to the Maven "Central" repo location for that version of HBase:
http://repo1.maven.org/maven2/org/apache/hbase/hbase/0.94.6.1/
You can search the maven "central" repo here:
https://repository.apache.org/
or
http://mvnrepository.com/
On ClassNotFOundException - agreed with noisesmith. Your best bet is to find the dependency (jar) that contains that class and explicitly add it to your project dependency configuration.
Usually I do a google search for the classname and "jar" i.e.
https://www.google.com/search?q=jar+org.apache.hadoop.hbase.HBaseConfiguration