Skip to content

Commit

Permalink
Merge pull request #53 from JuliaQUBO/px/bump-version
Browse files Browse the repository at this point in the history
Consolidate Updates & Bump Version
  • Loading branch information
pedromxavier authored Sep 24, 2024
2 parents 01558c3 + 8337fed commit 155b8a9
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
fail-fast: false
matrix:
include:
- version: '1.9'
- version: '1.10'
os: ubuntu-latest
arch: x64
- version: '1.9'
- version: '1.10'
os: windows-latest
arch: x64
steps:
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QUBOTools"
uuid = "60eb5b62-0a39-4ddc-84c5-97d2adff9319"
authors = ["pedromxavier <[email protected]>", "pedroripper <[email protected]>", "AndradeTiago <[email protected]>", "joaquimg <[email protected]>", "bernalde <[email protected]>"]
version = "0.9.3"
authors = ["pedromxavier <mail@pedro.ϵλ>", "pedroripper <[email protected]>", "AndradeTiago <[email protected]>", "joaquimg <[email protected]>", "bernalde <[email protected]>"]
version = "0.10.0"

[deps]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Expand All @@ -17,6 +17,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[weakdeps]
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Expand Down
35 changes: 34 additions & 1 deletion src/QUBOTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,50 @@ import Printf
import HDF5
import JSON
import JSONSchema
import NetworkLayout
import TOML

using Graphs
using GeometryBasics
using LinearAlgebra
import NetworkLayout
using SparseArrays
using Statistics
using RecipesBase
using Random

import PseudoBooleanOptimization as PBO
import PseudoBooleanOptimization: varlt, varshow

const __PROJECT__ = Ref{Union{String,Nothing}}(nothing)

function __project__()
if isnothing(__PROJECT__[])
proj_path = abspath(dirname(@__DIR__))

@assert isdir(proj_path)

__PROJECT__[] = proj_path
end

return __PROJECT__[]::String
end

const __VERSION__ = Ref{Union{VersionNumber,Nothing}}(nothing)

function __version__()::VersionNumber
if isnothing(__VERSION__[])
proj_file_path = abspath(__project__(), "Project.toml")

@assert isfile(proj_file_path)

proj_file_data = TOML.parsefile(proj_file_path)

__VERSION__[] = VersionNumber(proj_file_data["version"])
end

return __VERSION__[]::VersionNumber
end

const = -1 # \downarrow[tab]
const = +1 # \uparrow[tab]

Expand Down
4 changes: 2 additions & 2 deletions src/library/frame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Base.Symbol(s::Sense)
end
end

String(s::Sense) = String(Symbol(s))
Base.String(s::Sense) = String(Symbol(s))

domain(x::Domain) = x

Expand All @@ -48,7 +48,7 @@ function Base.Symbol(x::Domain)
end
end

String(x::Domain) = String(Symbol(x))
Base.String(x::Domain) = String(Symbol(x))

function sense(obj::Any)
return sense(frame(obj))
Expand Down
4 changes: 4 additions & 0 deletions src/library/synthesis/abstract.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
function generate(problem::AbstractProblem)
return generate(Random.GLOBAL_RNG, problem)
end

macro _deprecate_generate()
return quote @warn("Depraction Warning: To use `generate`, please refer to `QUBOLib.jl`") end
end
2 changes: 2 additions & 0 deletions src/library/synthesis/sherrington_kirkpatrick.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ end
const SK{T} = SherringtonKirkpatrick{T}

function generate(rng, problem::SherringtonKirkpatrick{T}) where {T}
@_deprecate_generate()

