===
phgeograpy is a python package that lists regions, provinces, and cities/municipalities in the Philippines.
Take a break from machine learning and chatbots. I created this project to explore and experience building a python package. This is my first python package. Yey! I'll also use this project to expore unit testing.
I'm working on a web app that needs location input broken down into regions, provinces, and cities/municipalities so I created this package to make it reusable and open source. Technically it's just a list, you can use it to create dropdown inputs or model choices in Django.
# Regions
Regions are represented by `phgeograpy.Region` class.
Sample usage:
```python
import phgeograpy
# Get all regions in the philippines
regions = phgeograpy.regions()
# Get the details of the first region
print(regions[0].slug) # A unique id of the region
print(regions[0].name) # Name of the region
print(regions[0].description) # A longer/alternative name of the region
# Get a specific region.
# If no region is found, an Exception will be raised.
region = phgeograpy.regions('ncr') # `ncr` is the slug of NCR.
```
# Provinces
Provinces are represented by `phgeograpy.Province` class.
Sample usage:
```python
import phgeograpy
# Get all provinces in the philippines
provinces = phgeograpy.provinces()
# Get the details of the first province
print(provinces[0].slug) # A unique id of the province
print(provinces[0].name)
# Get the region where the province is located
region = provinces[0].region
# Get provinces of a specific region
region1_provinces = phgeograpy.provinces(region_slug='region1')
# You can also get the provinces from the `phgeograpy.Region` class instance
region1 = phgeograpy.regions('region1')
region1_provinces = region1.provinces()
```
# Municipalities
Municipalities are represented by `phgeograpy.Municipality` class. Cities are also included.
Sample Usage:
```python
import phgeograpy
# Get all municipalities in the philippines
municipalities = phgeograpy.municipalities()
# Get the details of the first municipality
print(municipalities[0].slug) # A unique id of the municipality
print(municipalities[0].name)
print(municipalities[0].is_city) # `True` if the instance is a city
print(municipalities[0].is_capital) # `True` if the instance is the capital of the province it is located
print(municipalities[0].is_huc) # `True` if the instance is a highly-urbanized/independent city
# Get the province where the municipality is located
province = municipalities[0].province
# Get municipalities from the `phgeograpy.Province` class instance
municipalities = province.municipalities()
```
# Raw data
To get raw data, just set `raw` parameter to `True`.
Sample usage:
```python
# Get raw regions data
raw_regions = phgeograpy.regions(raw=True)
```
Note that all data below the area of your query will be included in the raw output (e.g. raw regions will include data for provinces and municipalities, raw provinces will include data for municipalities).
Metadata
Release files for phgeograpy 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| phgeograpy-1.0.0.tar.gz | 30.2 kB | Without provenance | Details for phgeograpy-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phgeograpy-1.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for phgeograpy-1.0.0-py2.py3-none-any.whl |
Total release size: 66.9 kB
Release files / phgeograpy-1.0.0.tar.gz
| Download URL | phgeograpy-1.0.0.tar.gz |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65ee9e448a40ea595830564153a2cd588e98c2f505aa50bcdbb798c91649dcbd
|
|
BLAKE2b-256 checksum How to use checksums |
113a1c24218188f097a801694b098efbcd9c5c6176ed3fb42e13c275ceb085b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / phgeograpy-1.0.0-py2.py3-none-any.whl
| Download URL | phgeograpy-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 36.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
88c8079dd2a29df57dc3388d743367b05911bbd65fb1b58efa6009777075dd07
|
|
BLAKE2b-256 checksum How to use checksums |
6590f1839f28fd95b6d9b842ffeaa31694523385d1419057a06a11ca1e988ade
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for phgeograpy 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.