diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index a8566e9bd..0c1b0da72 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -61,16 +61,13 @@ jobs: uses: actions/cache@v3.0.2 with: path: ${{ steps.prepare-cache-pip.outputs.cache-dir }} - key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/test_requirements.txt') }}-${{ hashFiles('**/docs_requirements.txt') }}-${{ hashFiles('**/setup.py') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.cfg') }} restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-pip- - - name: install test_requirements.txt + - name: install requirements.txt run: | - pip install -r test_requirements.txt - - name: install docs_requirements.txt - run: | - pip install -r docs_requirements.txt + pip install -r requirements.txt - name: install broadbean run: pip install . - name: Build docs on linux diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index da6737fd7..9d8efca45 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -37,12 +37,12 @@ jobs: uses: actions/cache@v3.0.2 with: path: ${{ steps.prepare-cache-pip.outputs.cache-dir }} - key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/test_requirements.txt') }}-${{ hashFiles('**/setup.py') }} + key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.cfg') }} restore-keys: | ${{ runner.os }}-${{ matrix.python-version }}-pip- - - name: install test_requirements.txt + - name: install requirements.txt run: | - pip install -r test_requirements.txt + pip install -r requirements.txt - name: install broadbean run: | pip install . diff --git a/.github/workflows/upload_to_pypi.yaml b/.github/workflows/upload_to_pypi.yaml new file mode 100644 index 000000000..974c4bae2 --- /dev/null +++ b/.github/workflows/upload_to_pypi.yaml @@ -0,0 +1,31 @@ +name: Upload Python Package + +on: + push: + tags: + - v* + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3.0.2 + - name: Set up Python + uses: actions/setup-python@v3.1.2 + with: + python-version: '3.7' + - name: Install build deps + run: pip install --upgrade pip setuptools wheel build + - name: Build + run: | + python -m build + - name: Install Twine + run: pip install twine + - name: Publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* diff --git a/broadbean/_version.py b/broadbean/_version.py new file mode 100644 index 000000000..c032f312b --- /dev/null +++ b/broadbean/_version.py @@ -0,0 +1,10 @@ +def _get_version() -> str: + from pathlib import Path + import versioningit + import broadbean + + project_dir = Path(broadbean.__file__).parent.parent + return versioningit.get_version(project_dir=project_dir) + + +__version__ = _get_version() diff --git a/broadbean/py.typed b/broadbean/py.typed new file mode 100644 index 000000000..a4a43c897 --- /dev/null +++ b/broadbean/py.typed @@ -0,0 +1,2 @@ +this file marks broadbean as safe for typechecking +https://mypy.readthedocs.io/en/latest/installed_packages.html#installed-packages diff --git a/docs_requirements.txt b/docs_requirements.txt deleted file mode 100644 index 82133027c..000000000 --- a/docs_requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -sphinx -sphinx_rtd_theme diff --git a/pyproject.toml b/pyproject.toml index 50c55b6d4..1bba5b362 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,15 @@ +[build-system] +requires = [ + "setuptools >= 56.0", + "wheel >= 0.29.0", + "versioningit ~= 1.1.1", +] +build-backend = 'setuptools.build_meta' + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-ra -q" + [tool.mypy] ignore_missing_imports = true show_error_codes = true @@ -5,3 +17,19 @@ enable_error_code = "ignore-without-code" warn_unused_ignores = true warn_unused_configs = true warn_redundant_casts = true + +[tool.versioningit] +default-version = "0.0" + +[tool.versioningit.format] +distance = "{next_version}.dev{distance}+{branch}.{vcs}{rev}" +dirty = "{next_version}.dev{distance}+{branch}.{vcs}{rev}.dirty" +distance-dirty = "{next_version}.dev{distance}+{branch}.{vcs}{rev}.dirty" + +[tool.versioningit.vcs] +method = "git" +match = ["v*"] + +[tool.versioningit.onbuild] +source-file = "broadbean/_version.py" +build-file = "broadbean/_version.py" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..74d73f5b4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,119 @@ +# pinned depedancies for CI +alabaster~=0.7.12 +argon2-cffi~=21.3.0 +argon2-cffi-bindings~=21.2.0 +asttokens~=2.0.5 +atomicwrites~=1.4.0 +attrs~=21.4.0 +Babel~=2.10.1 +backcall~=0.2.0 +beautifulsoup4~=4.11.1 +bleach~=5.0.0 +certifi~=2022.5.18.1 +cffi~=1.15.0 +cfgv~=3.3.1 +charset-normalizer~=2.0.12 +colorama~=0.4.4 +contextlib2~=21.6.0 +coverage~=6.4.1 +cycler~=0.11.0 +debugpy~=1.6.0 +decorator~=5.1.1 +defusedxml~=0.7.1 +distlib~=0.3.4 +docutils~=0.17.1 +entrypoints~=0.4 +executing~=0.8.3 +fastjsonschema~=2.15.3 +filelock~=3.7.1 +fonttools~=4.33.3 +hypothesis==6.46.7 +identify~=2.5.1 +idna~=3.3 +imagesize~=1.3.0 +iniconfig~=1.1.1 +ipykernel~=6.13.0 +ipython==8.4.0; python_version>='3.8' +ipython==7.31.0; python_version<'3.8' +ipython-genutils~=0.2.0 +ipywidgets~=7.7.0 +jedi~=0.18.1 +Jinja2~=3.1.2 +jsonschema~=4.6.0 +jupyter~=1.0.0 +jupyter-client~=7.3.1 +jupyter-console~=6.4.3 +jupyter-core~=4.10.0 +jupyterlab-pygments~=0.2.2 +jupyterlab-widgets~=1.1.0 +kiwisolver~=1.4.2 +MarkupSafe~=2.1.1 +matplotlib~=3.5.2 +matplotlib-inline~=0.1.3 +mistune~=0.8.4 +numpy~=1.21.5; python_version<'3.8' +numpy~=1.22.4; python_version>='3.8' +mypy~=0.950 +mypy-extensions~=0.4.3 +nbclient~=0.6.4 +nbconvert~=6.5.0 +nbformat~=5.4.0 +nest-asyncio~=1.5.5 +nodeenv~=1.6.0 +notebook~=6.4.11 +packaging~=21.3 +pandocfilters~=1.5.0 +parso~=0.8.3 +pickleshare~=0.7.5 +Pillow~=9.1.1 +platformdirs~=2.5.2 +pluggy~=1.0.0 +pre-commit~=2.19.0 +prometheus-client~=0.14.1 +prompt-toolkit~=3.0.29 +psutil~=5.9.1 +pure-eval~=0.2.2 +py~=1.11.0 +pycparser~=2.21 +Pygments~=2.12.0 +pyparsing~=3.0.9 +pyrsistent~=0.18.1 +pytest~=7.1.2 +pytest-cov~=3.0.0 +python-dateutil~=2.8.2 +pytz~=2022.1 +pywin32==304; sys_platform == 'win32' +pywinpty==2.0.5; sys_platform == 'win32' +PyYAML~=6.0 +pyzmq~=23.1.0 +qtconsole~=5.3.1 +QtPy~=2.1.0 +requests~=2.27.1 +schema~=0.7.5 +Send2Trash~=1.8.0 +six~=1.16.0 +snowballstemmer~=2.2.0 +sortedcontainers~=2.4.0 +soupsieve~=2.3.2.post1 +Sphinx~=5.0.1 +sphinx-rtd-theme~=1.0.0 +sphinxcontrib-applehelp~=1.0.2 +sphinxcontrib-devhelp~=1.0.2 +sphinxcontrib-htmlhelp~=2.0.0 +sphinxcontrib-jsmath~=1.0.1 +sphinxcontrib-qthelp~=1.0.3 +sphinxcontrib-serializinghtml~=1.1.5 +stack-data~=0.2.0 +terminado~=0.15.0 +tinycss2~=1.1.1 +toml~=0.10.2 +tomli~=2.0.1 +tornado~=6.1 +traitlets~=5.2.2.post1 +typing_extensions~=4.2.0 +urllib3~=1.26.9 +virtualenv~=20.14.1 +wcwidth~=0.2.5 +webencodings~=0.5.1 +widgetsnbextension~=3.6.0 +wincertstore~=0.2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..6fdfc48cd --- /dev/null +++ b/setup.cfg @@ -0,0 +1,49 @@ +[metadata] +name = broadbean +maintainer = QCoDeS Core Developers +maintainer_email = qcodes-support@microsoft.com +description = Package for easily generating and manipulating signal + pulses. Developed for use with qubits in the quantum + computing labs of Copenhagen, Delft, and Sydney, but + should be generally useable. +keywords = Pulsebuilding signal processing arbitrary waveforms +long_description = file: README.md +long_description_content_type = text/markdown +url = https://github.com/QCoDeS/broadbean +classifiers = + Development Status :: 4 - Beta + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Topic :: Scientific/Engineering +license = MIT + +[options.package_data] +broadbean = + py.typed + +[options] +include_package_data = True +packages=find: +python_requires = >=3.7 +install_requires = + numpy>=1.12.1 + matplotlib + schema + versioningit>=1.1.1 + +[options.extras_require] +test = + pytest>=6.2.2 + pytest-cov>=3.0.0 + coverage[toml]>=6.2 + black>=22.3.0 + mypy>=0.960 + types-pytz>=2021.3.0 + jupyter>=1.0.0 + hypothesis>=5.49.0 + diff --git a/setup.py b/setup.py index 6198f5921..58b44f09e 100644 --- a/setup.py +++ b/setup.py @@ -1,40 +1,7 @@ from setuptools import setup +from versioningit import get_cmdclasses -setup( - name='broadbean', - version='0.10.0', - - # We might as well require what we know will work - # although older numpy and matplotlib version will probably work too - install_requires=['numpy>=1.12.1', - 'matplotlib', - 'schema'], - - author='William H.P. Nielsen', - author_email='William.Nielsen@microsoft.com', - - description=("Package for easily generating and manipulating signal " - "pulses. Developed for use with qubits in the quantum " - "computing labs of Copenhagen, Delft, and Sydney, but " - "should be generally useable."), - - license='MIT', - - packages=['broadbean'], - - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Science/Research', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10' - ], - - python_requires=">=3.7", - - keywords='Pulsebuilding signal processing arbitrary waveforms', - - url='https://github.com/QCoDeS/broadbean' +if __name__ == "__main__": + setup( + cmdclass=get_cmdclasses(), ) diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index bb76bd3a8..000000000 --- a/test_requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -hypothesis==6.46.7 -pytest -pytest-cov -coverage[toml] -mypy==0.950 -jupyter