f, x = PBO.sherrington_kirkpatrick(
rng,
PBO.PBF{Int,T},
Expand Down
2 changes: 2 additions & 0 deletions src/library/synthesis/wishart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ function Wishart(n::Integer, m::Integer; discretize::Bool = false, precision::In
end

function generate(rng, problem::Wishart{T}) where {T}
@_deprecate_generate()

f, x = PBO.wishart(
rng,
PBO.PBF{Int,T},
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand Down
54 changes: 54 additions & 0 deletions test/assets/foreign_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
function run_foreign_tests()::Bool
return "--run-foreign-tests" ARGS ||
Base.get_bool_env("QUBOTOOLS_FOREIGN_TESTS", false)
end

# Test foreign packages
function test_foreign_pkg(
pkg_name::AbstractString,
dev_path::AbstractString = QUBOTools.__project__();
test_kws...,
)
test_foreign_pkg(PackageSpec(name = pkg_name), dev_path; test_kws...)

return nothing
end

function test_foreign_pkg(
pkg_spec::Pkg.PackageSpec,
dev_path::AbstractString = QUBOTools.__project__();
test_kws...,
)
@info "Activating Test Environment for '$(pkg_spec.name)'"

Pkg.activate(; temp = true)

Pkg.develop(; path = dev_path)

Pkg.add(pkg_spec)

Pkg.status()

pkg_info = let
proj = Pkg.project()
deps = Pkg.dependencies()

deps[proj.dependencies[pkg_spec.name]]
end

@testset "$(pkg_info.name)@$(pkg_info.version)" begin
@test try
Pkg.test(pkg_info.name; test_kws...)

true
catch e
if !(e isa PkgError)
rethrow(e)
end

false
end
end

return nothing
end
15 changes: 13 additions & 2 deletions test/integration/integration.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
include("ext/ext.jl")
include("packages/packages.jl")

function test_foreign()
if run_foreign_tests()
@testset "▶ Foreign Package Tests" verbose = true begin
test_foreign_pkg(Pkg.PackageSpec(name="ToQUBO", rev="master"))
test_foreign_pkg("QUBODrivers")
test_foreign_pkg("QUBO")
end
end

return nothing
end

function test_integration()
@testset "⊚ ⊚ Integration Tests" verbose = true begin
test_extensions()
test_packages()
test_foreign()
end

return nothing
Expand Down
13 changes: 0 additions & 13 deletions test/integration/packages/packages.jl

This file was deleted.

9 changes: 0 additions & 9 deletions test/integration/packages/qubo.jl

This file was deleted.

9 changes: 0 additions & 9 deletions test/integration/packages/qubodrivers.jl

This file was deleted.

9 changes: 0 additions & 9 deletions test/integration/packages/toqubo.jl

This file was deleted.

10 changes: 7 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Test
using Printf
using Pkg
using Pkg.Types: PkgError
using SparseArrays
using Statistics
using RecipesBase
Expand All @@ -19,14 +21,16 @@ const SAT{T} = MOI.ScalarAffineTerm{T}
const SQF{T} = MOI.ScalarQuadraticFunction{T}
const SQT{T} = MOI.ScalarQuadraticTerm{T}

const Spin = QUBOTools.__moi_spin_set()
const QUBOModel = QUBOTools.__moi_qubo_model()
const NumberOfReads = QUBOTools.__moi_num_reads()
const QUBOTools_MOI = Base.get_extension(QUBOTools, :QUBOTools_MOI)
const Spin = QUBOTools_MOI.Spin
const QUBOModel = QUBOTools_MOI.QUBOModel
const NumberOfReads = QUBOTools_MOI.NumberOfReads

const __TEST_PATH__ = @__DIR__

# Include assets
include("assets/comparison.jl")
include("assets/foreign_tests.jl")

# Include test functions
include("unit/unit.jl")
Expand Down
2 changes: 0 additions & 2 deletions test/unit/library/library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ include("form.jl")
include("model.jl")
include("analysis.jl")
include("formats.jl")
include("synthesis.jl")

function test_library()
@testset "□ Library" verbose = true begin
Expand All @@ -14,7 +13,6 @@ function test_library()
test_model()
test_analysis()
test_formats()
test_synthesis()
end

return nothing
Expand Down

4 comments on commit 155b8a9

@pedromxavier
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Changing package repo URL not allowed, please submit a pull request with the URL change to the target registry and retry.

@pedromxavier
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/115963

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" 155b8a99e9aacc50706b66f3221c38db2ce3e78b
git push origin v0.10.0

Please sign in to comment.