jiptool / jip

Java dependency management for Jython
http://pypi.python.org/pypi/jip/
Other
59 stars 15 forks source link

Ability to define depenencies within a python module / python code #6

Closed vvangelovski closed 13 years ago

vvangelovski commented 13 years ago

Something similar to how it's done in BuildConfig.groovy in a grails app

sunng87 commented 13 years ago

Yes, I am also thinking about add something just like gradle's build.gradle: http://gradle.org/tutorial_java_projects.html#N10423

This will allow user to define custom repositories and dependencies, instead of current ini and pom solution.

But there is problem. jip is an environment-scoped tool, not a project-scoped one, which is different from setup.py . And if we define such a jython-dependencies.py for a project, it's reasonable for user who download source and build. But for users using pip, the dependency descriptor module must be packaged into sdist so that jip can find it. But I don't think it's a good idea.

We still need some investigation to find a grace way to archive simple dependency management.

sunng87 commented 13 years ago

Today I just enhanced jip for programming friendly. Now you can run jip command inside your setup.py Here is an example: https://bitbucket.org/sunng/gefr/src/72d3f88fcca4/src/setup.py

This will integrate jip into pip. The Java dependencies will be resolved automatically after the package installed. Also I enhanced pom file support so user are not required to provide a .jip configuration file to specify custom maven repository, just add it to the pom follow the maven way: https://bitbucket.org/sunng/gefr/src/72d3f88fcca4/src/pom.xml

vvangelovski commented 13 years ago

This is excellent. Because I'm working on a reusable application for django that has dependencies on java libraries and this approach makes it far more easier to distribute to end users (other developers).

However, I'm concerned about the license. If you use jip in this way isn't your code supposed to be GPL3?

sunng87 commented 13 years ago

Since now jip can be treated as a library, I'd like to switch to LGPLv3 or MIT. Actually I am not familiar with conflicts between licenses. Do you have any suggestion about the new license?

vvangelovski commented 13 years ago

Since pip and virtualenv are both MIT, I think it's the best option. Usually I go with either BSD or MIT, which are pretty much the same.

sunng87 commented 13 years ago

Hi Vasil, this feature is just implemented. With the latest jip, you can define Java dependencies in setup.py . Here is an example:

    from jip.dist import setup

    requires_java = {
        'dependencies':[
            ('org.slf4j', 'slf4j-api', '1.6.1'),
            ('org.slf4j', 'slf4j-log4j12', '1.6.1'),
            ('info.sunng.soldat', 'soldat', '1.0-SNAPSHOT'),
            ('org.apache.mina', 'mina-core', '2.0.2')
        ],
        'repositories':[
            ('sonatype-oss-snapshot', 'http://oss.sonatype.org/content/repositories/snapshots/')
        ]
    }

    setup(
        ...
        requires_java=requires_java,
        ...
    )

And jip is now available under **MIT License**, so feel free to use it in your code. 

Would you like to check it out and have a try? Your suggestion is welcomed. 
vvangelovski commented 13 years ago

Great

I hope to work some more on a Jython project today, so I'll try it out.