Skip to content

Commit

Permalink
Rename to neatnet (#136)
Browse files Browse the repository at this point in the history
* neatnet

* fix envs

* maybe fix?

* Update CONTRIBUTING.md

Co-authored-by: James Gaboardi <[email protected]>

---------

Co-authored-by: James Gaboardi <[email protected]>
  • Loading branch information
martinfleis and jGaboardi authored Dec 4, 2024
1 parent 59344c5 commit dfb9290
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- name: setup micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-file: ci/py313_sgeop-latest.yaml
environment-file: ci/py313_latest.yaml
create-args: >-
mypy
Expand All @@ -37,4 +37,4 @@

- name: Check package
run: |
mypy sgeop/ --ignore-missing-imports --install-types --non-interactive
mypy neatnet/ --ignore-missing-imports --install-types --non-interactive
24 changes: 12 additions & 12 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
matrix:
os: [ubuntu-latest]
environment-file: [
py311_sgeop-oldest,
py311_sgeop-latest,
py312_sgeop-latest,
py313_sgeop-latest,
py313_sgeop-dev,
py311_oldest,
py311_latest,
py312_latest,
py313_latest,
py313_dev,
]
include:
- environment-file: py313_sgeop-latest
- environment-file: py313_latest
os: macos-13 # Intel
- environment-file: py313_sgeop-latest
- environment-file: py313_latest
os: macos-latest # Apple Silicon
- environment-file: py313_sgeop-latest
- environment-file: py313_latest
os: windows-latest
fail-fast: false

Expand Down Expand Up @@ -65,17 +65,17 @@
- name: run tests
run: |
pytest \
sgeop/ \
neatnet/ \
--verbose \
-r a \
--numprocesses logical \
--color yes \
--cov sgeop \
--cov neatnet \
--cov-append \
--cov-report term-missing \
--cov-report xml . \
--env_type ${{ matrix.environment-file }}
- name: zip artifacts - Ubuntu & macOS
run: zip ci_artifacts.zip ci_artifacts -r
if: matrix.os != 'windows-latest' && (success() || failure())
Expand All @@ -91,7 +91,7 @@
name: ci_artifacts-${{ matrix.os }}-${{ matrix.environment-file }}
path: ci_artifacts.zip
if: success() || failure()

- name: codecov
uses: codecov/codecov-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
files: "sgeop\/"
files: "neatnet\/"
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
Expand Down
30 changes: 15 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ All types of contributions are encouraged and valued. See this page for differen
## I Have a Question

> If you want to ask a question, we assume that you have read the available ***[Documentation](...) (xref https://github.com/uscuni/sgeop/issues/5)***.
> If you want to ask a question, we assume that you have read the available ***[Documentation](...) (xref https://github.com/uscuni/neatnet/issues/5)***.
Before you ask a question, it is best to search for existing [Issues](https://github.com/uscuni/sgeop/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first, especially [Stack Overflow](https://stackoverflow.com).
Before you ask a question, it is best to search for existing [Issues](https://github.com/uscuni/neatnet/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first, especially [Stack Overflow](https://stackoverflow.com).

If you then still feel the need to ask a question and need clarification, we recommend the following:

- Open an [Issue](https://github.com/uscuni/sgeop/issues/new).
- Open an [Issue](https://github.com/uscuni/neatnet/issues/new).
- Provide as much context as you can about what you're running into.
- Provide project and platform versions (`python`, `shapely`, `geopandas`, etc.), depending on what seems relevant.

Expand All @@ -33,8 +33,8 @@ We will then take care of the issue as soon as possible.
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.

- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side, e.g. using incompatible environment components/versions (Make sure that you have read the ***[documentation](...) (xref https://github.com/uscuni/sgeop/issues/5)***.
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/uscuni/sgeop/issues).
- Determine if your bug is really a bug and not an error on your side, e.g. using incompatible environment components/versions (Make sure that you have read the ***[documentation](...) (xref https://github.com/uscuni/neatnet/issues/5)***.
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/uscuni/neatnet/issues).
- Also make sure to search the internet (especially [Stack Overflow](https://stackoverflow.com)) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
Expand All @@ -47,7 +47,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform

We use GitHub issues to track bugs and errors. If you run into an issue with the project:

- Open an [Issue](https://github.com/uscuni/sgeop/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Open an [Issue](https://github.com/uscuni/neatnet/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. This is known as a [mininum reproducible example](https://en.wikipedia.org/wiki/Minimal_reproducible_example#:~:text=In%20computing%2C%20a%20minimal%20reproducible,to%20be%20demonstrated%20and%20reproduced.) – or MWE for short.
- Provide the information you collected in the previous section.
Expand All @@ -65,13 +65,13 @@ This section guides you through submitting an enhancement suggestion for ***`PLA
#### Before Submitting an Enhancement

- Make sure that you are using the latest version.
- Read the ***[documentation](...) (xref https://github.com/uscuni/sgeop/issues/5)*** carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/uscuni/sgeop/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Read the ***[documentation](...) (xref https://github.com/uscuni/neatnet/issues/5)*** carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](https://github.com/uscuni/neatnet/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.

#### How Do I Submit a Good Enhancement Suggestion?

Enhancement suggestions are tracked as [GitHub issues](https://github.com/uscuni/sgeop/issues).
Enhancement suggestions are tracked as [GitHub issues](https://github.com/uscuni/neatnet/issues).

- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
Expand Down Expand Up @@ -103,19 +103,19 @@ When submitting a pull request:

#### Procedure

1. *After* opening an issue and discussing with the development team, create a PR with the proposed changes.
2. If [testing fails](https://github.com/uscuni/sgeop/actions/runs/11368511561) due to an update in the code base:
3. Observed data is [saved as artifacts](https://github.com/uscuni/sgeop/actions/runs/11368511561#artifacts) from the workflow and can be download locally.
4. We determine the `ci_artifacts-ubuntu-latest-py312_sgeop-latest` data as the "truth."
1. *After* opening an issue and discussing with the development team, create a PR with the proposed changes.
2. If [testing fails](https://github.com/uscuni/neatnet/actions/runs/11368511561) due to an update in the code base:
3. Observed data is [saved as artifacts](https://github.com/uscuni/neatnet/actions/runs/11368511561#artifacts) from the workflow and can be download locally.
4. We determine the `ci_artifacts-ubuntu-latest-py313_latest` data as the "truth."
5. After comparison of the current "known" data with new data from (3.), if new data is "truthier," update your PR with the new "known" data.

#### Handling Edge Cases in Testing

Edge cases will crop up in full-scale FUA testing that we can ignore (following a thorough investigation – e.g. [`sgeop#77`](https://github.com/uscuni/sgeop/issues/77)) during testing. Once it is determined the geometry in question is not caused by a bug on our end, it can be added to the `KNOWN_BAD_GEOMS` collection in `tests/conftest.py`. This collection is a dictionary keyed by `<NAME>_CODE` of the city/FUA where the values are lists of index locations of simplified edges that can be ignored if they fail equality testing. As an example, see our initial "bad" geometries [here](https://github.com/uscuni/sgeop/blob/1be6b44b1a06d52453ecbaee205ae649101c4ea4/sgeop/tests/conftest.py#L25-L39), which were due to a variant number of coordinates in those resultant simplified edges created by [different versions of `shapely`](https://github.com/uscuni/sgeop/pull/67#issuecomment-2457333724).
Edge cases will crop up in full-scale FUA testing that we can ignore (following a thorough investigation – e.g. [`neatnet#77`](https://github.com/uscuni/neatnet/issues/77)) during testing. Once it is determined the geometry in question is not caused by a bug on our end, it can be added to the `KNOWN_BAD_GEOMS` collection in `tests/conftest.py`. This collection is a dictionary keyed by `<NAME>_CODE` of the city/FUA where the values are lists of index locations of simplified edges that can be ignored if they fail equality testing. As an example, see our initial "bad" geometries [here](https://github.com/uscuni/neatnet/blob/1be6b44b1a06d52453ecbaee205ae649101c4ea4/neatnet/tests/conftest.py#L25-L39), which were due to a variant number of coordinates in those resultant simplified edges created by [different versions of `shapely`](https://github.com/uscuni/neatnet/pull/67#issuecomment-2457333724).

##### Code Structure

Code should be linted and formatted via `ruff`. With the [`.pre-commit` hooks](https://github.com/uscuni/sgeop/blob/main/.pre-commit-config.yaml) we have code in commits will be formatted and linted automatically once [`pre-commit` is installed](https://pre-commit.com/#installation).
Code should be linted and formatted via `ruff`. With the [`.pre-commit` hooks](https://github.com/uscuni/neatnet/blob/main/.pre-commit-config.yaml) we have code in commits will be formatted and linted automatically once [`pre-commit` is installed](https://pre-commit.com/#installation).

## Attribution

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `sgeop`: Street Geometry Processing Toolkit
# `neatnet`: Street Geometry Processing Toolkit

[![Continuous Integration](https://github.com/uscuni/sgeop/actions/workflows/testing.yml/badge.svg)](https://github.com/uscuni/sgeop/actions/workflows/testing.yml) [![codecov](https://codecov.io/gh/uscuni/sgeop/graph/badge.svg?token=GFISMU0WPS)](https://codecov.io/gh/uscuni/sgeop)
[![Continuous Integration](https://github.com/uscuni/neatnet/actions/workflows/testing.yml/badge.svg)](https://github.com/uscuni/neatnet/actions/workflows/testing.yml) [![codecov](https://codecov.io/gh/uscuni/neatnet/graph/badge.svg?token=GFISMU0WPS)](https://codecov.io/gh/uscuni/neatnet)

## Introduction

Expand All @@ -9,14 +9,14 @@
## Examples

```py
import sgeop
import neatnet

simplified = sgeop.simplify_network(gdf)
simplified = neatnet.simplify_network(gdf)
```

## Contribution

See our guidelines in [`CONTRIBUTING.md`](https://github.com/uscuni/sgeop/blob/main/CONTRIBUTING.md).
See our guidelines in [`CONTRIBUTING.md`](https://github.com/uscuni/neatnet/blob/main/CONTRIBUTING.md).

## Recommended Citation

Expand All @@ -27,4 +27,4 @@ This package developed & and maintained by:
* [Anastassia Vybornova](https://github.com/anastassiavybornova)
* [James D. Gaboardi](https://github.com/jGaboardi)

Copyright (c) 2024-, sgeop Developers
Copyright (c) 2024-, neatnet Developers
2 changes: 1 addition & 1 deletion ci/py311_sgeop-latest.yaml → ci/py311_latest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: py311_sgeop-latest
name: py311_neatnet-latest
channels:
- conda-forge
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion ci/py311_sgeop-oldest.yaml → ci/py311_oldest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: py311_sgeop-oldest
name: py311_neatnet-oldest
channels:
- conda-forge
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion ci/py312_sgeop-latest.yaml → ci/py312_latest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: py312_sgeop-latest
name: py312_neatnet-latest
channels:
- conda-forge
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion ci/py313_sgeop-dev.yaml → ci/py313_dev.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: py313_sgeop-dev
name: py313_neatnet-dev
channels:
- conda-forge
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion ci/py313_sgeop-latest.yaml → ci/py313_latest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: py313_sgeop-latest
name: py313_neatnet-latest
channels:
- conda-forge
dependencies:
Expand Down
4 changes: 2 additions & 2 deletions data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Contents

* This `README.md`
* `generate_simplified.py` – see [sgeop#7](https://github.com/uscuni/sgeop/issues/7)
* `generate_simplified.py` – see [neatnet#7](https://github.com/uscuni/neatnet/issues/7)
* Data
* There is a directory for each FUA listed below that contains 2 files:
* `original.parquet`: The original input street network derived from [OSM](https://www.openstreetmap.org/about) via [OSMNX](https://osmnx.readthedocs.io/en/stable/).
Expand All @@ -22,4 +22,4 @@

---------------------------------------

Copyright (c) 2024-, sgeop Developers
Copyright (c) 2024-, neatnet Developers
5 changes: 2 additions & 3 deletions data/generate_simplified.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import geopandas

import sgeop
import neatnet

start_time = time.time()

Expand Down Expand Up @@ -39,7 +39,6 @@
city_fua = {c: f for f, c in fua_city.items()}

for city, fua in city_fua.items():

t1 = time.time()
aoi = f"{city}_{fua}"

Expand All @@ -57,7 +56,7 @@
original = geopandas.read_parquet(pathlib.Path(aoi, "original.parquet"))

# output data
simplified = sgeop.simplify_network(original)
simplified = neatnet.simplify_network(original)
simplified.to_parquet(pathlib.Path(aoi, "simplified.parquet"))

t2 = round((time.time() - t1) / 60.0, 2)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: sgeop
name: neatnet
channels:
- conda-forge
dependencies:
Expand Down
2 changes: 1 addition & 1 deletion sgeop/__init__.py → neatnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
from .simplify import simplify_loop, simplify_network

with contextlib.suppress(PackageNotFoundError):
__version__ = version("sgeop")
__version__ = version("neatnet")
File renamed without changes.
2 changes: 1 addition & 1 deletion sgeop/continuity.py → neatnet/continuity.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def continuity(
Notes
-----
The returned ``coins`` object is not used in production, but is
very helpful in testing & debugging. See gh:sgeop#49.
very helpful in testing & debugging. See gh:neatnet#49.
"""
roads = roads.copy()

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion sgeop/nodes.py → neatnet/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def get_components(
Notes
-----
See [https://github.com/uscuni/sgeop/issues/56] for detailed explanation of output.
See [https://github.com/uscuni/neatnet/issues/56] for detailed explanation of
output.
"""
edgelines = np.array(edgelines)
start_points = shapely.get_point(edgelines, 0)
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions sgeop/tests/conftest.py → neatnet/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import pytest
import shapely

import sgeop
import neatnet

# set the global exception raiser for testing & debugging
# See gh#121
sgeop.simplify.DEBUGGING = True
neatnet.simplify.DEBUGGING = True

line_collection = ( # type: ignore[valid-type, misc]
list[shapely.LineString]
Expand Down Expand Up @@ -87,7 +87,7 @@ def geom_test(

if aoi and aoi.startswith("apalachicola"):
# Varied index order across OSs.
# See [https://github.com/uscuni/sgeop/pull/104#issuecomment-2495572388]
# See [https://github.com/uscuni/neatnet/pull/104#issuecomment-2495572388]
geoms1 = geoms1.sort_values().reset_index(drop=True)
geoms2 = geoms2.sort_values().reset_index(drop=True)

Expand Down Expand Up @@ -133,7 +133,7 @@ def pytest_configure(config): # noqa: ARG001
"""PyTest session attributes, methods, etc."""

valid_env_types = ["oldest", "latest", "dev"]
pytest.env_type = config.getoption("env_type").split("-")[-1]
pytest.env_type = config.getoption("env_type").split("_")[-1]
assert pytest.env_type in valid_env_types

pytest.ubuntu = "ubuntu" in platform.version().lower()
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import geopandas
import pytest

import sgeop
import neatnet


def test_get_artifacts_error():
path = pathlib.Path("sgeop", "tests", "data", "apalachicola_original.parquet")
path = pathlib.Path("neatnet", "tests", "data", "apalachicola_original.parquet")
with pytest.raises( # noqa: SIM117
ValueError,
match=(
Expand All @@ -22,4 +22,4 @@ def test_get_artifacts_error():
"Identification of face artifacts not possible."
),
):
sgeop.artifacts.get_artifacts(geopandas.read_parquet(path).iloc[:3])
neatnet.artifacts.get_artifacts(geopandas.read_parquet(path).iloc[:3])
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import shapely

import sgeop
import neatnet


@pytest.fixture
Expand Down Expand Up @@ -43,7 +43,7 @@ def roads() -> geopandas.GeoDataFrame:


def test_continuity(roads):
observed_continuity, observed_coins = sgeop.continuity.continuity(roads)
observed_continuity, observed_coins = neatnet.continuity.continuity(roads)

assert isinstance(observed_continuity, geopandas.GeoDataFrame)
known_continuity = (
Expand Down Expand Up @@ -94,9 +94,9 @@ def test_get_stroke_info(roads):
known_e_ = [0, 0, 1, 0, 0, 0, 1]
known_s_ = [0, 0, 1, 1, 1, 0, 1]

observed = sgeop.continuity.get_stroke_info(
sgeop.artifacts.get_artifacts(roads, threshold=1)[0],
sgeop.continuity.continuity(roads.copy())[0],
observed = neatnet.continuity.get_stroke_info(
neatnet.artifacts.get_artifacts(roads, threshold=1)[0],
neatnet.continuity.continuity(roads.copy())[0],
)

observed_strokes = observed[0]
Expand Down
Loading

0 comments on commit dfb9290

Please sign in to comment.