Skip to content

Commit 2ff6a83

Browse files
authored
Merge pull request #211 from JuliaAI/dev
For a 3.2.0 release
2 parents 990cb81 + 76f9c30 commit 2ff6a83

9 files changed

Lines changed: 126 additions & 117 deletions

File tree

.github/codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 0.5%
6+
removed_code_behavior: fully_covered_patch
7+
patch:
8+
default:
9+
target: 80

.github/workflows/ci.yml

Lines changed: 14 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
name: CI
22
on:
3-
pull_request:
4-
branches:
5-
- master
6-
- dev
73
push:
8-
branches:
9-
- master
10-
- dev
11-
tags: '*'
4+
branches: [master, dev]
5+
tags: ["*"]
6+
pull_request:
127
jobs:
138
test:
149
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -17,106 +12,38 @@ jobs:
1712
fail-fast: false
1813
matrix:
1914
version:
15+
- '1' # automatically expands to the latest stable 1.x release of Julia
2016
- '1.10'
21-
- '1' # automatically expands to the latest stable 1.x release of Julia.
2217
os:
2318
- ubuntu-latest
19+
- windows-latest
2420
arch:
2521
- x64
22+
include:
23+
- os: macOS-latest
24+
arch: aarch64
25+
version: 1
2626
steps:
27-
- uses: actions/checkout@v5
27+
- uses: actions/checkout@v4
2828
- uses: julia-actions/setup-julia@v2
2929
with:
3030
version: ${{ matrix.version }}
3131
arch: ${{ matrix.arch }}
3232
- uses: julia-actions/cache@v2
33-
env:
34-
cache-name: cache-artifacts
35-
with:
36-
path: ~/.julia/artifacts
37-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
38-
restore-keys: |
39-
${{ runner.os }}-test-${{ env.cache-name }}-
40-
${{ runner.os }}-test-
41-
${{ runner.os }}-
4233
- uses: julia-actions/julia-buildpkg@v1
4334
- uses: julia-actions/julia-runtest@v1
4435
- uses: julia-actions/julia-processcoverage@v1
4536
- uses: codecov/codecov-action@v5
4637
with:
38+
files: lcov.info
4739
token: ${{ secrets.CODECOV_TOKEN }}
48-
fail_ci_if_error: false
49-
verbose: true
5040
docs:
5141
name: Documentation
5242
runs-on: ubuntu-latest
5343
steps:
54-
- uses: actions/checkout@v5
55-
- uses: julia-actions/setup-julia@v2
56-
with:
57-
version: '1'
58-
- shell: julia --color=yes {0}
59-
run: |
60-
function set_environment_variable(name::AbstractString, value::AbstractString)
61-
github_env = ENV["GITHUB_ENV"]
62-
touch(github_env)
63-
open(github_env, "a") do io
64-
println(io, "$(name)=$(value)")
65-
end
66-
end
67-
event_name = "${{ github.event_name }}"
68-
if event_name == "pull_request"
69-
base_ref = "${{ github.base_ref }}"
70-
head_ref = "${{ github.head_ref }}"
71-
base_repository = "${{ github.repository }}"
72-
head_repository = "${{ github.event.pull_request.head.repo.full_name }}"
73-
build_docs = (base_ref == "master") && (head_ref == "dev") && (base_repository == head_repository)
74-
elseif event_name == "push"
75-
ref = "${{ github.ref }}"
76-
build_docs = (ref == "refs/heads/master") || (startswith(ref, "refs/tags/"))
77-
elseif event_name == "schedule"
78-
build_docs = ref == "refs/heads/master"
79-
elseif event_name == "workflow_dispatch"
80-
build_docs = ref == "refs/heads/master"
81-
else
82-
build_docs = false
83-
end
84-
if build_docs
85-
@info("We will build the docs")
86-
set_environment_variable("BUILD_DOCS", "true")
87-
else
88-
@info("We will NOT build the docs")
89-
set_environment_variable("BUILD_DOCS", "false")
90-
end
91-
- name: Instantiate docs environment
92-
shell: julia --color=yes --project=docs {0}
93-
run: |
94-
if ENV["BUILD_DOCS"] == "true"
95-
using Pkg
96-
Pkg.develop(PackageSpec(path=pwd()))
97-
Pkg.instantiate()
98-
end
99-
- name: Run doctests
100-
shell: julia --color=yes --project=docs {0}
101-
run: |
102-
if ENV["BUILD_DOCS"] == "true"
103-
using Documenter: doctest
104-
using ScientificTypes
105-
@info "attempting to run the doctests"
106-
doctest(ScientificTypes)
107-
else
108-
@info "skipping the doctests"
109-
end
110-
- name: Build documentation
111-
shell: julia --color=yes --project=docs {0}
112-
run: |
113-
if ENV["BUILD_DOCS"] == "true"
114-
@info "attempting to build the docs"
115-
run(`julia --project=docs docs/make.jl`)
116-
@info "successfully built the docs"
117-
else
118-
@info "skipping the docs build"
119-
end
44+
- uses: actions/checkout@v4
45+
- uses: julia-actions/julia-buildpkg@latest
46+
- uses: julia-actions/julia-docdeploy@latest
12047
env:
12148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12249
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ScientificTypes"
22
uuid = "321657f4-b219-11e9-178b-2701a2544e81"
33
authors = ["Anthony D. Blaom <anthony.blaom@gmail.com>"]
4-
version = "3.1.2"
4+
version = "3.2.0"
55

