Circular dependency? - clojure

I set up a basic luminus template with postgres. I want to be able to add new users and authenticate them, following an example from Ch.6 p.168 in this book: https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/
I had issues, so I started over with a new project to just try to get through this part.
I created a new luminus project, I created the database table, and I updated the project.clj file. I was able to migrate okay, but then I added an auth.clj file, and then went to restart with lein run, and now I get this error:
Assert failed: circular dependency
(not (depends? graph dep x))
I'm not sure what's going on, because my dependencies are the exact same as the source code, and I'm a total beginner.
What can I do to resolve this?

So thanks to Svante's hint, I double checked my namespace in the auth.clj file, and it turns out I just had a simple typo with the namespaces. When I got the error, I had panicked and didn't think to check that part. I fixed the typo and now lein run works! Thanks.

Related

Clojure/leiningen cannot find dependencies

I am new to Clojure and Leiningen. Just started working on an existing project. I pull the repo and did the command Lein run. It complained:
"Could not find artifact arctype:service.jose:jar:0.1.0-SNAPSHOT in clojars (https://repo.clojars.org/)
Could not transfer artifact arctype:service.jose:jar:0.1.0-SNAPSHOT from/to enonic (https://repo.enonic.com/public/): Failed to transfer file https://repo.enonic.com/public/arctype/service.jose/0.1.0-SNAPSHOT/service.jose-0.1.0-SNAPSHOT.jar with status code 409"
What I proceeded to do, under the assumption that the dependencies are bad, is that I went on repo.clojars.org. Manually looked into the dependencies and changed "[arctype/service.jose "0.1.0-SNAPSHOT" :exclusions [arctype/service]]" in project.clj to "[arctype/service "0.1.0-SNAPSHOT":exclusions [arctype/service]]", because that is what it has on the site. But turns out that "Jose" is not inside of arctype/service, and changing the dependencies like I did removed it, so I have to change it back.
What im really confused about, is that, according to the error message, I went on repo.clojars.org to look for the dependencies I want, "arctype.service.jose" is no where to be found. Not even something close.
I saw the second half error message that mentions repo.enonic.com/public , so I try to look for the dependecy there as well. Same result, nothing. In my project.clj file, the repository is repo.enonic.com/public. I am really confused, can somebody please enlighten me! Thanks in advance!
Im not sure if I provided enough, please let me know!
Most open source projects written in Java publish artifacts on Maven Central, and most Clojure projects publish artifacts on Maven Central or clojars.org. The fact that your error message mentions https://repo.enonic.com/public/ might be because the artifact mentioned in your project.clj file was published on that server, not on clojars.org.
If I go to clojars.org (not repo.clojars.org) there is a nice web interface with a search box, and if I enter "arctype" (without the double quotes) and do a search on that, it finds arctype/service, but not arctype/service.jose, probably because arctype/service.jose was not published on the clojars.org site. Or, if it was, someone decided to remove it. Removing published things is fairly uncommon, so my guess is that if arctype/service.jose ever existed, it might have only been published on the repo.enonic.com site.
Is your project open source? Published on Github.com or a similar site where others can get a copy and try it out? If yes, including that in your question would help others see if they get the same error you do.
If the project you are working with is not open source, then hopefully someone more familiar with the particular errors you are seeing than I am will answer.

How to not use pylint-django in non Django file?

I'm new to the Django. I am currently use VS code as my code editor.
In order to work on the Django project, in the user settings of the VS code, I include the following code to use pylint_django as the default linter.
"python.linting.pylintArgs": [
"--load-plugins=pylint_django", "--errors-only"
],
However, in another python file, which is just a regular python file, I got an error, saying "Django is not available on the PYTHONPATHpylint(django-not-available)"
If I comment the above code in the user setting, the error goes away. I think the problem is pylint-django is used as default linter, even for non-Django python file.
My question is I didn't find the solution to solve this problem. Could you please help me on this? Thank you so much. I really appreciate it.
The problem is solved when I uninstall the globally installed pylint_django.

Error: Program type already present: com.appsflyer.AFExecutor

I'm struggling to implement AppsFlyer on Android using Java.
I have looked into a couple of posts already such as this, this.
Here is the entire error message: [org.gradle.api.Project] AGPBI: {"kind":"error","text":"Program type already present: com.appsflyer.AFExecutor","sources":[{}],"tool":"D8"}
The version
AppsFlyer SDK: 5.+
Android Studio: 3.5.2
Situation
I have done till 4.1 of this guide so far so good.
On AndroidManifest.xml, the main class name of AF has implemented with android.name attribute.
On AndroidManifest.xml, receiver tag commented out (because in this phase I don't believe I do not need a precise data tracking feature.)
What I have tried.
./gradlew app:dependencies | less To find out AFExecutor in other dependencies
To exclude the program
implementation ('com.appsflyer:af-android-sdk:5.+'){
exclude module: 'com.appsflyer'
}
implementation ('com.appsflyer:af-android-sdk:5.+'){
exclude module: 'AFExecutor'
}
If you have any insights, I'd love to hear that.
Try ./gradlew clean, clean project and invalidate caches and restart. If does not help than delete all build and .idea folders, .iml files.
After exploring a bunch of dependencies, I found the solution. The reason was there was a conflict between com.appsflyer:af-android-sdk:5.+ and AF-Android-SDK.jar which had installed manually. After removing the JAR file and built again, I could make it at last! Thank you so much for sharing your experiences, however, the solution was simple!

Django:Run pylint on all the apps in one go

I want to run pylint recursively on all my project apps from the root of the app. If i use : pylint . on the root of the project base, it gives me the error that there is no init.
How can I run the pylint from my project root without having to specify all the apps one by one.
EDIT
Thank you heartily for the downvotes. But since I am a novice at that and still couldnt find a solution to my issue, can the downvoters please explain or the give the oh-so-obvious solution? If this is how pylint is designed to be called recursively on each app, then can you point me to the documentation?
So by default the pylint is requires the module name or the file name to be linted to be provided to it as args and it does not automatically recursively search from the pwd. It would however lint every python file in a module if a module name is provided.
In order to run the pylint without the hassle of having to maintain the apps, I am using :
PyCQA/prospector

Why do incanter, other than incanter itself, namespaces expecting clojure/core/matrix class or .clj?

In a .clj file I have (use '(incanter core io ...)). This error occurs when attempting to evaluate that code: FileNotFoundException Could not locate clojure/core/matrix__init.class or clojure/core/matrix.clj on classpath: clojure.lang.RT.load (RT.java:443). If I change the code to just this: (use '(incanter)), then all is OK except that none of the necessary namespaces are available, which is to be expected. I have been using jEdit with the clojure plugin quite happily for the past 18 months and closely verified that my classpath was OK. I tried (use '...math.combinatorics) and the csv & json jars (these all worked OK) to be reasonably sure it wasn't a jEdit config problem. I looked for 'matrix' in the clojure/core jar, but did not find it. Any help to solve this problem greatly appreciated.
After further investigation:
I think I have found the source of my problem: in the clatrix-0.3.0 namespace declaration clojure.core.matrix is required. When I remove clatrix from the classpath and evaluate (use '(incanter core ...)) this error occurs: FileNotFoundException Could not locate clatrix/core__init.class or clatrix/core.clj on classpath: clojure.lang.RT.load (RT.java:443). When clatrix is added to the classpath then my original error occurs (i.e. can't find clojure.core.matrix). Incanter-core does have a Matrix.class file. It seems incanter depends on clatrix which depends on clojure.core. matrix which doesn't exist. How does one solve this problem or is there a work-around?
The problem here is that you are not providing the transitive dependencies for your library. clojure.core.matrix is not part of clojure.core. Clearly whatever method Jedit uses for running Clojure does not detect or resolve your dependencies for you.
While this dependency resolution can be done by hand, it is a less error prone task, and less time consuming, to let leiningen resolve your dependencies and set up your class path during development, and use the lein repl task to start your interactive repl during development. Lein repl starts an nrepl server, which has a well defined API that multiple editors / programming environments can connect to. A good editor for clojure development should provide some method of connecting to an nrepl server.