diff --git a/.github/workflows/gradle-test.yml b/.github/workflows/gradle-test.yml index 289bd91f..49db7d91 100644 --- a/.github/workflows/gradle-test.yml +++ b/.github/workflows/gradle-test.yml @@ -17,3 +17,8 @@ jobs: - name: 'Test with Gradle' run: ./gradlew test + - name: 'Publish Test Report' + uses: mikepenz/action-junit-report@v3 + if: failure() + with: + report_paths: '**/build/test-results/test/TEST-*.xml' diff --git a/README.md b/README.md index d9e95ec8..9a0a017d 100644 --- a/README.md +++ b/README.md @@ -523,6 +523,8 @@ requirements: - name: numpy version: <=1.22.4 - name: pandas + - name: lxml + noBinary: true dev: - name: pytest - name: twine @@ -530,13 +532,18 @@ requirements: ``` Each requirement **must** have a specified `name` to look for in the PyPI repository, as well as an -optional `version` property. If the version is not specified, Paddle will try to resolve it by -itself when running the `resolveRequirements` task. +optional `version` and `noBinary` property. If the version is not specified, Paddle will try to +resolve it by itself when running the `resolveRequirements` task. -The version identifier can be specified as a number with some relation (e.g., by using prefixes `<=`, `>=`, `<`, `>`, +The version identifier can be specified as a number with some relation (e.g., by using +prefixes `<=`, `>=`, `<`, `>`, `==`, `!=`, `~=`, `===`), or just a general version number (the same as with `==` prefix). +`noBinary` specifies a strategy to choose a package's distribution methods. If that option is not +set, or set to false, Paddle will prefer binary wheel, otherwise Paddle will use source code +distribution. + **Note:** for now, only this format of requirement specification is available. Specifying requirements by URL/URI will be added in an upcoming Paddle release, stay tuned! diff --git a/idea/src/main/resources/schema/paddle-schema.json b/idea/src/main/resources/schema/paddle-schema.json index 49021122..cbab0a48 100644 --- a/idea/src/main/resources/schema/paddle-schema.json +++ b/idea/src/main/resources/schema/paddle-schema.json @@ -133,6 +133,9 @@ }, "version": { "type": "string" + }, + "noBinary": { + "type": "boolean" } } } @@ -151,6 +154,9 @@ }, "version": { "type": "string" + }, + "noBinary": { + "type": "boolean" } } } diff --git a/plugins/python/src/main/kotlin/io/paddle/plugin/python/dependencies/resolvers/PipResolver.kt b/plugins/python/src/main/kotlin/io/paddle/plugin/python/dependencies/resolvers/PipResolver.kt index d8d78a32..efb74187 100644 --- a/plugins/python/src/main/kotlin/io/paddle/plugin/python/dependencies/resolvers/PipResolver.kt +++ b/plugins/python/src/main/kotlin/io/paddle/plugin/python/dependencies/resolvers/PipResolver.kt @@ -40,6 +40,7 @@ object PipResolver { noCacheDir = project.pythonRegistry.noCacheDir packages = requirementsAsPipArgs additionalArgs = project.repositories.resolved.asPipArgs + noBinaryList = project.requirements.descriptors.filter { it.isNoBinary }.map { it.name } noIndex = project.environment.noIndex }.args val executable = project.environment.localInterpreterPath.absolutePathString() diff --git a/plugins/python/src/main/kotlin/io/paddle/plugin/python/extensions/Requirements.kt b/plugins/python/src/main/kotlin/io/paddle/plugin/python/extensions/Requirements.kt index 2a8bb5b2..ccb2e43e 100644 --- a/plugins/python/src/main/kotlin/io/paddle/plugin/python/extensions/Requirements.kt +++ b/plugins/python/src/main/kotlin/io/paddle/plugin/python/extensions/Requirements.kt @@ -56,7 +56,8 @@ class Requirements(val project: PaddleProject, val descriptors: MutableList must be provided for every requirement." }, versionSpecifier = req["version"]?.let { PyPackageVersionSpecifier.fromString(it) }, - type = Descriptor.Type.MAIN + type = Descriptor.Type.MAIN, + isNoBinary = req["noBinary"].toBoolean() ) } + devRequirements.map { req -> Descriptor( @@ -64,7 +65,8 @@ class Requirements(val project: PaddleProject, val descriptors: MutableList must be provided for every requirement." }, versionSpecifier = req["version"]?.let { PyPackageVersionSpecifier.fromString(it) }, - type = Descriptor.Type.DEV + type = Descriptor.Type.DEV, + isNoBinary = req["noBinary"].toBoolean() ) } @@ -72,7 +74,12 @@ class Requirements(val project: PaddleProject, val descriptors: MutableList) { var noCacheDir: Boolean = false var additionalArgs: List = emptyList() var packages: List = listOf() + var noBinaryList: List = listOf() var noIndex: Boolean = false fun build() = PipArgs(buildList { add("-m") @@ -22,6 +23,10 @@ internal class PipArgs private constructor(val args: List) { if (noCacheDir) { add("--no-cache-dir") } + if (noBinaryList.isNotEmpty()) { + add("--no-binary") + add(noBinaryList.joinToString(separator = ",")) + } if (noIndex) { add("--no-index") }