Skip to content

Commit

Permalink
Bring in changes from v0.15.1 hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri committed Oct 6, 2023
2 parents fcd488a + adbac8b commit cab9fc1
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 29 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16dev0
0.15.1
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

sys.path.insert(0, os.path.abspath("../../"))

with open("../../VERSION.txt", "r") as f:
with open("../../VERSION.txt", "r", encoding="utf-8") as f:
__version__ = f.read().strip()

# -- Project information -----------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import json
from pathlib import PurePath

with open(PurePath(__file__).parent / "C6_coeffs.json") as f:
with open(
PurePath(__file__).parent / "C6_coeffs.json", "r", encoding="utf-8"
) as f:
_json_dict = json.load(f)
c6_dict = {int(key): value for key, value in _json_dict.items()}
4 changes: 3 additions & 1 deletion pulser-core/pulser/json/abstract_repr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@
SCHEMAS_PATH = Path(__file__).parent / "schemas"
SCHEMAS = {}
for obj_type in ("device", "sequence"):
with open(SCHEMAS_PATH / f"{obj_type}-schema.json") as f:
with open(
SCHEMAS_PATH / f"{obj_type}-schema.json", "r", encoding="utf-8"
) as f:
SCHEMAS[obj_type] = json.load(f)
14 changes: 8 additions & 6 deletions pulser-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@
current_directory = Path(__file__).parent

# Reads the version from the VERSION.txt file
with open(current_directory.parent / "VERSION.txt", "r") as f:
with open(
current_directory.parent / "VERSION.txt", "r", encoding="utf-8"
) as f:
__version__ = f.read().strip()

# Changes to the directory where setup.py is
os.chdir(current_directory)

with open("requirements.txt") as f:
with open("requirements.txt", "r", encoding="utf-8") as f:
requirements = f.read().splitlines()

# Stashes the source code for the local version file
local_version_fpath = Path(package_name) / "_version.py"
with open(local_version_fpath, "r") as f:
with open(local_version_fpath, "r", encoding="utf-8") as f:
stashed_version_source = f.read()

# Overwrites the _version.py for the source distribution (reverted at the end)
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(f"__version__ = '{__version__}'\n")

setup(
Expand All @@ -47,7 +49,7 @@
package_data={package_name: ["py.typed"]},
include_package_data=True,
description="A pulse-level composer for neutral-atom quantum devices.",
long_description=open("README.md").read(),
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Pulser Development Team",
python_requires=">=3.8",
Expand All @@ -61,5 +63,5 @@
)

# Restores the original source code of _version.py
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(stashed_version_source)
2 changes: 1 addition & 1 deletion pulser-pasqal/pulser_pasqal/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# Sets the version to the same as 'pulser'.
version_file_path = PurePath(__file__).parent.parent.parent / "VERSION.txt"

with open(version_file_path, "r") as f:
with open(version_file_path, "r", encoding="utf-8") as f:
__version__ = f.read().strip()
14 changes: 8 additions & 6 deletions pulser-pasqal/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,25 @@
current_directory = Path(__file__).parent

# Reads the version from the VERSION.txt file
with open(current_directory.parent / "VERSION.txt", "r") as f:
with open(
current_directory.parent / "VERSION.txt", "r", encoding="utf-8"
) as f:
__version__ = f.read().strip()

# Changes to the directory where setup.py is
os.chdir(current_directory)

with open("requirements.txt") as f:
with open("requirements.txt", encoding="utf-8") as f:
requirements = f.read().splitlines()
requirements.append(f"pulser-core=={__version__}")

# Stashes the source code for the local version file
local_version_fpath = Path(package_name) / "_version.py"
with open(local_version_fpath, "r") as f:
with open(local_version_fpath, "r", encoding="utf-8") as f:
stashed_version_source = f.read()

# Overwrites the _version.py for the source distribution (reverted at the end)
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(f"__version__ = '{__version__}'\n")

