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

Merge wkt repository with history as /wkt dir #785

Closed
wants to merge 240 commits into from
Closed

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Mar 19, 2022

If we agree to merge this, the wkt repo should be archived, and all issues should be moved to this repo. I believe it would be good to merge it here because:

  • geo-test-fixtures requires wkt, and wkt requires geo-types - creating a circular dependency between two repos, making development more complicated and error-prone
  • this is a commonly used geo feature
  • this is a pure Rust lib

This merges the entire history of the wkt repository from

https://github.com/georust/wkt/tree/dbd80f22099fc11ad69a1d072c3516f9a1ca4376

as a /wkt directory, and adds the CI and adds path links from Crates.toml files:

  • wkt/Cargo.toml - link to /geo-types
  • geo-test-fixtures/Cargo.toml - link to /wkt

  • I agree to follow the project's code of conduct.
    - [ ] I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

bors bot and others added 8 commits February 24, 2022 18:35
79: BREAKING: move `Wkt::from_str` to `FromStr` trait r=urschrei a=nyurik

Most of the user's code will stay the same, but will require `use std::str::FromStr;`

See also discussion in georust#77 

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---



Co-authored-by: Yuri Astrakhan <[email protected]>
In order to auto-catch bugs and code quality,
adding clippy and fmt to CI (same as geo)
80: Fix bench build bug, added CI lints r=lnicola a=nyurik

