diff --git a/pyproject.toml b/pyproject.toml index 8991813..edabc7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,44 +1,43 @@ -[tool.poetry] +[project] name = "pincode" version = "1.0.4" description = "A simple offline pincode validator for India" -authors = ["Nemo "] -license = "MIT" +authors = [ + {name = "Nemo", email = "python@captnemo.in"}, +] +dependencies = ["requests"] readme = "README.md" -homepage = "https://github.com/captn3m0/india-pincode-regex" -repository = "https://github.com/captn3m0/india-pincode-regex" -documentation = "https://github.com/captn3m0/india-pincode-regex/wiki" +requires-python = ">=3.7" +license = {text = "MIT"} keywords = ["pincode", "regex", "offline", "pin", "validator"] - -packages = [ - { include = "pincode", from = "src" }, -] - -include = ["CHANGELOG.md", "README.md", "regex.txt"] - -exclude = [ - "src/*.js", - "src/*.php", - "tests/*.php", - "tests/*.js", - "vendor/", - "composer.", - "package.json", - "package-lock.json", - "node_modules/" -] - classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries" ] -[tool.poetry.dependencies] -python = "^3.5" +[project.urls] +homepage = "https://github.com/captn3m0/india-pincode-regex" +Repository = "https://github.com/captn3m0/india-pincode-regex" +Documentation = "https://github.com/captn3m0/india-pincode-regex/wiki" -[tool.poetry.dev-dependencies] +[tool.pdm] +includes = ["CHANGELOG.md", "README.md", "regex.txt", "src/pincode"] +excludes = [ + "src/*.js", + "src/*.php", + "tests/*.php", + "tests/*.js", + "tests/*.rb", + "tests/*.html", + "tests/jasmine*", + "vendor/", + "composer.", + "package.json", + "package-lock.json", + "node_modules/" + ] [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["pdm-pep517"] +build-backend = "pdm.pep517.api" diff --git a/src/pincode/__init__.py b/src/pincode/__init__.py index 8d1d282..86c3db5 100644 --- a/src/pincode/__init__.py +++ b/src/pincode/__init__.py @@ -1,9 +1,14 @@ import os import re +from pathlib import Path + +def get_project_root() -> Path: + return Path(__file__).parent.parent.parent + regex = list() dir_path = os.path.dirname(os.path.realpath(__file__)) -f = open(dir_path + '/../../regex.txt') +f = open(get_project_root() / 'regex.txt') lines = f.readlines() for line in lines: if (len(line) > 10): diff --git a/tests/test.py b/tests/test.py index b4ff64c..7b81c3f 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1,4 +1,4 @@ -from pincode import * +from pincode import Pincode from nose.tools import assert_equals def test_valid_pincodes():