From 043cc4ea51580a3bc424210f6e1dde6fc736e25a Mon Sep 17 00:00:00 2001 From: Steven Shimizu Date: Wed, 15 Feb 2023 13:06:34 -0800 Subject: [PATCH] ci: changes for packaging and publishing library (#9) --- CONTRIBUTING.md | 18 +- Pipfile | 2 + Pipfile.lock | 189 +++++++++++++++++- linkedin_api/clients/auth/utils/__init__.py | 0 linkedin_api/clients/restli/utils/__init__.py | 0 pyproject.toml | 22 ++ setup.py | 4 +- 7 files changed, 225 insertions(+), 10 deletions(-) create mode 100644 linkedin_api/clients/auth/utils/__init__.py create mode 100644 linkedin_api/clients/restli/utils/__init__.py create mode 100644 pyproject.toml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e2be46..e073bdb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,4 +31,20 @@ If there are code changes that might affect the example code ([/examples](exampl ## Testing -From the project root directory, run `pytest`. \ No newline at end of file +From the project root directory, run `pytest`. + +## Publishing Package to PyPI + +Pre-requisites: +- Create an account on TestPyPI +- Create an account on PyPI + +1. Create source archive and a wheel for the package: `python -m build` +2. If you've made changes to pyproject.toml, run a check to make sure package metadata will be rendered properly on PyPI: `twine check dist/*` +3. If you want to test the package upload first: + 1. Upload to TestPyPI (enter your account credentials): `twine upload -r testpypi dist/*` + 2. [Search](https://test.pypi.org/search/) for your package on TestPyPI and confirm it looks good. + 3. Install and test out the published test package in a local project: `python -m pip install -i https://test.pypi.org/simple linkedin-api-client` + 4. Note: You cannot overwrite existing versions in TestPyPI or PyPI, so for testing, you would need to increment the version if it already exists. +4. Once everything looks good, upload to PyPI: `twine upload dist/*` + diff --git a/Pipfile b/Pipfile index 3b0f152..b412d4c 100644 --- a/Pipfile +++ b/Pipfile @@ -12,6 +12,8 @@ flask = "*" pytest = "*" python-dotenv = "*" responses = "*" +build = "*" +twine = "*" [requires] python_version = "3.10" diff --git a/Pipfile.lock b/Pipfile.lock index 7a32e06..75a4fce 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "6e5977daa60dc523ca1aaf6f1af002fbb9e757a4a5476b45279f0f177a0b5656" + "sha256": "108f4722c5bcbf48ad3f5146e5fa415bbcf48056f749e67d0ffad0190aea7aa6" }, "pipfile-spec": 6, "requires": { @@ -16,6 +16,22 @@ ] }, "default": { + "bleach": { + "hashes": [ + "sha256:1a1a85c1595e07d8db14c5f09f09e6433502c51c595970edc090551f0db99414", + "sha256:33c16e3353dbd13028ab4799a0f89a83f113405c766e9c122df8a06f5b85b3f4" + ], + "markers": "python_version >= '3.7'", + "version": "==6.0.0" + }, + "build": { + "hashes": [ + "sha256:af266720050a66c893a6096a2f410989eeac74ff9a68ba194b3f6473e8e26171", + "sha256:d5b71264afdb5951d6704482aac78de887c80691c52b88a9ad195983ca2c9269" + ], + "index": "pypi", + "version": "==0.10.0" + }, "certifi": { "hashes": [ "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3", @@ -118,6 +134,14 @@ "markers": "python_full_version >= '3.6.0'", "version": "==3.0.1" }, + "docutils": { + "hashes": [ + "sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6", + "sha256:5e1de4d849fee02c63b040a4a3fd567f4ab104defd8a5511fbbc24a8a017efbc" + ], + "markers": "python_version >= '3.7'", + "version": "==0.19" + }, "idna": { "hashes": [ "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4", @@ -126,6 +150,94 @@ "markers": "python_version >= '3.5'", "version": "==3.4" }, + "importlib-metadata": { + "hashes": [ + "sha256:7efb448ec9a5e313a57655d35aa54cd3e01b7e1fbcf72dce1bf06119420f5bad", + "sha256:e354bedeb60efa6affdcc8ae121b73544a7aa74156d047311948f6d711cd378d" + ], + "markers": "python_version >= '3.7'", + "version": "==6.0.0" + }, + "jaraco.classes": { + "hashes": [ + "sha256:2353de3288bc6b82120752201c6b1c1a14b058267fa424ed5ce5984e3b922158", + "sha256:89559fa5c1d3c34eff6f631ad80bb21f378dbcbb35dd161fd2c6b93f5be2f98a" + ], + "markers": "python_version >= '3.7'", + "version": "==3.2.3" + }, + "keyring": { + "hashes": [ + "sha256:771ed2a91909389ed6148631de678f82ddc73737d85a927f382a8a1b157898cd", + "sha256:ba2e15a9b35e21908d0aaf4e0a47acc52d6ae33444df0da2b49d41a46ef6d678" + ], + "markers": "python_version >= '3.7'", + "version": "==23.13.1" + }, + "markdown-it-py": { + "hashes": [ + "sha256:93de681e5c021a432c63147656fe21790bc01231e0cd2da73626f1aa3ac0fe27", + "sha256:cf7e59fed14b5ae17c0006eff14a2d9a00ed5f3a846148153899a0224e2c07da" + ], + "markers": "python_version >= '3.7'", + "version": "==2.1.0" + }, + "mdurl": { + "hashes": [ + "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", + "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba" + ], + "markers": "python_version >= '3.7'", + "version": "==0.1.2" + }, + "more-itertools": { + "hashes": [ + "sha256:250e83d7e81d0c87ca6bd942e6aeab8cc9daa6096d12c5308f3f92fa5e5c1f41", + "sha256:5a6257e40878ef0520b1803990e3e22303a41b5714006c32a3fd8304b26ea1ab" + ], + "markers": "python_version >= '3.7'", + "version": "==9.0.0" + }, + "packaging": { + "hashes": [ + "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2", + "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97" + ], + "markers": "python_version >= '3.7'", + "version": "==23.0" + }, + "pkginfo": { + "hashes": [ + "sha256:4b7a555a6d5a22169fcc9cf7bfd78d296b0361adad412a346c1226849af5e546", + "sha256:8fd5896e8718a4372f0ea9cc9d96f6417c9b986e23a4d116dda26b62cc29d046" + ], + "markers": "python_version >= '3.6'", + "version": "==1.9.6" + }, + "pygments": { + "hashes": [ + "sha256:b3ed06a9e8ac9a9aae5a6f5dbe78a8a58655d17b43b93c078f094ddc476ae297", + "sha256:fa7bd7bd2771287c0de303af8bfdfc731f51bd2c6a47ab69d117138893b82717" + ], + "markers": "python_version >= '3.6'", + "version": "==2.14.0" + }, + "pyproject-hooks": { + "hashes": [ + "sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8", + "sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5" + ], + "markers": "python_version >= '3.7'", + "version": "==1.0.0" + }, + "readme-renderer": { + "hashes": [ + "sha256:cd653186dfc73055656f090f227f5cb22a046d7f71a841dfa305f55c9a513273", + "sha256:f67a16caedfa71eef48a31b39708637a6f4664c4394801a7b0d6432d13907343" + ], + "markers": "python_version >= '3.7'", + "version": "==37.3" + }, "requests": { "hashes": [ "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa", @@ -134,6 +246,54 @@ "index": "pypi", "version": "==2.28.2" }, + "requests-toolbelt": { + "hashes": [ + "sha256:18565aa58116d9951ac39baa288d3adb5b3ff975c4f25eee78555d89e8f247f7", + "sha256:62e09f7ff5ccbda92772a29f394a49c3ad6cb181d568b1337626b2abb628a63d" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.10.1" + }, + "rfc3986": { + "hashes": [ + "sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd", + "sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c" + ], + "markers": "python_version >= '3.7'", + "version": "==2.0.0" + }, + "rich": { + "hashes": [ + "sha256:125d96d20c92b946b983d0d392b84ff945461e5a06d3867e9f9e575f8697b67f", + "sha256:8aa57747f3fc3e977684f0176a88e789be314a99f99b43b75d1e9cb5dc6db9e9" + ], + "markers": "python_full_version >= '3.7.0'", + "version": "==13.3.1" + }, + "six": { + "hashes": [ + "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", + "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.16.0" + }, + "tomli": { + "hashes": [ + "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", + "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f" + ], + "markers": "python_version < '3.11'", + "version": "==2.0.1" + }, + "twine": { + "hashes": [ + "sha256:929bc3c280033347a00f847236564d1c52a3e61b1ac2516c97c48f3ceab756d8", + "sha256:9e102ef5fdd5a20661eb88fad46338806c3bd32cf1db729603fe3697b1bc83c8" + ], + "index": "pypi", + "version": "==4.0.2" + }, "urllib3": { "hashes": [ "sha256:076907bf8fd355cde77728471316625a4d2f7e713c125f51953bb5b3eecf4f72", @@ -141,6 +301,21 @@ ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", "version": "==1.26.14" + }, + "webencodings": { + "hashes": [ + "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78", + "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" + ], + "version": "==0.5.1" + }, + "zipp": { + "hashes": [ + "sha256:23f70e964bc11a34cef175bc90ba2914e1e4545ea1e3e2f67c079671883f9cb6", + "sha256:e8b2a36ea17df80ffe9e2c4fda3f693c3dad6df1697d3cd3af232db680950b0b" + ], + "markers": "python_version >= '3.7'", + "version": "==3.13.0" } }, "develop": { @@ -439,10 +614,10 @@ }, "types-toml": { "hashes": [ - "sha256:a2286a053aea6ab6ff814659272b1d4a05d86a1dd52b807a87b23511993b46c5", - "sha256:f37244eff4cd7eace9cb70d0bac54d3eba77973aa4ef26c271ac3d1c6503a48e" + "sha256:306b1bb8b5bbc5f1b60387dbcc4b489e79f8490ce20e93af5f422a68b470d94b", + "sha256:c8748dd225b28eb80ce712e2d7d61b57599815e7b48d07ef53df51ed148fa6b1" ], - "version": "==0.10.8.3" + "version": "==0.10.8.4" }, "urllib3": { "hashes": [ @@ -454,11 +629,11 @@ }, "werkzeug": { "hashes": [ - "sha256:7ea2d48322cc7c0f8b3a215ed73eabd7b5d75d0b50e31ab006286ccff9e00b8f", - "sha256:f979ab81f58d7318e064e99c4506445d60135ac5cd2e177a2de0089bfd4c9bd5" + "sha256:2e1ccc9417d4da358b9de6f174e3ac094391ea1d4fbef2d667865d819dfd0afe", + "sha256:56433961bc1f12533306c624f3be5e744389ac61d722175d543e1751285da612" ], "markers": "python_version >= '3.7'", - "version": "==2.2.2" + "version": "==2.2.3" } } } diff --git a/linkedin_api/clients/auth/utils/__init__.py b/linkedin_api/clients/auth/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/linkedin_api/clients/restli/utils/__init__.py b/linkedin_api/clients/restli/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..864172c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools>=61.0.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "linkedin-api-client" +version = "0.1.0" +description = "Official Python client library for LinkedIn APIs" +readme = "README.md" +license = {file = "LICENSE.md"} +keywords = ["linkedin", "api", "rest.li"] +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3", +] +dependencies = ["requests"] +requires-python = ">=3.7" + +[project.urls] +Homepage = "https://github.com/linkedin-developers/linkedin-api-python-client" +repository = "https://github.com/linkedin-developers/linkedin-api-python-client" \ No newline at end of file diff --git a/setup.py b/setup.py index a1ff61a..5e409a3 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,8 @@ setup( name='linkedin-api-client', - packages=find_packages(include=['linkedin_api_client','examples']), - version='0.0.1', + packages=find_packages(exclude=['tests']), + version='0.1.0', description='LinkedIn API Python client library', author='LinkedIn', install_requires=['requests'],