From 8bd826c49fe85699144d3ac5246e811e21c23ae5 Mon Sep 17 00:00:00 2001 From: jupfi Date: Tue, 23 Apr 2024 18:30:02 +0200 Subject: [PATCH] Initial deployment to PyPi. --- .github/workflows/python-publish.yml | 44 +++++++++++++++++++ CHANGELOG.md | 2 + LICENSE | 2 +- README.md | 7 ++- pyproject.toml | 35 ++++++++++++--- .../controller.py | 5 +-- src/nqrduck_spectrometer_simulator/model.py | 2 - 7 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..94e556b --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,44 @@ +name: Build, Test, and Upload Python Package + +on: + push: + tags: + - "v*.*.*" + + workflow_dispatch: + +permissions: + contents: read + +jobs: + # test: + # uses: ./.github/workflows/ubuntu-python-package.yml # use the callable tests job to run tests + + deploy: + + runs-on: ubuntu-latest + + # needs: [test] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + sudo apt-get update + python -m pip install --upgrade pip + + - name: Publish to PyPI + run: | + python -m venv venv + . ./venv/bin/activate + pip install -U twine build + python -m build . + python -m twine upload --repository pypi --username __token__ --password ${{ secrets.PYPI }} dist/* + env: + PYPI: ${{ secrets.PYPI }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0554198..bdec762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Changelog +### Version 0.0.3 (23-04-2024) +- Initial deployment of the Spectrometer Simulator to PyPi ### Version 0.0.2 (15-04-2024) - Initial release \ No newline at end of file diff --git a/LICENSE b/LICENSE index 94b1433..03b87d3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Julia Pfitzer +Copyright (c) 2023 jupfi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 368afdc..12764fc 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,16 @@ Ideally you should install the module in a virtual environment. You can create a python -m venv nqrduck ``` -You can install this module and the dependencies by running the following command in the terminal: +You can install this module and the dependencies by running the following command in the terminal after cloning the repository and navigating to the root directory of the project: ```bash pip install . ``` +Alternatively you can install the module via PyPI: +```bash +pip install nqrduck-spectrometer-simulator +``` + ## Usage The pulse sequence is graphically programmed using the [nqrduck-pulseprogrammer](htpps://github.com/nqrduck-pulseprogrammer) within the NQRduck program under the 'Spectrometer' tab. diff --git a/pyproject.toml b/pyproject.toml index 820d022..61afcf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,15 +7,15 @@ allow-direct-references = true [project] name = "nqrduck-spectrometer-simulator" -version = "0.0.2" +version = "0.0.3" authors = [ - { name="Julia Pfitzer", email="git@jupfi.me" }, + { name="jupfi", email="support@nqrduck.cool" }, ] description = "A submodule for the nqrduck-spectrometer module which implements the functionality of a NQR bloch simulator. This should enable easy simulation of NQR experiments." readme = "README.md" license = { file="LICENSE" } -requires-python = ">=3.8" +requires-python = ">=3.10" classifiers = [ "Programming Language :: Python :: 3", @@ -27,8 +27,33 @@ dependencies = [ "nqrduck-spectrometer", "pyqt6", "numpy", - "nqr_blochsimulator@git+https://github.com/jupfi/nqr-blochsimulator.git", + "nqr-blochsimulator", ] [project.entry-points."nqrduck"] -"nqrduck-spectrometer-simulator" = "nqrduck_spectrometer_simulator.simulator:Simulator" \ No newline at end of file +"nqrduck-spectrometer-simulator" = "nqrduck_spectrometer_simulator.simulator:Simulator" + +[tool.ruff] +exclude = [ + "widget.py", +] + +[tool.ruff.lint] +extend-select = [ + "UP", # pyupgrade + "D", # pydocstyle +] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[project.urls] +"Homepage" = "https://nqrduck.cool" +"Bug Tracker" = "https://github.com/nqrduck/nqrduck-spectrometer-simulator/issues" +"Source Code" = "https://github.com/nqrduck/nqrduck-spectrometer-simulator" + +[tool.hatch.build.targets.wheel] +packages = ["src/nqrduck_spectrometer_simulator"] \ No newline at end of file diff --git a/src/nqrduck_spectrometer_simulator/controller.py b/src/nqrduck_spectrometer_simulator/controller.py index 31f0acb..f5f6d2f 100644 --- a/src/nqrduck_spectrometer_simulator/controller.py +++ b/src/nqrduck_spectrometer_simulator/controller.py @@ -269,10 +269,9 @@ class SimulatorController(BaseSpectrometerController): def translate_rx_event(self) -> tuple: """This method translates the RX event of the pulse sequence to the limr object. - - Returns: - tuple: A tuple containing the start and stop time of the RX event in µs""" + tuple: A tuple containing the start and stop time of the RX event in µs + """ # This is a correction factor for the RX event. The offset of the first pulse is 2.2µs longer than from the specified samples. events = self.module.model.pulse_programmer.model.pulse_sequence.events diff --git a/src/nqrduck_spectrometer_simulator/model.py b/src/nqrduck_spectrometer_simulator/model.py index dc50a32..83be325 100644 --- a/src/nqrduck_spectrometer_simulator/model.py +++ b/src/nqrduck_spectrometer_simulator/model.py @@ -4,8 +4,6 @@ from nqrduck_spectrometer.pulseparameters import TXPulse, RXReadout from nqrduck_spectrometer.settings import ( FloatSetting, IntSetting, - BooleanSetting, - SelectionSetting, StringSetting, )