Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transition Pkg.TOML to stdlib/TOML #1011

Closed
2 of 5 tasks
StefanKarpinski opened this issue Jan 23, 2019 · 43 comments
Closed
2 of 5 tasks

transition Pkg.TOML to stdlib/TOML #1011

StefanKarpinski opened this issue Jan 23, 2019 · 43 comments
Labels

Comments

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Jan 23, 2019

The Pkg.TOML internal package (yes, it's in ext because it's an "external dependency") was originally based on @wildart's https://github.com/wildart/TOML.jl package. It was forked and vendored for a few of reasons: (1) @wildart got busy and wasn't merging pull requests for a while and (2) it wasn't feasible for the package manager to have an external package as a dependency and (3) I wasn't ready to deal with making it a stdlib package at the time.

It's pretty stable at this point and since the registered TOML package is long abandoned (last commit three years ago), it seems like it would be a good time to make Pkg.TOML an official stdlib package. Here is a plan to get there:

For deleting https://github.com/pygy/TOML.jl from the registry, we can just special case it to get dropped in the sync process. Since it doesn't support Julia ≥ 0.7 (or even 0.6) this shouldn't bother anyone. We should technically give this TOML a new UUID but I'm not sure it matters. The sync script may assume that it can compute stdlib UUIDs from their names somewhere, which would be broken by given the new stdlib/TOML a different UUID from the one that the old TOML already has.

@tpapp
Copy link
Contributor

tpapp commented Feb 25, 2019

I am thinking about making some PRs to https://github.com/wildart/TOML.jl (mainly for some TOML v0.5 features I want to use), but I am wondering whether I should wait with that until the merge is done. Is there an approximate timeline?

I could also help with the merge (if the issue is lack of hands, not decisions).

@StefanKarpinski
Copy link
Member Author

I don't think any further progress towards the merge has happened. It's on my todo list but not near the top, unfortunately, so any help would be greatly appreciated, as would new features :)

@tpapp
Copy link
Contributor

tpapp commented Feb 28, 2019

@wildart, @StefanKarpinski : what would be the preferred way of contributing towards a merge?

Eg PRs to Pkg.jl, or to TOML.jl?

Small incremental ones (which is what I would prefer) or larger WIP ones?

@StefanKarpinski
Copy link
Member Author

Small incremental ones

👍

@tamasgal
Copy link

tamasgal commented Mar 3, 2019

Ahm, I am a bit confused to be honest. So PRs should be make towards this repository or to Pkg.jl? I need TOML as well and consider to help out if I manage to get some free time...

@StefanKarpinski
Copy link
Member Author

Either direction is fine, just to get them to converge. You could ask for a particular change. The first step would be to look at a diff of the two packages and try to see what has even diverged.

@lewisl
Copy link
Contributor

lewisl commented Jul 18, 2019

Where does this stand at the moment? I see only the first task checked above. This looks like it is within my moderate abilities so I could contribute.

How do you suggest I start, having not worked on official packages?

  1. By forking Pkg.TOML
  2. Diffing with @wildart's latest? (seeing what's interesting...)
  3. Merging what appear to be meaningful changes?

Seems like item 2 could be done at any time--now? Who can do this
Item 3 is my item 2.
How important is it that the TOML api match the JSON api? I suppose that is anyone's reasonable opinion. At a start, why not leave as is? Both packages have really simple APIs.

Let me know: while not hugely important, this is manageable work that could get done soon.

@lewisl
Copy link
Contributor

lewisl commented Jul 18, 2019

I note that Pkg.TOML generates errors on any/all floating point values.

@StefanKarpinski
Copy link
Member Author

That would be great. I think no further work has been done on this but we still very much want it.

@lewisl
Copy link
Contributor

lewisl commented Jul 24, 2019

Update.

I have used Pkg/ext/TOML as a base rather than @wildart.TOML. This includes Kristoffer's performance work, bug fixes, updates for Julia 1.0, and previous incorporation of several of @wildart's fixes.

I diffed the 3 working files: parser.jl, print.jl, TOML.jl with the latest of @wildart. There are no functionality differences. Most changes in the Pkg version were fixes for Julia > 0.7 and improvements such as replacing abstract types with concrete types.

I reviewed the issues in Pkg pertaining to TOML and @wildart's open issues, added a couple of my own--see below.

I checked if Pkg.TOML supports TOML 0.4. Thanks to @wildart and Kristoffer's improvements, it does.

I made slight changes to the code to simplify it with no functional changes except one bug fix (floating point numbers work). All tests pass, noting that the Pkg tests and @wildart tests might not have been converged yet.

Is this worth a pull request and moving to stdlib? Look at the outstanding issues and tell me if they should be addressed.

Issues review:

