diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index ba186cf..ae31d41 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -49,6 +49,7 @@ jobs: pip install safety pip install importlib-metadata pip install iso3166-2 + pip install poetry if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python3 setup.py install diff --git a/.github/workflows/deploy_pypi.yml b/.github/workflows/deploy_pypi.yml index 56e3eda..f99930a 100644 --- a/.github/workflows/deploy_pypi.yml +++ b/.github/workflows/deploy_pypi.yml @@ -16,31 +16,17 @@ jobs: runs-on: ubuntu-latest # platform: [ubuntu-latest, macos-latest, windows-latest] strategy: matrix: - python-version: [3.8] #deploying using one Python version on 1 runner + python-version: [3.9] #deploying using one Python version on 1 runner steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - # install all required modules and dependancies using pip and pyproject.toml installation - - name: Install dependencies - run: | - python -m pip install --upgrade pip twine build - # build distribution package of software and upload to the PYPi server - - name: Build and Upload to PyPI - run: | - python3 -m build - twine check dist/* - python3 -m twine upload dist/* --verbose - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - TWINE_REPOSITORY: pypi + # build distribution package using poetry tool and upload to the PYPi server via custom github action + - name: Build and publish to PyPI + uses: JRubics/poetry-publish@v2.0 + with: + pypi_token: ${{ secrets.PYPI_TOKEN }} - #sleep for 30 seconds to ensure that distribution package has finised uploading to Test PyPI + #sleep for 30 seconds to ensure that distribution package has finished uploading to PyPI - name: Wait / Sleep uses: jakejarvis/wait-action@master with: diff --git a/.github/workflows/deploy_test_pypi.yml b/.github/workflows/deploy_test_pypi.yml index 88097f8..2030204 100644 --- a/.github/workflows/deploy_test_pypi.yml +++ b/.github/workflows/deploy_test_pypi.yml @@ -13,38 +13,23 @@ on: #build and deploy to Test PyPI server jobs: build: - name: Deploy to TestPyPI 📦 runs-on: ubuntu-latest # platform: [ubuntu-latest, macos-latest, windows-latest] strategy: matrix: - python-version: [3.8] #deploying using one Python version on 1 runner + python-version: [3.9] #deploying using one Python version on 1 runner steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - # install all required modules and dependancies using pip and pyproject.toml installation - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python3 -m pip install setuptools wheel twine build - python3 setup.py install + - uses: actions/checkout@v3 - # build distribution package of software and upload to the test PYPi server - - name: Build and Upload to TestPyPI - run: | - python3 -m build - twine check dist/* - python3 -m twine upload --repository testpypi dist/* --verbose - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TEST }} - TWINE_REPOSITORY: testpypi + # build distribution package using poetry tool and upload to the test PYPi server via custom github action + - name: Build and publish to Test PyPI + uses: JRubics/poetry-publish@v2.0 + with: + pypi_token: ${{ secrets.PYPI_TEST }} + repository_name: "testpypi" + repository_url: "https://test.pypi.org/legacy/" - #sleep for 30 seconds to ensure that distribution package has finised uploading to Test PyPI + #sleep for 30 seconds to ensure that distribution package has finished uploading to Test PyPI - name: Wait / Sleep uses: jakejarvis/wait-action@master with: diff --git a/.gitignore b/.gitignore index 95574b1..391d3fb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ test-iso3166_2/ iso3166-2-data-archive/ get_iso3166_2.py .DS_Store +poetry.lock .vscode diff --git a/pyproject.toml b/pyproject.toml index 20aecdf..988f540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,11 @@ - -[project] +[tool.poetry] name = "iso3166-2" version = "1.5.2" description = "A lightweight Python package, and accompanying API, that can be used to access all of the world's most up-to-date and accurate ISO 3166-2 subdivision data, including: name, local name, code, parent code, type, latitude/longitude and flag." -authors = [ - { name="AJ McKenna", email="amckenna41@qub.ac.uk" }, -] -maintainers = "AJ McKenna " +authors = ["AJ Mckenna "] +maintainers = ["AJ McKenna "] license = "MIT" readme = "README.md" -requires-python = ">=3.8" classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -21,7 +17,7 @@ classifiers = [ "Natural Language :: English", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10"', + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: 3 :: Only", @@ -30,9 +26,23 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules" ] keywords = ["iso", "iso3166", "beautifulsoup", "python", "pypi", "countries", "country codes", "iso3166-2", "iso3166-1", "alpha-2", "iso3166-updates", "subdivisions", "regions"] -dependancies = ["iso3166", "natsort", "thefuzz", "unidecode"] +packages = [{include = "iso3166_2"}] + +[tool.poetry.dependencies] +python = "^3.8" +iso3166 = "^2.1.1" +natsort = "^8.4.0" +thefuzz = "^0.22.1" +Unidecode = "^1.3.8" -[project.urls] +[tool.poetry.group.dev.dependencies] +pytest = "^8.0.2" + +[tool.poetry.urls] homepage = "https://iso3166-2-api.vercel.app/api" repository = "https://github.com/amckenna41/iso3166-2" -documentation = "https://iso3166-2.readthedocs.io/en/latest/" \ No newline at end of file +documentation = "https://iso3166-2.readthedocs.io/en/latest/" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/tests/test_iso3166_2.py b/tests/test_iso3166_2.py index 3e91dfe..5df3186 100644 --- a/tests/test_iso3166_2.py +++ b/tests/test_iso3166_2.py @@ -56,8 +56,8 @@ def setUp(self): def test_iso3166_2_metadata(self): """ Testing correct iso3166-2 software version and metadata. """ - # self.assertEqual(metadata('iso3166-2')['version'], "1.5.1", - # "iso3166-2 version is not correct, expected 1.5.1, got {}.".format(metadata('iso3166-2')['version'])) + # self.assertEqual(metadata('iso3166-2')['version'], "1.5.2", + # "iso3166-2 version is not correct, expected 1.5.2, got {}.".format(metadata('iso3166-2')['version'])) self.assertEqual(metadata('iso3166-2')['name'], "iso3166-2", "iso3166-2 software name is not correct, expected iso3166-2, got {}.".format(metadata('iso3166-2')['name'])) self.assertEqual(metadata('iso3166-2')['author'], "AJ McKenna, https://github.com/amckenna41",