-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Build and Publish Python Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install wheel | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Upload Python Package | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
|
||
if [ -z "${VIRTUAL_ENV}" ]; then | ||
# Create a local virtualenv if one does not exist | ||
test -d .venv || python3 -m venv .venv --prompt random-real-addresses | ||
source .venv/bin/activate | ||
fi | ||
|
||
# We need wheel to install any binary packagess | ||
pip3 install --disable-pip-version-check wheel | ||
|
||
# Install dependencies in editable mode | ||
pip3 install --disable-pip-version-check --editable '.[dev]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
|
||
if [ -z "${VIRTUAL_ENV}" ] && [ -r .venv ]; then | ||
source .venv/bin/activate | ||
fi | ||
|
||
pytest . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[build-system] | ||
requires = ["setuptools", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "random-real-address" | ||
version = "0.1.0" | ||
description = "A Python package to generate real addresses in the US." | ||
authors = [{name = "Naren Thiagarajan", email = "narenst@gmail.com"}] | ||
license = {text = "MIT License"} | ||
dependencies = [] | ||
|
||
[project.optional-dependencies] | ||
|
||
dev = [ | ||
"pytest==6.2.4", | ||
"flake8==3.9.2", | ||
"black==21.9b0", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["random_address"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .generator import generate_random_address | ||
|
||
__all__ = ['generate_random_address'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def generate_random_address(): | ||
return '1234 Elm St.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
state,abbreviation | ||
Alabama,AL | ||
Alaska,AK | ||
Arizona,AZ | ||
Arkansas,AR | ||
California,CA | ||
Colorado,CO | ||
Connecticut,CT | ||
Delaware,DE | ||
District of Columbia,DC | ||
Florida,FL | ||
Georgia,GA | ||
Hawaii,HI | ||
Idaho,ID | ||
Illinois,IL | ||
Indiana,IN | ||
Iowa,IA | ||
Kansas,KS | ||
Kentucky,KY | ||
Louisiana,LA | ||
Maine,ME | ||
Maryland,MD | ||
Massachusetts,MA | ||
Michigan,MI | ||
Minnesota,MN | ||
Mississippi,MS | ||
Missouri,MO | ||
Montana,MT | ||
Nebraska,NE | ||
Nevada,NV | ||
New Hampshire,NH | ||
New Jersey,NJ | ||
New Mexico,NM | ||
New York,NY | ||
North Carolina,NC | ||
North Dakota,ND | ||
Ohio,OH | ||
Oklahoma,OK | ||
Oregon,OR | ||
Pennsylvania,PA | ||
Rhode Island,RI | ||
South Carolina,SC | ||
South Dakota,SD | ||
Tennessee,TN | ||
Texas,TX | ||
Utah,UT | ||
Vermont,VT | ||
Virginia,VA | ||
Washington,WA | ||
West Virginia,WV | ||
Wisconsin,WI | ||
Wyoming,WY |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import unittest | ||
|
||
from random_address import generate_random_address | ||
|
||
class TestRandomAddress(unittest.TestCase): | ||
def test_generate_random_address(self): | ||
address = generate_random_address() | ||
self.assertTrue(isinstance(address, str)) | ||
self.assertGreater(len(address), 0) |