66
[deps]
77
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
@@ -20,7 +20,7 @@ ColorTypes = "0.9, 0.10, 0.11, 0.12"
2020
Distributions = "0.25.1"
2121
PrettyTables = "3"
2222
Reexport = "1.2"
23-
ScientificTypesBase = "3.0"
23+
ScientificTypesBase = "3.1"
2424
StatisticalTraits = "3.0"
2525
Tables = "1.6.1"
2626
julia = "1.10"

docs/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
33
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
44
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
5+
ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
56
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"
67
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
78

89
[compat]
9-
Documenter = "0.25"
10-
ScientificTypesBase = "3"
10+
Documenter = "1"

docs/make.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
using Documenter, ScientificTypes, ScientificTypesBase
1+
using Documenter, ScientificTypes
2+
import ScientificTypesBase
3+
4+
const REPO = Remotes.GitHub("JuliaAI", "ScientificTypes.jl")
25

36
makedocs(
47
modules = [ScientificTypes, ScientificTypesBase],
5-
format = Documenter.HTML(
6-
prettyurls = !("local" in ARGS),
7-
),
8-
sitename = "ScientificTypes.jl",
9-
authors = "Anthony Blaom, Thibaut Lienart, and contributors.",
8+
format=Documenter.HTML(
9+
prettyurls = true,
10+
collapselevel = 1,
11+
),
1012
pages = [
1113
"Home" => "index.md",
12-
]
14+
"Reference" => "reference.md",
15+
],
16+
sitename = "ScientificTypes.jl",
17+
authors = "Anthony Blaom, Thibaut Lienart, and contributors.",
18+
warnonly = [:cross_references, :missing_docs],
19+
repo = REPO
1320
)
1421

1522
deploydocs(
16-
repo = "github.com/JuliaAI/ScientificTypes.jl",
17-
push_preview = true
23+
devbranch="dev",
24+
push_preview=false,
25+
repo="github.com/JuliaAI/ScientificTypes.jl.git",
1826
)