In order to auto-catch bugs and code quality,
adding clippy and fmt to CI (same as geo)

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
- ~[ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.~
---



Co-authored-by: Yuri Astrakhan <[email protected]>
77: Prepare for 0.10.0 release r=urschrei a=urschrei

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---



Co-authored-by: Stephan Hügel <[email protected]>
81: Remove authors manifest field r=nyurik,urschrei a=lnicola

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
- [ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---

r? `@nyurik` 

Co-authored-by: Laurențiu Nicola <[email protected]>
@urschrei
Copy link
Member

Why do you want to do this?

@nyurik
Copy link
Member Author

nyurik commented Mar 19, 2022

@urschrei I updated the top comment with the explanation -- mostly because there is a circular dependency between geo and wkt repos, and developing them in sync is becoming complicated. Currently i have to maintain a separate wkt fork just to get my changes to the geo repo to compile (which obviously cannot be merged as is, so may require some more contortions in the future)

This merges the entire history of the wkt repository from

https://github.com/georust/wkt/tree/dbd80f22099fc11ad69a1d072c3516f9a1ca4376

as a `/wkt` directory, and adds the CI and adds path links from Crates.toml files:
* wkt/Cargo.toml - link to `/geo-types`
* geo-test-fixtures/Cargo.toml - link to `/wkt`
@frewsxcv
Copy link
Member

How does moving the wkt crate into this repository solve the circular dependency problem?

I'd consider this to be a rather large change to this repository and the wkt repository. In the future, can you open a GitHub Issue or start a GitHub Discussion so we can discuss whether we even want them before reviewing any code?

@nyurik
Copy link
Member Author

nyurik commented Mar 22, 2022

@frewsxcv sure thing, will do. I thought that since PR and issues are nearly identical in terms of discussion, and it was fairly simple to create this PR to see the code changes if we wanted to, while we can discuss it as if it was an issue.

Moving WKT does not solve circular dependency. What it does is it brings all components of the circular dependency into a single repo with a single CI. When a breaking change must be made to both modules, it can be done with a single PR.

Having two repos forces us to go through this process:

  • create a PR for geo repo
  • ignore geo CI errors and merge + publish it
  • create a PR for wkt
  • now wkt should pass CI since geo is already published, so merge+publish
  • expect the geo to start passing CI again

P.S. alternatively we can always use wkt = { git = "https://github.com/georust/wkt", branch = "some-fork" } which is kinda ugly. Note that it should not be a revision because revision implies part of the main tree, whereas wkt change must not be merged until geo is merged. This is workable if you really don't think wkt should not be part of the core libs, but would mean merging geo that relies on non-merged wkt.

@rmanoka
Copy link
Contributor

rmanoka commented Mar 22, 2022

@nyurik can you explain this part more?

ignore geo CI errors and merge + publish it

Why ignore CI?

@nyurik
Copy link
Member Author

nyurik commented Mar 22, 2022

@nyurik can you explain this part more?

ignore geo CI errors and merge + publish it
Why ignore CI?

There are two types of changes: those that can be done in steps, e.g. merge and release #786 that introduces MultiPolygon::new() and similar. Once published, wkt repo can be changed to use the new methods, another release of wkt, and only then can geo continue with the breaking change.

There are also breaking changes which cannot IMO be done -- CI would not pass if geo repo introduces PointTZM - because the matching below wouldn't work

-/// assert!(matches!(my_type.geometry, Some(Point(_))));
+/// assert!(matches!(my_type.geometry, Some(PointTZM(_))));

Granted that there are very few of these, and in most cases they can be worked around, i.e. unit test in the doc can be removed, and a new wkt version would be released without that test, but this is no different than simply disabling certain parts of the CI during the migration, and re-enabling it later.

@lnicola
Copy link
Member

lnicola commented Mar 22, 2022

This isn't a circular dependency. geo-test-fixtures is a dev-dependency of geo, and uses wkt without the geo-types feature. Unless I'm missing something, we should be able to keep using whatever wkt version for reading the test fixtures.

@nyurik
Copy link
Member Author

nyurik commented Mar 22, 2022

This isn't a circular dependency. geo-test-fixtures is a dev-dependency of geo, and uses wkt without the geo-types feature. Unless I'm missing something, we should be able to keep using whatever wkt version for reading the test fixtures.

It's a circular dependency in terms of passing ci. See my comment above

@rmanoka
Copy link
Contributor

rmanoka commented Mar 22, 2022

I'm also not convinced yet, that this break CI. @nyurik can you point us to where this line you pasted above is:

assert!(matches!(my_type.geometry, Some(Point(_))));

I'm inclined against this PR, and in general pro-actively merging repos. If anything, we should see a couple of PRs that do break CI due to circular deps, and try out the alternative / more cumbersome workflow before taking a call on this (imho).

@lnicola
Copy link
Member

lnicola commented Mar 22, 2022

It's a circular dependency in terms of passing ci. See my comment above

I don't understand -- why does wkt care about how to instantiate MultiPolygon? It depends on an older version of geo-types (without new) and that code is feature-gated anyway.

@nyurik
Copy link
Member Author

nyurik commented Mar 22, 2022

I'm also not convinced yet, that this break CI. @nyurik can you point us to where this line you pasted above is:

assert!(matches!(my_type.geometry, Some(Point(_))));

I'm inclined against this PR, and in general pro-actively merging repos. If anything, we should see a couple of PRs that do break CI due to circular deps, and try out the alternative / more cumbersome workflow before taking a call on this (imho).

@rmanoka see https://github.com/georust/wkt/pull/85/files#diff-0fb2eeea3273a4c9b3de69ee949567f546dc8c06b1e190336870d00b54ea0979R140

I created two PRs to demonstrate the difficulty of introducing any breaking changes that affect wkt -- see #790 and georust/wkt#85

@nyurik
Copy link
Member Author

nyurik commented Apr 5, 2022

@nyurik nyurik closed this Apr 5, 2022
@lnicola
Copy link
Member

lnicola commented Apr 5, 2022

lnicola proposed workaround

Just to be clear, that's not the solution I proposed. My suggestion was to skip geo-types when deserializing the WKT.

@nyurik
Copy link
Member Author

nyurik commented Apr 5, 2022

@lnicola in that case I must have misunderstood your idea - i thought you meant conversion of old geo-types to the new ones. Could you sketch a prototype of your idea?

@nyurik nyurik deleted the wkt branch April 5, 2022 15:05
@lnicola
Copy link
Member

lnicola commented Apr 5, 2022

I can't find the comment where I explained it, but at least I'm at the computer now 😄.

The main geometry type in wkt is https://docs.rs/wkt/latest/wkt/enum.Geometry.html. So it's enough to parse the fixtures into wkt::Geometry, then convert that into geo_types::Geometry from the current repo.

But you're not doing that. You're using a wkt::Geometry to geo_types::Geometry conversion available (feature-gated, but accidentally enabled) in wkt. So you're going from wkt::Geometry to geo_types::Geometry, to a potentially different geo_types::Geometry. This also forces you to add extra cases in the conversion code, like those for line and rectangle.

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

Successfully merging this pull request may close these issues.