Pkg#1010, #1012   floating point numbers not read--errors out.  FIXED
?           can't print TOML with dict keys that are symbols:   SEEMS WORTH FIXING
Pkg#934     write TOML files with \r\n line endings on Windows:  NEED TO TEST
                    note: parse works now with \n or \r\n (TOML v 0.4 feature)
      test on Windows:  MILD NUISANCE BUT I WILL DO
      test on Julia = 0.7 <= version < 1.1.0: YOU GUYS WOULD KNOW IF SAFE
           TO RELY ONLY ON TESTING ON V 1.1.0
?     TOML.parse reads empty sections (tables)->creates Dict{String, Any}()
       which is valid;  TOML.print ignores empty Dict and creates NO 
       section--also valid;  do we care this is slightly inconsistent?   I'd say not...
?      did not converge test cases between Pkg.TOML and @wildart: WILL LOOK
other   requests for TOML version 0.5 features: per @StefanKarpinski's inclination
            to proceed in small increments:                 DEFER

@lewisl
Copy link
Contributor

lewisl commented Jul 24, 2019

Fixed: use symbols as keys in a Dict and TOML.print outputs unquoted keys in the TOML output.
Added suitable test case.

@fredrikekre
Copy link
Member

Nice!
I git-filtered ext/TOML to this repo: https://github.com/JuliaStdlibs/TOML.jl so maybe we can work there and then transfer that to be a real stdlib.

@lewisl
Copy link
Contributor

lewisl commented Jul 26, 2019

I will submit a pull request for the changes I've made. I added a test for Dict with symbol keys printed to TOML. Existing tests already covered floating point values. As noted, all the tests pass.

This is the first time I've done this: DO point out what I've done wrong. I am sure I made a mistake in runtests.jl. I was loading into the REPL and had the expected name space problem so I changed both the way I use Pkg.TOML and changed a test that functionally passed, but was tripped up by name space collision between Pkg.TOML and base.TOML. This may prevent the revised tests from running. Send me the correction and suggestions.

@lewisl
Copy link
Contributor

lewisl commented Jul 27, 2019