docs/src/index.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ ManifoldPoint{MT}
6666
Unknown
6767
```
6868

69+
For more on specific types, see the [Reference](@ref) section.
6970

7071
Additionally, we regard the Julia native types `Missing` and `Nothing`
7172
as scientific types as well.
@@ -464,11 +465,3 @@ autotype(X, only_changes=true, rules=(:discrete_to_continuous, :few_to_finite))
464465

465466
One should check and possibly modify the returned dictionary
466467
before passing to `coerce`.
467-
468-
## API reference
469-
470-
```@docs
471-
ScientificTypes.scitype
472-
coerce
473-
autotype
474-
```

docs/src/reference.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Reference
2+
3+
- [Types](@ref)
4+
- [Methods](@ref)
5+
6+
## Types
7+
8+
- [Finite](@ref)
9+
- [Multiclass](@ref)
10+
- [OrderedFactor](@ref)
11+
- [Infinite](@ref)
12+
- [Continuous](@ref)
13+
- [Count](@ref)
14+
- [Image](@ref)
15+
- [ColorImage](@ref)
16+
- [GrayImage](@ref)
17+
- [Sampleable](@ref)
18+
- [Density](@ref)
19+
- [Table](@ref)
20+
- [Textual](@ref)
21+
22+
```@docs
23+
Finite
24+
Multiclass
25+
OrderedFactor
26+
Infinite
27+
Continuous
28+
Count
29+
Image
30+
ColorImage
31+
GrayImage
32+
Sampleable
33+
Density
34+
Table
35+
Textual
36+
```
37+
38+
## Methods
39+
40+
- [scitype](@ref)
41+
- [schema](@ref)
42+
- [coerce](@ref)
43+
- [autotype](@ref)
44+
45+
```@docs
46+
scitype
47+
schema
48+
coerce
49+
autotype
50+
```

src/convention/scitype.jl

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@
77
"""
88
scitype(X)
99
10-
The scientific type (interpretation) of `X`, as distinct from its machine type. Atomic
11-
scientific types (`Continuous`, `Multiclass`, etc) are mostly abstract types defined in
12-
the package ScientificTypesBase.jl. Scientific types do not ordinarily have instances.
10+
Return the scientific type (interpretation) of `X`, as distinct from its machine
11+
type. Atomic scientific types (`Continuous`, `Multiclass`, etc) are mostly abstract types
12+
defined in the package ScientificTypesBase.jl. Scientific types do not ordinarily have
13+
instances.
14+
15+
!!! note
16+
17+
Third party packages may extend the behavior of `scitype`: Objects previously having
18+
`Unknown` scitype may no longer do so.
19+
20+
To display the active scientific type hierarchy (excluding `Missing` and `Nothing`) do
21+
`scitype()`.
1322
1423
### Examples
1524
```
@@ -32,7 +41,7 @@ Table{Union{AbstractVector{Count}, AbstractVector{Multiclass{2}}}}
3241
3342
```
3443
35-
Column scitpes of a table can also be inspected with [`schema`](@ref).
44+
Column scitypes of a table can also be inspected with [`schema`](@ref).
3645
3746
The behavior of `scitype` is detailed in the [ScientificTypes
3847
documentation](https://juliaai.github.io/ScientificTypes.jl/dev/#Summary-of-the-default-convention).
@@ -53,16 +62,21 @@ Key features of the default behavior are:
5362
`Missing`, Julia types that are also regarded as scientific.
5463
5564
65+
See also [`coerce`](@ref), [`autotype`](@ref), [`schema`](@ref).
5666
57-
!!! note
67+
"""
68+
scitype(X) = ST.scitype(X, CONV)
69+
70+
"""
71+
scitype(; io=stdout)
5872
59-
Third party packages may extend the behavior of `scitype`: Objects
60-
previously having `Unknown` scitype may no longer do so.
73+
Print to `io` the scitype hierarchy, beginning at `Found` (and so excluding `Missing` and
74+
`Nothing`).
6175
62-
See also [`coerce`](@ref), [`autotype`](@ref), [`schema`](@ref).
76+
Note that third party packages can extend the hierarchy, so output is not static.
6377
6478
"""
65-
scitype(X) = ST.scitype(X, CONV)
79+
scitype(; kwargs...) = ST.scitype(; kwargs...)
6680

6781
function ST.scitype(@nospecialize(X), C::DefaultConvention)
6882
return _scitype(X, C, vtrait(X))

test/convention/scitype.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
@testset "type hierarch display" begin
2+
str = sprint(io -> scitype(;io))
3+
# only smoke tests, to save maintenance:
4+
@test contains(str, "Found\n Known\n")
5+
@test contains(str, "Multiclass")
6+
@test contains(str, "Textual")
7+
end
8+
19
@testset "Explicit Scitype tests" begin
210
STB = ScientificTypesBase
311
ST = ScientificTypes

0 commit comments

Comments
 (0)