Skip to content

Commit

Permalink
Merge pull request #358 from ohuettenhofer/export_to
Browse files Browse the repository at this point in the history
* Fix `U.export_to("path.png)"` syntax
  • Loading branch information
kottmanj authored Aug 19, 2024
2 parents d0d178b + d1c2941 commit 7ad50e2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
release:
types: [released]


jobs:
deploy:

Expand All @@ -30,7 +31,7 @@ jobs:
# remove qulacs from dependencies (issues with windows and mac)
# users need to install themselves if they want it
#cat requirements.txt | sed "s|qulacs|#qulacs|g" > tmp.txt
cat requirements.txt | sed "s|qulacs|#qulacs|g" > tmp.txt
rm requirements.txt
mv tmp.txt requirements.txt
python setup.py sdist bdist_wheel
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/pypi_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# thanks Justin Connor :-)
# see here for source: https://justinoconnor.codes/2021/05/02/automated-pypi-package-release-versioning-with-github/
name: Upload Python Package

on: workflow_dispatch


jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
# remove qulacs from dependencies (issues with windows and mac)
# users need to install themselves if they want it
cat requirements.txt | sed "s|qulacs|#qulacs|g" > tmp.txt
rm requirements.txt
mv tmp.txt requirements.txt
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 1 addition & 4 deletions src/tequila/circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ def export_to(self, *args, **kwargs):
Convenience: see src/tequila/circuit/qpic.py - export_to for more
Parameters
"""
# this way we allow calling U.export_to("asd.png") instead of having to specify U.export_to(filename="asd.png")
if "circuit" not in kwargs:
kwargs["circuit"]=self
return export_to(*args, **kwargs)
return export_to(self, *args, **kwargs)

@property
def moments(self):
Expand Down

0 comments on commit 7ad50e2

Please sign in to comment.