setup(
Expand All @@ -52,7 +54,7 @@
package_data={package_name: ["py.typed"]},
include_package_data=True,
description=description,
long_description=open("README.md").read(),
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Pulser Development Team",
python_requires=">=3.8",
Expand All @@ -66,5 +68,5 @@
)

# Restores the original source code of _version.py
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(stashed_version_source)
2 changes: 1 addition & 1 deletion pulser-simulation/pulser_simulation/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# Sets the version to the same as 'pulser'.
version_file_path = PurePath(__file__).parent.parent.parent / "VERSION.txt"

with open(version_file_path, "r") as f:
with open(version_file_path, "r", encoding="utf-8") as f:
__version__ = f.read().strip()
14 changes: 8 additions & 6 deletions pulser-simulation/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@
current_directory = Path(__file__).parent

# Reads the version from the VERSION.txt file
with open(current_directory.parent / "VERSION.txt", "r") as f:
with open(
current_directory.parent / "VERSION.txt", "r", encoding="utf-8"
) as f:
__version__ = f.read().strip()

# Changes to the directory where setup.py is
os.chdir(current_directory)

with open("requirements.txt") as f:
with open("requirements.txt", encoding="utf-8") as f:
requirements = f.read().splitlines()
requirements.append(f"pulser-core=={__version__}")

# Stashes the source code for the local version file
local_version_fpath = Path(package_name) / "_version.py"
with open(local_version_fpath, "r") as f:
with open(local_version_fpath, "r", encoding="utf-8") as f:
stashed_version_source = f.read()

# Overwrites the _version.py for the source distribution (reverted at the end)
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(f"__version__ = '{__version__}'\n")

setup(
Expand All @@ -48,7 +50,7 @@
package_data={package_name: ["py.typed"]},
include_package_data=True,
description="An emulator of pulse-level sequences created with Pulser.",
long_description=open("README.md").read(),
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Pulser Development Team",
python_requires=">=3.8",
Expand All @@ -62,5 +64,5 @@
)

# Restores the original source code of _version.py
with open(local_version_fpath, "w") as f:
with open(local_version_fpath, "w", encoding="utf-8") as f:
f.write(stashed_version_source)
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from setuptools import setup

# Reads the version from the VERSION.txt file
with open("VERSION.txt", "r") as f:
with open("VERSION.txt", "r", encoding="utf-8") as f:
__version__ = f.read().strip()

if "dev" in __version__:
Expand All @@ -25,7 +25,7 @@
"`make dev-install` instead."
)

with open("packages.txt", "r") as f:
with open("packages.txt", "r", encoding="utf-8") as f:
requirements = [f"{pkg.strip()}=={__version__}" for pkg in f.readlines()]

# Just a meta-package that requires all pulser packages
Expand All @@ -34,7 +34,7 @@
version=__version__,
install_requires=requirements,
description="A pulse-level composer for neutral-atom quantum devices.",
long_description=open("README.md").read(),
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
author="Pulser Development Team",
python_requires=">=3.8",
Expand Down
9 changes: 7 additions & 2 deletions tests/test_abstract_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def abstract_device(self, request):
@pytest.fixture
def device_schema(self):
with open(
"pulser-core/pulser/json/abstract_repr/schemas/device-schema.json"
"pulser-core/pulser/json/abstract_repr/schemas/device-schema.json",
"r",
encoding="utf-8",
) as f:
dev_schema = json.load(f)
return dev_schema
Expand Down Expand Up @@ -238,7 +240,10 @@ def test_optional_channel_fields(self, ch_obj):

def validate_schema(instance):
with open(
"pulser-core/pulser/json/abstract_repr/schemas/" "sequence-schema.json"
"pulser-core/pulser/json/abstract_repr/schemas/"
"sequence-schema.json",
"r",
encoding="utf-8",
) as f:
schema = json.load(f)
jsonschema.validate(instance=instance, schema=schema, registry=REGISTRY)
Expand Down

0 comments on commit cab9fc1

Please sign in to comment.