Sorry for the past mess. Much progress.
Latest pull request should be much cleaner.

  1. My local environment installed @wildart.TOML. When I ran tests, I included my fork of Pkg/ext/TOML, and the import imported @wildart. That is why I saw the tests all pass: I was testing a horrible blend of both modules. I rm'ed @wildart.TOML.
  2. I removed TOML.get(... from the tests as I remove that method from the code.
  3. I added the fork to my LOAD_PATH so I could drop the include. The name of the module is no longer mangled with a dot, which had caused tests on type TOML.Table to fail (I had hacked the tests). I set these back as the original file defined these tests. isa(foo, TOML.Table). These pass.
  4. I added 4 tests that @wildart included which were not in Pkg/ext/TOML/test.
  5. I run the tests as you prescribed with these results:
julia> import Pkg; Pkg.test()
   Testing TOML
 Resolving package versions...
Test Summary: | Pass  Total
TOML          |  252    252
   Testing TOML tests passed 

Note: there are now 252 tests. I could not locate the test file you also ran containing 130 or so tests. This must be from the old version of TOML carried around as part of Base??? I think this is accessible in Travis, but I could not find it (even though I enrolled in Travis).

I hope that Pkg/ext/TOML/test/runtests.jl should do much better in Travis now.

If you point me to the other test file I can either add it as a second test file (which might break the workflow) or--better--add those tests which are not duplicates. Note that the older tests will still reference the method TOML.get.

Note there were 2 ways to fix the floating point value bug: either import Base: get so that TOML could add a method. Or get rid of the TOML.get method and then the import is unnecessary. I did the latter.

@00vareladavid
Copy link
Contributor

I think #1302 should take care of the second TODO.

And does #1272 satisfy the third TODO?

@KristofferC
Copy link
Member

I think so, yes.

@scottstanie
Copy link

If I were to try to add a small feature to the TOML parser (the ability to parse simply mydate = 2019-01-01), should I add that here? to https://github.com/wildart/TOML.jl ? or https://github.com/JuliaStdlibs/TOML.jl ?

@wildart
Copy link
Member

wildart commented Sep 24, 2019

PR to JuliaStdlibs/TOML. Added the deprecation message to wildart/TOML.

@Nosferican
Copy link
Contributor

Is this Julia v1.4 milestone or when should the move be expected?

@StefanKarpinski
Copy link
Member Author

When someone does it. Unfortunately, no one has had the bandwidth to work on it.

@Nosferican
Copy link
Contributor

  • The second item has already been ✅ and can be checked off.
  • I am not sure about the status of three... @wildart, are there any improvements that haven't been ported to the Pkg/ext/TOML?
  • I can check if there are API issues that might be desirable to address before porting it out.

@ziotom78
Copy link

PR to JuliaStdlibs/TOML. Added the deprecation message to wildart/TOML.

Has the repo https://github.com/JuliaStdlibs/TOML.jl been moved elsewhere? I get 404.

@fredrikekre
Copy link
Member

Yea, I deleted it.

@ekmecic
Copy link

ekmecic commented Jan 18, 2020

Where can it be found now?

@tpapp
Copy link
Contributor

tpapp commented Jan 25, 2020

So PRs for TOML.jl this should go to this repository?

@lewisl
Copy link
Contributor

lewisl commented Jan 27, 2020

  • The second item has already been ✅ and can be checked off.
  • I am not sure about the status of three... @wildart, are there any improvements that haven't been ported to the Pkg/ext/TOML?
  • I can check if there are API issues that might be desirable to address before porting it out.

When I updated Pkg/ext/TOML I diffed with @wildart version and there were no functional differences. Seems like the meaningful improvements would be moving to TOML 5.0. One of the official maintainers should decide if it will move to stdlib or stay with Pkg. I am willing then to start on TOML 5.0 with anyone who would like to chip in.

@tpapp
Copy link
Contributor

tpapp commented Jan 27, 2020

I would still like to help out. I hope that TOML will be excised to stdlib for 1.5, would be easier to contribute. The full test suite suite ensure that it keeps working for Pkg.

@KristofferC
Copy link
Member

KristofferC commented Jan 27, 2020

There is nothing technical blocking this from happening. The wildart TOML and the TOML here should be merged (they might already be pretty much identical), the API should be audited to make sure it looks good (look at how JSON.jl) do it, and then make it an stdlib and then make a PR to Pkg to use the TOML stdlib instead.

@StefanKarpinski
Copy link
Member Author

StefanKarpinski commented Jan 27, 2020

Since we're moving towards vendoring things that Pkg depends on, we should do that here as well. I.e. set it up so that Pkg depends on a snapshot of the official TOML package rather than making TOML a stdlib. I'm happy to do that if someone else gets things to the point where wildart/TOML.jl and this TOML are identical.

@lewisl
Copy link
Contributor

lewisl commented Jan 27, 2020 via email

@StefanKarpinski
Copy link
Member Author

@wildart/TOML.jl is the registered TOML package. Pkg.TOML is strictly internal to Pkg and should not be depended on by external code, although I have no doubt that it is being used. There's no reason to create a new TOML package, just converge these two and then we can start using a snapshot of @wildart/TOML.jl from Pkg.

@tpapp
Copy link
Contributor

tpapp commented Jan 27, 2020

OTOH https://github.com/wildart/TOML.jl says that

This package is no longer maintained. It is superseded by a standard library package JuliaStdlibs/TOML.

which was created, then deleted for reasons I that are not clear to me.

This is somewhat confusing.

@StefanKarpinski
Copy link
Member Author

@wildart, could you make me an owner of your TOML.jl repo so I can transfer it to an appropriate org and we can reinstate it as the official and maintained TOML package?

@wildart
Copy link
Member

wildart commented Jan 29, 2020

@StefanKarpinski I added you as a collaborator. I tried to transfer ownership to you, but couldn't because you already have your own TOML.jl repo. Do you want me to transfer this repo to other organization?

@fredrikekre
Copy link
Member

fredrikekre commented Jan 29, 2020

We could just push your repo to JuliaLang/TOML.jl. Edit: Unless we care about GitHub automatic redirects etc.

@StefanKarpinski
Copy link
Member Author

@wildart, I think I need to be an admin on the repo in order to transfer it.

@fredrikekre
Copy link
Member

fredrikekre commented Jan 29, 2020

You can't be an admin on a personal account, you are either the owner (wildart in this case) or a collaborator (https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/permission-levels-for-a-user-account-repository).

To make this transfer possible I believe wildart needs elevated permissions in the JuliaLang org.

@StefanKarpinski
Copy link
Member Author

@wildart, you should already have permission to create repos on JuliaLang and therefore be able to transfer the repo.

@wildart
Copy link
Member

wildart commented Jan 29, 2020

Done. It's JuliaLang/TOML.jl now.

@lewisl
Copy link
Contributor

lewisl commented Jan 29, 2020 via email

xlxs4 added a commit to unhoop/DotfileManager.jl that referenced this issue May 24, 2020
* Use [`SafeTestsets.jl`](https://github.com/YingboMa/SafeTestsets.jl)to put all `@testset`s into a separate module,
  with a name generated by `gensym()`. Added as an `extra` dep, only
  downloaded when `test`ing
* Added [`ArgParse.jl`](https://github.com/carlobaldassi/ArgParse.jl) and the [(currently internal)](JuliaLang/Pkg.jl#1011) [`TOML.jl`](https://github.com/JuliaLang/TOML.jl). Showcasing trivial functionality and project structure
@fredrikekre
Copy link
Member

Done.

@lewisl
Copy link
Contributor

lewisl commented Aug 27, 2020 via email

@KristofferC
Copy link
Member

Does this include the fixes for values that are floating point

I don't know which one that is.

generating TOML from a Julia dict using a symbol key?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests