Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .devcontainer/Dockerfile

This file was deleted.

54 changes: 0 additions & 54 deletions .devcontainer/devcontainer.json

This file was deleted.

103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test-windows:
runs-on: windows-latest
env:
GEO_VERSION: 25a
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11 (64-bit)
uses: actions/setup-python@v4
with:
python-version: 3.11
architecture: x64
- name: Install Geosupport Desktop (Windows)
shell: pwsh
run: |
$FILENAME = "gde_${{ env.GEO_VERSION }}_x64.zip"
$URL = "https://s-media.nyc.gov/agencies/dcp/assets/files/zip/data-tools/bytes/$FILENAME"
$LOCALDIR = "gde_${{ env.GEO_VERSION }}_x64"
$TARGETDIR = "C:\Program Files\Geosupport Desktop Edition"

# Download and extract the installer
Invoke-WebRequest -Uri $URL -OutFile $FILENAME
Expand-Archive -Path $FILENAME -DestinationPath $LOCALDIR

# Run the installer from the expected folder structure
Start-Process -Wait -FilePath "$LOCALDIR\setup.exe" -Verb runAs -ArgumentList '/s', '/v"/qn"'

# Update environment variables for subsequent steps
echo "PATH=$TARGETDIR\bin;$env:PATH" >> $env:GITHUB_ENV
echo "GEOFILES=$TARGETDIR\fls\\" >> $env:GITHUB_ENV

- name: Install dependencies
run: pip install .
- name: Run unit tests
run: python -m unittest discover

test-linux:
runs-on: ubuntu-latest
env:
GEO_VERSION: 25a
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Geosupport Desktop (Linux)
run: |
# Extract numeric part and the trailing letter from GEO_VERSION (e.g. "25a")
NUM="${GEO_VERSION:0:2}"
LETTER="${GEO_VERSION: -1}"

# Map letter to the appropriate minor version number
case $LETTER in
a) MINOR=1;;
b) MINOR=2;;
c) MINOR=3;;
*) echo "Unsupported GEO_VERSION letter: $LETTER" && exit 1;;
esac

# Build the filename based on GEO_VERSION; for example, for 25b it becomes linux_geo25b_25.2.zip
FILENAME="linux_geo${GEO_VERSION}_${NUM}.${MINOR}.zip"
URL="https://s-media.nyc.gov/agencies/dcp/assets/files/zip/data-tools/bytes/$FILENAME"

LOCALDIR="geosupport-install-lx"

# Download and extract the zip file
curl -L -o $FILENAME "$URL"
mkdir -p $LOCALDIR
unzip $FILENAME -d $LOCALDIR

# Locate the extracted directory, which is named like "version-25b_25.2"
GEO_DIR=$(find $LOCALDIR -type d -name "version-${GEO_VERSION}_*" | head -n 1)

# Set environment variables for GEOFILES and LD_LIBRARY_PATH
echo "GEOFILES=$GITHUB_WORKSPACE/$GEO_DIR/fls/" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/$GEO_DIR/lib/:$LD_LIBRARY_PATH" >> $GITHUB_ENV

- name: Install dependencies
run: pip install .
- name: Run unit tests
run: python -m unittest discover

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install code quality tools
run: pip install black
- name: Check code formatting with black
run: black --check .
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Create Release

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history and tags



- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Verify version matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(python -c "import geosupport; print(geosupport.__version__)")
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "ERROR: Tag version ($TAG_VERSION) doesn't match package version ($PACKAGE_VERSION)"
exit 1
fi

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e .

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Build package
run: python -m build

- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.tar.gz
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PyPI on tag push
# This step will only run if the tag starts with 'v'
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ MANIFEST
cover
.coverage
coverage.xml
gde/
upg/
docker/
47 changes: 39 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# python-geosupport

[![Build status](https://ci.appveyor.com/api/projects/status/5uocynec8e3maeeq?svg=true&branch=master)](https://ci.appveyor.com/project/ishiland/python-geosupport) [![PyPI version](https://img.shields.io/pypi/v/python-geosupport.svg)](https://pypi.python.org/pypi/python-geosupport/) [![Python 2.7 | 3.4+](https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg)](https://www.python.org/downloads/release/python-360/)
![Build status](https://github.com/ishiland/python-geosupport/actions/workflows/ci.yml/badge.svg) [![PyPI version](https://img.shields.io/pypi/v/python-geosupport.svg)](https://pypi.python.org/pypi/python-geosupport/) [![3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/release/python-360/)


Python bindings for NYC Planning's [Geosupport Desktop Edition](https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-gde-home.page).
Geocode NYC addresses locally using Python bindings for NYC Planning's [Geosupport Desktop Edition](https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-gde-home.page).

### [Read the docs](https://python-geosupport.readthedocs.io/en/latest/)
## Documentation

Check out documentation for installing and usage [here](https://python-geosupport.readthedocs.io/en/latest/).

## Features

- Pythonic interface to all Geosupport functions
- Support for both Windows and Linux platforms
- Secure and fast using local geocoding - no API calls required
- Built-in error handling for Geosupport return codes
- Interactive help menu

## Compatibility

- Python 3.8+
- Tested on Geosupport Desktop Edition 25a
- Windows (64-bit & 32-bit) and Linux operating systems

## Quickstart

```bash
pip install python-geosupport
```

```python
# Import the library and create a `Geosupport` object.
from geosupport import Geosupport
Expand Down Expand Up @@ -40,11 +60,22 @@ result = g.address(house_number=125, street_name='Worth St', borough_code='Mn')
}
```

## License
## Examples

This project is licensed under the MIT License - see the [license.txt](license.txt) file for details
See the examples directory and accompanying [readme.md](examples/readme.md).


## Contributing

## Contributors
Thanks to [Jeremy Neiman](https://github.com/docmarionum1) for a major revision incorporating all Geosupport functions and parameters.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run tests (`python -m unittest discover`)
5. Run Black formatting (`black .`)
6. Commit your changes (`git commit -m 'Add some amazing feature'`)
7. Push to the branch (`git push origin feature/amazing-feature`)
8. Open a Pull Request

If you see an issue or would like to contribute, pull requests are welcome.
## License

This project is licensed under the MIT License - see the [license.txt](license.txt) file for details
Loading