diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..4954559 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,24 @@ +name: Upload Python Package to PyPI + +on: + push: + tags: + - "v*" + +jobs: + deploy: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python3 -m build + python3 -m twine upload --repository pypi dist/* diff --git a/README.md b/README.md index 17b42bf..d3b8f32 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,27 @@ If html based test coverage is more your jam: pytest --cov-report=html The coverage webpages will be in the `htmlcov` directory. + + +Distribution +------------ + +To build the package for distribution to pypi, first install dependencies: + +`python3 -m pip install --upgrade twine build` + +Next, edit `setup.py` and bump the `version` field. +Then build the package by running: + +``` +python3 -m build +``` + +This command will produce packages in the `dist/` directory. +Upload these packages to pypi by running: + +``` +python3 -m twine upload --repository pypi dist/* +``` + +This command will require you to log in to a pypi account. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index e4d66c1..8495f45 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,27 @@ requirements = ['aiodns', 'aiohttp>=3.7.4', 'backoff', 'base58', 'dnspython', 'flake8', 'loguru'] +with open('README.md', 'r', encoding='utf-8') as fh: + long_description = fh.read() + setup( name='pythclient', version='0.0.2', packages=['pythclient'], author='Pyth Developers', author_email='contact@pyth.network', + description='A library to retrieve Pyth account structures off the Solana blockchain.', + long_description=long_description, + long_description_content_type='text/markdown', + url='https://github.com/pyth-network/pyth-client-py', + project_urls={ + 'Bug Tracker': 'https://github.com/pyth-network/pyth-client-py/issues', + }, + classifiers=[ + 'Programming Language :: Python :: 3', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + ], install_requires=requirements, extras_require={ 'testing': requirements + ['mock', 'pytest', 'pytest-cov', 'pytest-socket',