You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maturing out the package (Path to DataStructures.jl v1.0) #479
What do we need to do before we would be happy to tag DataStructures.jl v1.0?
I mean, we are one of the most common dependencies in the package ecosystem,
and julia 1.0 is out.
Maybe split up the package Split up the package? #310, but noting that all the packages sliced out that way will want to hit 1.0 before (or at the same time as) DataStructures.jl does.
It hurts people when we break things, and while we are good at deprecating,
getting on the the "strict" side of semver is something we need to do for the sake of the ecosystem
Reacted by Nick Robinson, Atsushi Sakai, David P. Sanders, Benoît Legat, Nathan Daly, Haoran Ni, Jonas Schulze, Andrés Riedemann, Yuto Horikawa and Páll Haraldsson
People keep asking when will DataStructures 1.0 come out.
The answer is as soon as we completely audit the package to make sure there is nothing that needs to be removed/corrected to follow modern julia conventions.
And have actioned those corrections.
A lot of the code in the package is pretty old, and follows e.g. conventions from julia 0.3.
We need to identify and correct these.
I will post a list of files at the bottom of this post.
Then people can go through this and use the checklist to make sure everything is good, one file at a time.
How to audit a file to check if 1.0 ready
Answer the question of should we even keep this in the package. E.g. no data structure that somone just kind of made up (like the now removed `Classifier Collection). If ours is is a worse version of something in another package it should also go.
Type Names Correct/Sensible: for example make sure we don't have a type called MagicVectors that is a subtype of vector. That should be called MagicVector (singular).
No constructors taking types as positional arguments. For example there should not be MagicVector(::Type{T}) where T, instead there should just be MagicVector{T}().
No functions that duplicate constructors. For example there should not be a function magic_vector(xs), only MagicVector(xs).
No functions that are improperly cased and pretend to be constructors.
E.g. no MagicVector(xs) = Vector(xs) .* "Magic", that should just be a normal function magic_vector(xs) = Vector(xs) .* "Magic"
E.g. no MagicVector(xs)=Vector{Magic}(xs), that should be a const type alias const MagicVector=Vector{Magic}
No exported functions that could be just done with overloads of Base. E.g. don't need top, peak, head all of which act the same as first but on a particular data structure.
No internal helpers exported. If something isn't useful to the end user it should not be exported. In general The vast majority of the public API should be constructor or overloads of Base functions. Thus any export should be looked at closely.
Correct return typespush! and empty! and delete! should return the collection. (this is relatively minor as it would be a bug if they didn't so it isn't breaking for use to fix it later.)
No defining methods in ways that disagree with Base: for example because Base has insert!(xs, index, value) we should not have no instert!(xs, val) (push! is for that). Conversely we should not have push!(xs, key, value) ( we dio both of these right now in various trees, and in accumulators respectively)
All these things are things that have changed during the life-time of this package.
List of files that need to be checked
(Checking each will also require checking the top-level file for relevant exports)
accumulator.jl
default_dict.jl
robin_dict.jl
dict_support.jl
trie.jl
balanced_tree.jl
circ_deque.jl
circular_buffer.jl
dibit_vector.jl
disjoint_set.jl
fenwick.jl
int_set.jl
sparse_int_set.jl
list.jl
multi_dict.jl
mutable_list.jl
deque.jl
queue.jl
stack.jl
sorted_dict.jl
sorted_multi_dict.jl
sorted_set.jl
tokens.jl
tokens2.jl
priorityqueue.jl
heaps.jl
heaps/arrays_as_heaps.jl
heaps/binary_heap.jl
heaps/minmax_heap.jl
heaps/mutable_binary_heap.jl
container_loops.jl
delegate.jl
Many of these should be easy, because they have kind of already been done.
E.g. Heaps were done for 0.18; robindict was created after julia 1.0 and so should follow conventions.
But lets get them all and check them off using the list criteria listed above.
Higher level process:
0.19 will be the last release before 1.0.
0.19 will be the same as 1.0 but with deprecations.
1.0 will come out the same day as 0.19
We will stick to making patch releases on 0.18 with deprecations while we can.
But once we can't we will swap master to 0.19-DEV, and say on that until we can release it and 1.0.
That might take a 6 or more months; depends how many (if any) people are about to spend time helping with the audit.
If necessary we will have a backport branch for 0.18 bug-fixes
Once @eulerkochy's GSOC work is complete we will not accept any new data structures until after 1.0 released.
If anyone want to help out, please feel strongly encouraged to do so.
Reacted by Koustav Chowdhury, Yakir Luc Gagnon, Tim Holy, Dillon Daudert, Nathan Daly, Dilum Aluthge, Nick Robinson, Sascha Mann and Yuto Horikawa
No exported functions that could be just done with overloads of Base
How about reverse_iter? Can this just be Iterators.reverse? The only issue i see is that reverse_iter(s::Stack) returns a DequeIterator, not a Iterators.Reverse, but idk if Iterator's API is really supposed to guarantee Iterators.reverse(::T) -> Iterators.Reverse{T} or not. (edit: no it's not, that's why we have reverse, rather than just Reverse, so we don't have to guarantee returning a Reverse)
Could anyone explain in more detail the above-mentioned recommendation regarding the insert! function? In particular, does the recommendation mean that insert!(ss, k), where ss is a SortedSet and k is a new key, should be deprecated? Note that push! does not replicate this functionality because insert!(ss,k) returns a bool to indicate whether the item was already present and a semitoken indexing the newly inserted item, whereas push!(ss,k) returns the container.
Could anyone explain in more detail the above-mentioned recommendation regarding the insert! function?
Base defines insert! as:
insert!(a::Vector, index::Integer, item)
Insert an item into a at the given index. index is the index of item in the resulting a.
and it returns the collection.
In particular, does the recommendation mean that insert!(ss, k), where ss is a SortedSet and k is a new key, should be deprecated?
yes, it doesn't match the description of the Base function.
Note that push! does not replicate this functionality because insert!(ss,k) returns a bool to indicate whether the item was already present and a semitoken indexing the newly inserted item, whereas push!(ss,k) returns the container.
Yeah, so in that case we can't deprecate it for push!.
We would need to make some other plan.
Like st_push! or something? or a submodule that defines a bunch of function names for things that return subtokens?
Maybe a case could be made for push!(::Type(SemiToken),::SortedSet, x) or something?
Here is a more serious conflict with Base: according to the Base docs, pop!(s) is supposed to return the last item in s if s is an ordered collection. However, pop! on the sorted containers currently returns the first item. Which is the lesser of two evils, a breaking change for the package or doing the opposite of the Base documentation?
Maybe deprecate pop!(s) for sorted containers to popfirst!(s), and introduce new functionality poplast!(s) (the latter not present in Base)? Then, several years in the future, deprecate poplast!(s) to just pop!(s)?
Maybe deprecate pop!(s) for sorted containers to popfirst!(s), and introduce new functionality poplast!(s) (the latter not present in Base)? Then, several years in the future, deprecate poplast!(s) to just pop!(s)?
yeah this, sounds right.
but I would argue for putting a deprecation warning in poplast! in 0.19 as it is defined saying this will just be pop! in 1.0, which will be released not years in the future but rather days.
Doesn't this approach for deprecating pop!(s) mean that everyone who upgrades from 0.18 to 1.0, skipping 0.19, will encounter a breaking change that is also silent?
With regard to renaming insert!: since insert! currently has a different API for each of the three containers, how about if we choose the three names ss_push!, sd_push! and smd_push! ?
Doesn't this approach for deprecating pop!(s) mean that everyone who upgrades from 0.18 to 1.0, skipping 0.19, will encounter a breaking change that is also silent?
yes, that is what they get for skipping versions. But we will write release notes etc.
With regard to renaming insert!: since insert! currently has a different API for each of the three containers, how about if we choose the three names ss_push!, sd_push! and smd_push! ?
Lets split this off to another issue or a PR and we can think about our options.
OK. I am currently working on a major overhaul of the sorted containers to address a number of open issues at once. I will include these new names in my forthcoming PR; and then you or another reviewer can comment on them.
You went from v0.12 to v0.18 in the span of 2 years (some of those shouldn't've been marked as breaking probably?), and now this one is 5 years in the making. There's a middle ground.
I would generally support taking the plunge and getting master release as 1.0...
Except that of course due to semver's limitation it will probably be a long and arduous treck to get everyone switched to 1.0: Essentially for package like this with soooo many other package depending on it, a breaking release risks re-creating the python 2->3 problem each time.
To avoid this, I think the most critical bit are thorough release notes that describe what exactly are the breaking changes, ideally including recipes for how to deal with them.
And possibly encouraging downstream packages (i.e. packages depending on DataStructures.jl) to try and support both 0.18.x and 1.0.x in parallel, at least for a while, to minimize suffering ("my dependency A still requires DS 0.18, but dependency B only support DS 1.0, so I need to keep B at an older version until they change that").
Reacted by Stefan Krastanov, Eric Hanson, Azamat Berdyshev, Craig Fratrik and Páll Haraldsson
Can we tag a new release of DataStructures.jl? I need to use a non-string version of the Tries, which has been added ~4 years ago, but it is still not in the latest version for some reason. It does not need to be 1.0. It can be just 0.19 or something.
semver will also treat this as breaking, so I don't see any advantage in marking a new release as 0.19 vs. 1.0. Whereas 1.0 has the advantage of providing strictly more information to downstream users for subsequent 1.x.y releases.
670 packages already depend on this package. Not using 1.x releases actively harms their ability to keep up with non-breaking updates.
There was a plan with @oxinabox regarding the corner of this package that I maintain (the sorted containers) to, in one release, deprecate some of the functionality that corresponds to Base functionality but with different names or API details, and then, in a subsequent release, drop those inconsistent names or APIs entirely. See: #787 This conversation took place three years ago, so my recollection is a bit fuzzy.
Reacted by Frames White, Azamat Berdyshev and Craig Fratrik
If you prepare a release branch, that probably would happen, but a volunteer needs to do the work. My guess is that:
if you backport non-breaking stuff to 0.18 and prepare a branch with what you need, a release will be done without much discussion
if you finish all of the work required for a 1.0 (a lot of work!!!) a release will be done without too much discussion (but with a lot of praise from the rest of the community)
if you want a breaking release of what is basically the current state of the repo, that would not be much work. However, reading through this thread there might be some opposition to this approach (although I would be on favor)
The main thing that is lacking is someone to do the work in all of these cases.
Honestly i am infavor of option 3.
But yes it is just lacking someone to do that work.
E.g. even for 3 we would want to prep some release notes,
and at this point it would require detective work.
Re: point 1.
Most of the non-breaking stuff has been backported to the 0.18.
I have been fairly diligent about that.
I see lots of support for my #946 (mostly redundant issue with later discussion here like): #479 (comment)
In short I feel 1.0 needs not be fully mature, but if people are hesitant of 1.0 right now, pushing it off for more years, potentially, because something is less perfect, can those datastructures be moved to UnstableDataStructures.jl with pre-1.0 version number that depends on this new 1.0 (since a breaking version number, dropping those lesser used/developed ones)?
We put off making breaking changes for 5 years.
And the vast majority of the changes were backwards compatible deprecations.
I think we did also delete some things that were deprecated sveral years ago.
So the reason this hasn't made much progress in last 7 years , despite the fact that is the plan is fairly straight forward.
But actually doing it requires 2 or 3 people to sit down who really care to do it, and the review each other's code.
I made a start in #837
but felt like i didn't get enough feedback to really come to conclusion on what is best.
Finding 2-3 people who really care and getting them to dedicate a week to this is hard. I certainly have better things to do with my time.
Activity
oxinabox commentedon Aug 28, 2020
People keep asking when will DataStructures 1.0 come out.
The answer is as soon as we completely audit the package to make sure there is nothing that needs to be removed/corrected to follow modern julia conventions.
And have actioned those corrections.
A lot of the code in the package is pretty old, and follows e.g. conventions from julia 0.3.
We need to identify and correct these.
I will post a list of files at the bottom of this post.
Then people can go through this and use the checklist to make sure everything is good, one file at a time.
How to audit a file to check if 1.0 ready
MagicVectorsthat is a subtype of vector. That should be calledMagicVector(singular).MagicVector(::Type{T}) where T, instead there should just beMagicVector{T}().magic_vector(xs), onlyMagicVector(xs).MagicVector(xs) = Vector(xs) .* "Magic", that should just be a normal functionmagic_vector(xs) = Vector(xs) .* "Magic"MagicVector(xs)=Vector{Magic}(xs), that should be aconsttype aliasconst MagicVector=Vector{Magic}Base. E.g. don't needtop,peak,headall of which act the same asfirstbut on a particular data structure.Basefunctions. Thus any export should be looked at closely.push!andempty!anddelete!should return the collection. (this is relatively minor as it would be a bug if they didn't so it isn't breaking for use to fix it later.)insert!(xs, index, value)we should not have noinstert!(xs, val)(push!is for that). Conversely we should not havepush!(xs, key, value)( we dio both of these right now in various trees, and in accumulators respectively)All these things are things that have changed during the life-time of this package.
List of files that need to be checked
(Checking each will also require checking the top-level file for relevant exports)
Many of these should be easy, because they have kind of already been done.
E.g. Heaps were done for 0.18; robindict was created after julia 1.0 and so should follow conventions.
But lets get them all and check them off using the list criteria listed above.
Higher level process:
0.19 will be the last release before 1.0.
0.19 will be the same as 1.0 but with deprecations.
1.0 will come out the same day as 0.19
We will stick to making patch releases on 0.18 with deprecations while we can.
But once we can't we will swap master to 0.19-DEV, and say on that until we can release it and 1.0.
That might take a 6 or more months; depends how many (if any) people are about to spend time helping with the audit.
If necessary we will have a backport branch for 0.18 bug-fixes
Once @eulerkochy's GSOC work is complete we will not accept any new data structures until after 1.0 released.
If anyone want to help out, please feel strongly encouraged to do so.
nickrobinson251 commentedon Aug 30, 2020
How about
reverse_iter? Can this just beIterators.reverse? The only issue i see is thatreverse_iter(s::Stack)returns aDequeIterator, not aIterators.Reverse, but idk if Iterator's API is really supposed to guaranteeIterators.reverse(::T) -> Iterators.Reverse{T}or not. (edit: no it's not, that's why we havereverse, rather than justReverse, so we don't have to guarantee returning aReverse)nickrobinson251 commentedon Sep 4, 2020
I think this suggests we should make a call on which side this falls: #296
Add Queue `show` method to hide backing Deque
StephenVavasis commentedon Dec 31, 2021
Could anyone explain in more detail the above-mentioned recommendation regarding the
insert!function? In particular, does the recommendation mean thatinsert!(ss, k), where ss is a SortedSet and k is a new key, should be deprecated? Note thatpush!does not replicate this functionality becauseinsert!(ss,k)returns a bool to indicate whether the item was already present and a semitoken indexing the newly inserted item, whereaspush!(ss,k)returns the container.oxinabox commentedon Jan 11, 2022
Base defines
insert!as:and it returns the collection.
yes, it doesn't match the description of the Base function.
Yeah, so in that case we can't deprecate it for
push!.We would need to make some other plan.
Like
st_push!or something? or a submodule that defines a bunch of function names for things that return subtokens?Maybe a case could be made for
push!(::Type(SemiToken),::SortedSet, x)or something?StephenVavasis commentedon Jan 12, 2022
Here is a more serious conflict with
Base: according to the Base docs,pop!(s)is supposed to return the last item insifsis an ordered collection. However,pop!on the sorted containers currently returns the first item. Which is the lesser of two evils, a breaking change for the package or doing the opposite of theBasedocumentation?StephenVavasis commentedon Jan 12, 2022
Maybe deprecate
pop!(s)for sorted containers topopfirst!(s), and introduce new functionalitypoplast!(s)(the latter not present in Base)? Then, several years in the future, deprecatepoplast!(s)to justpop!(s)?oxinabox commentedon Jan 12, 2022
yeah this, sounds right.
but I would argue for putting a deprecation warning in
poplast!in 0.19 as it is defined saying this will just bepop!in 1.0, which will be released not years in the future but rather days.StephenVavasis commentedon Jan 12, 2022
Doesn't this approach for deprecating
pop!(s)mean that everyone who upgrades from 0.18 to 1.0, skipping 0.19, will encounter a breaking change that is also silent?With regard to renaming
insert!: sinceinsert!currently has a different API for each of the three containers, how about if we choose the three namesss_push!,sd_push!andsmd_push!?oxinabox commentedon Jan 12, 2022
yes, that is what they get for skipping versions. But we will write release notes etc.
Lets split this off to another issue or a PR and we can think about our options.
StephenVavasis commentedon Jan 12, 2022
OK. I am currently working on a major overhaul of the sorted containers to address a number of open issues at once. I will include these new names in my forthcoming PR; and then you or another reviewer can comment on them.
6 remaining items
ChrisRackauckas commentedon Sep 2, 2024
You went from v0.12 to v0.18 in the span of 2 years (some of those shouldn't've been marked as breaking probably?), and now this one is 5 years in the making. There's a middle ground.
fingolfin commentedon Mar 17, 2025
I would generally support taking the plunge and getting master release as 1.0...
Except that of course due to
semver's limitation it will probably be a long and arduous treck to get everyone switched to 1.0: Essentially for package like this with soooo many other package depending on it, a breaking release risks re-creating the python 2->3 problem each time.To avoid this, I think the most critical bit are thorough release notes that describe what exactly are the breaking changes, ideally including recipes for how to deal with them.
And possibly encouraging downstream packages (i.e. packages depending on DataStructures.jl) to try and support both 0.18.x and 1.0.x in parallel, at least for a while, to minimize suffering ("my dependency A still requires DS 0.18, but dependency B only support DS 1.0, so I need to keep B at an older version until they change that").
AzamatB commentedon Mar 23, 2025
Can we tag a new release of DataStructures.jl? I need to use a non-string version of the Tries, which has been added ~4 years ago, but it is still not in the latest version for some reason. It does not need to be 1.0. It can be just 0.19 or something.
oxinabox commentedon Mar 24, 2025
We probably should. It would have been nice to hold off to proper 1.0 was ready but it isn't going to happen anytime soon.
Maybe just 0.19
jonas-schulze commentedon Mar 24, 2025
See #769
AzamatB commentedon Mar 24, 2025
Can we get #933 merged before tagging the new release?
stevengj commentedon Mar 26, 2025
semver will also treat this as breaking, so I don't see any advantage in marking a new release as 0.19 vs. 1.0. Whereas 1.0 has the advantage of providing strictly more information to downstream users for subsequent 1.x.y releases.
670 packages already depend on this package. Not using 1.x releases actively harms their ability to keep up with non-breaking updates.
StephenVavasis commentedon Mar 30, 2025
There was a plan with @oxinabox regarding the corner of this package that I maintain (the sorted containers) to, in one release, deprecate some of the functionality that corresponds to Base functionality but with different names or API details, and then, in a subsequent release, drop those inconsistent names or APIs entirely. See: #787 This conversation took place three years ago, so my recollection is a bit fuzzy.
AzamatB commentedon Jul 15, 2025
Can we please tag a new release of DataStructures.jl?
I don't care if it's v. 0.19 or v. 1.0 at this point...
Krastanov commentedon Jul 15, 2025
If you prepare a release branch, that probably would happen, but a volunteer needs to do the work. My guess is that:
The main thing that is lacking is someone to do the work in all of these cases.
oxinabox commentedon Jul 16, 2025
Honestly i am infavor of option 3.
But yes it is just lacking someone to do that work.
E.g. even for 3 we would want to prep some release notes,
and at this point it would require detective work.
Re: point 1.
Most of the non-breaking stuff has been backported to the 0.18.
I have been fairly diligent about that.
stevengj commentedon Jul 16, 2025
Yes, please just make a release from the current repo state, and call it 1.0 for the reasons noted above.
PallHaraldsson commentedon Aug 3, 2025
I see lots of support for my #946 (mostly redundant issue with later discussion here like):
#479 (comment)
In short I feel 1.0 needs not be fully mature, but if people are hesitant of 1.0 right now, pushing it off for more years, potentially, because something is less perfect, can those datastructures be moved to UnstableDataStructures.jl with pre-1.0 version number that depends on this new 1.0 (since a breaking version number, dropping those lesser used/developed ones)?
oxinabox commentedon Aug 4, 2025
We put off making breaking changes for 5 years.
And the vast majority of the changes were backwards compatible deprecations.
I think we did also delete some things that were deprecated sveral years ago.
oxinabox commentedon Jun 26, 2026
So the reason this hasn't made much progress in last 7 years , despite the fact that is the plan is fairly straight forward.
But actually doing it requires 2 or 3 people to sit down who really care to do it, and the review each other's code.
I made a start in #837
but felt like i didn't get enough feedback to really come to conclusion on what is best.
Finding 2-3 people who really care and getting them to dedicate a week to this is hard.
I certainly have better things to do with my time.