Skip to content

Commit 12d5495

Browse files
authored
v1.1.0 (#38)
* fix segmentation fault * remove python 2.7 support, only 3.8+ supported now * add type hints & better comments * refactor ctypes library loading * black formatting * gh actions for testing and releases
1 parent d3d3411 commit 12d5495

29 files changed

Lines changed: 1266 additions & 1137 deletions

.devcontainer/Dockerfile

Lines changed: 0 additions & 31 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test-windows:
11+
runs-on: windows-latest
12+
env:
13+
GEO_VERSION: 25a
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.11 (64-bit)
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.11
20+
architecture: x64
21+
- name: Install Geosupport Desktop (Windows)
22+
shell: pwsh
23+
run: |
24+
$FILENAME = "gde_${{ env.GEO_VERSION }}_x64.zip"
25+
$URL = "https://s-media.nyc.gov/agencies/dcp/assets/files/zip/data-tools/bytes/$FILENAME"
26+
$LOCALDIR = "gde_${{ env.GEO_VERSION }}_x64"
27+
$TARGETDIR = "C:\Program Files\Geosupport Desktop Edition"
28+
29+
# Download and extract the installer
30+
Invoke-WebRequest -Uri $URL -OutFile $FILENAME
31+
Expand-Archive -Path $FILENAME -DestinationPath $LOCALDIR
32+
33+
# Run the installer from the expected folder structure
34+
Start-Process -Wait -FilePath "$LOCALDIR\setup.exe" -Verb runAs -ArgumentList '/s', '/v"/qn"'
35+
36+
# Update environment variables for subsequent steps
37+
echo "PATH=$TARGETDIR\bin;$env:PATH" >> $env:GITHUB_ENV
38+
echo "GEOFILES=$TARGETDIR\fls\\" >> $env:GITHUB_ENV
39+
40+
- name: Install dependencies
41+
run: pip install .
42+
- name: Run unit tests
43+
run: python -m unittest discover
44+
45+
test-linux:
46+
runs-on: ubuntu-latest
47+
env:
48+
GEO_VERSION: 25a
49+
steps:
50+
- uses: actions/checkout@v3
51+
- name: Set up Python 3.11
52+
uses: actions/setup-python@v4
53+
with:
54+
python-version: 3.11
55+
- name: Install Geosupport Desktop (Linux)
56+
run: |
57+
# Extract numeric part and the trailing letter from GEO_VERSION (e.g. "25a")
58+
NUM="${GEO_VERSION:0:2}"
59+
LETTER="${GEO_VERSION: -1}"
60+
61+
# Map letter to the appropriate minor version number
62+
case $LETTER in
63+
a) MINOR=1;;
64+
b) MINOR=2;;
65+
c) MINOR=3;;
66+
*) echo "Unsupported GEO_VERSION letter: $LETTER" && exit 1;;
67+
esac
68+
69+
# Build the filename based on GEO_VERSION; for example, for 25b it becomes linux_geo25b_25.2.zip
70+
FILENAME="linux_geo${GEO_VERSION}_${NUM}.${MINOR}.zip"
71+
URL="https://s-media.nyc.gov/agencies/dcp/assets/files/zip/data-tools/bytes/$FILENAME"
72+
73+
LOCALDIR="geosupport-install-lx"
74+
75+
# Download and extract the zip file
76+
curl -L -o $FILENAME "$URL"
77+
mkdir -p $LOCALDIR
78+
unzip $FILENAME -d $LOCALDIR
79+
80+
# Locate the extracted directory, which is named like "version-25b_25.2"
81+
GEO_DIR=$(find $LOCALDIR -type d -name "version-${GEO_VERSION}_*" | head -n 1)
82+
83+
# Set environment variables for GEOFILES and LD_LIBRARY_PATH
84+
echo "GEOFILES=$GITHUB_WORKSPACE/$GEO_DIR/fls/" >> $GITHUB_ENV
85+
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/$GEO_DIR/lib/:$LD_LIBRARY_PATH" >> $GITHUB_ENV
86+
87+
- name: Install dependencies
88+
run: pip install .
89+
- name: Run unit tests
90+
run: python -m unittest discover
91+
92+
lint:
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v3
96+
- name: Set up Python 3.11
97+
uses: actions/setup-python@v4
98+
with:
99+
python-version: 3.11
100+
- name: Install code quality tools
101+
run: pip install black
102+
- name: Check code formatting with black
103+
run: black --check .

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # Fetch all history and tags
15+
16+
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Verify version matches tag
24+
run: |
25+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
26+
PACKAGE_VERSION=$(python -c "import geosupport; print(geosupport.__version__)")
27+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
28+
echo "ERROR: Tag version ($TAG_VERSION) doesn't match package version ($PACKAGE_VERSION)"
29+
exit 1
30+
fi
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install build twine
36+
pip install -e .
37+
38+
- name: Extract version from tag
39+
id: get_version
40+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
41+
42+
- name: Build package
43+
run: python -m build
44+
45+
- name: Create GitHub Release
46+
id: create_release
47+
uses: softprops/action-gh-release@v1
48+
with:
49+
files: |
50+
dist/*.whl
51+
dist/*.tar.gz
52+
generate_release_notes: true
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Publish to PyPI on tag push
57+
# This step will only run if the tag starts with 'v'
58+
if: startsWith(github.ref, 'refs/tags/')
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
user: __token__
62+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ MANIFEST
1212
cover
1313
.coverage
1414
coverage.xml
15+
gde/
16+
upg/
17+
docker/

README.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
# python-geosupport
22

3-
[![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/)
3+
![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/)
44

55

6-
Python bindings for NYC Planning's [Geosupport Desktop Edition](https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-gde-home.page).
6+
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).
77

8-
### [Read the docs](https://python-geosupport.readthedocs.io/en/latest/)
8+
## Documentation
9+
10+
Check out documentation for installing and usage [here](https://python-geosupport.readthedocs.io/en/latest/).
11+
12+
## Features
13+
14+
- Pythonic interface to all Geosupport functions
15+
- Support for both Windows and Linux platforms
16+
- Secure and fast using local geocoding - no API calls required
17+
- Built-in error handling for Geosupport return codes
18+
- Interactive help menu
19+
20+
## Compatibility
21+
22+
- Python 3.8+
23+
- Tested on Geosupport Desktop Edition 25a
24+
- Windows (64-bit & 32-bit) and Linux operating systems
925

1026
## Quickstart
1127

28+
```bash
29+
pip install python-geosupport
30+
```
31+
1232
```python
1333
# Import the library and create a `Geosupport` object.
1434
from geosupport import Geosupport
@@ -40,11 +60,22 @@ result = g.address(house_number=125, street_name='Worth St', borough_code='Mn')
4060
}
4161
```
4262

43-
## License
63+
## Examples
4464

45-
This project is licensed under the MIT License - see the [license.txt](license.txt) file for details
65+
See the examples directory and accompanying [readme.md](examples/readme.md).
66+
67+
68+
## Contributing
4669

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

50-
If you see an issue or would like to contribute, pull requests are welcome.
79+
## License
80+
81+
This project is licensed under the MIT License - see the [license.txt](license.txt) file for details

0 commit comments

Comments
 (0)