Skip to content

Commit

Permalink
🔧 Replace poetry with flit/uv
Browse files Browse the repository at this point in the history
Poetry is outdated and PEP621 un-compliant.

Note, `uv sync` will fail currently, due to the lower Python 3.8 requirement. This will be updated in a follow-up
  • Loading branch information
chrisjsewell committed Nov 27, 2024
1 parent d5e8465 commit 4095f05
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 405 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
poetry.lock linguist-generated=true
poetry.lock -diff
# Auto detect text files and perform LF normalization
* text=auto
13 changes: 7 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: install Poetry
run: python -m pip install poetry
- name: poetry configure PyPI Token
run: poetry config pypi-token.pypi ${{ secrets.PYPI }}
- name: poetry build and publish PyPi
run: poetry --build publish
- name: install flit
run: pip install flit~=3.4
- name: Build and publish
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI }}
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
repos:

- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Maintainers

Daniel Woste <[email protected]>

Chris Sewell <[email protected]>

Contributors
------------

Expand Down Expand Up @@ -36,6 +38,4 @@ Duodu Randy <[email protected]>

Christian Wappler <[email protected]>

Chris Sewell <[email protected]>

Simon Leiner <[email protected]>
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

59 changes: 0 additions & 59 deletions Makefile

This file was deleted.

9 changes: 0 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ For filtering and analyzing needs, ``Sphinx-Needs`` provides different, powerful
Installation
============

Using poetry
------------

.. code-block:: bash
poetry add sphinx-needs
Using pip
---------

Expand All @@ -79,8 +72,6 @@ Using sources
git clone https://github.com/useblocks/sphinx-needs
cd sphinx-needs
pip install .
# or
poetry install
Activation
Expand Down
124 changes: 22 additions & 102 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,44 @@ To develop **Sphinx-Needs** it can be installed, with development extras, into
pip install sphinx-needs[test,benchmark,docs]
or using `Poetry <https://python-poetry.org/>`__ to install the dependencies into an isolated environment:
or using `uv <https://docs.astral.sh/uv/>`__ to install the dependencies into an isolated environment:

1. `Install Poetry <https://python-poetry.org/docs/#installation>`__

2. Install project dependencies
.. code-block:: bash
.. code-block:: bash
uv sync
poetry install --all-extras
To run the formatting and linting suite, `pre-commit <https://pre-commit.com/>`__ is used:

To run the formatting and linting suite, pre-commit is used:
.. code-block:: bash
1. `Install Pre-Commit <https://pre-commit.com/>`__
pre-commit install # to auto-run on every commit
pre-commit run --all-files # to run manually
2. Install the Pre-Commit hooks
To run testing and documentation building, `tox <https://tox.readthedocs.io/>`__ is used:

.. code-block:: bash
.. code-block:: bash
pre-commit install
tox -av # to see all environments
Note, it is recommended to also install the `tox-uv <https://github.com/tox-dev/tox-uv>`__ plugin, which will use `uv` to create isolated environments faster, and to use `pyenv <https://github.com/pyenv/pyenv>`__ to manage multiple Python versions.

Build docs
----------
To build the **Sphinx-Needs** documentation stored under ``/docs``, run:

.. code-block:: bash

# Build HTML pages
make docs-html
or
To build the **Sphinx-Needs** documentation stored under ``/docs``, run:

.. code-block:: bash
# Build PDF pages
make docs-pdf
It will always perform a **clean** build (calls ``make clean`` before the build).
If you want to avoid this, run the related sphinx-commands directly under ``/docs`` (e.g. ``make docs``).
# Build HTML pages with the furo theme,
# and first remove all old build files
CLEAN=true tox -e docs-furo
Check links in docs
~~~~~~~~~~~~~~~~~~~~
To check if all used links in the documentation are still valid, run:
or to build with a different builder:

.. code-block:: bash
make docs-linkcheck
# Check links in the documentation
CLEAN=true BUILDER=linkcheck tox -e docs-furo
Running Tests
Expand All @@ -90,11 +81,11 @@ You can either run the tests directly using ``pytest``, in an existing environme
pytest tests/
Or you can use the provided Makefile:
Or use tox (recommended):

.. code-block:: bash
make test
tox -e py38
Note some tests use `syrupy <https://github.com/tophat/syrupy>`__ to perform snapshot testing.
These snapshots can be updated by running:
Expand Down Expand Up @@ -208,99 +199,28 @@ You can run the ``make test-js`` command to check all JS testcases.
The ``http_server`` process invoked by the ``make test-js`` command may not terminate properly in some instances.
Kindly check your system's monitoring app to end the process if not terminated automatically.

Linting & Formatting
--------------------

**Sphinx-Needs** uses `pre-commit <https://pre-commit.com/>`__ to run formatting and checking of source code.
This can be run directly using:

.. code-block:: bash
pre-commit run --all-files
or via the provided Makefile:

.. code-block:: bash
make lint
Benchmarks
----------

**Sphinx-Needs** own documentation is used for creating a benchmark for each PR.
If the runtime takes 10% longer as the previous ones, the benchmark test will fail.

Benchmark test cases are available under ``tests/benchmarks``.
And they can be locally executed via ``make benchmark``.

The results for each PR/commit get added to a chart, which is available under
http://useblocks.com/sphinx-needs/bench/index.html.

The benchmark data is stored on the `benchmarks` branch, which is also used by github-pages as
source.


Running Test Matrix
-------------------

This project provides a test matrix for running the tests across a range
of Python and Sphinx versions. This is used primarily for continuous integration.

`Nox <https://nox.thea.codes/en/stable/>`__ is used as a test runner.

Running the matrix tests requires additional system-wide dependencies

1. `Install
Nox <https://nox.thea.codes/en/stable/tutorial.html#installation>`__
2. `Install Nox-Poetry <https://pypi.org/project/nox-poetry/>`__
3. You will also need multiple Python versions available. You can manage
these using `Pyenv <https://github.com/pyenv/pyenv>`__

You can run the test matrix by using the ``nox`` command

.. code-block:: bash
nox
or using the provided Makefile

.. code-block:: bash
make test-matrix
For a full list of available options, refer to the Nox documentation,
and the local :download:`noxfile <../noxfile.py>`.

.. dropdown:: Our noxfile.py

.. literalinclude:: ../noxfile.py


Running Commands
----------------

See the Poetry documentation for a list of commands.

In order to run custom commands inside the isolated environment, they
should be prefixed with ``poetry run`` (ie. ``poetry run <command>``).

List make targets
-----------------

**Sphinx-Needs** uses ``make`` to invoke most development related actions.

Use ``make list`` to get a list of available targets.

.. program-output:: make --no-print-directory --directory ../ list

Publishing a new release
------------------------
There is a release pipeline installed for the CI.

This gets triggered automatically, if a tag is created and pushed.
The tag must follow the format: ``[0-9].[0-9]+.[0-9]``. Otherwise the release jobs won't trigger.

The release jobs will build the source and wheel distribution and try to upload them
to ``test.pypi.org`` and ``pypy.org``.
The release jobs will build the source and wheel distribution and try to upload them.


Structure of the extension's logic
Expand Down
26 changes: 13 additions & 13 deletions docs/ubproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ content_required = true

[needs]
extra_options = [
"my_extra_option",
"another_option",
"author",
"comment",
"amount",
"hours",
"image",
"config",
"github",
"value",
"unit",
"my_extra_option",
"another_option",
"author",
"comment",
"amount",
"hours",
"image",
"config",
"github",
"value",
"unit",
]
variant_options = ["status"]
show_link_type = false
Expand Down Expand Up @@ -310,7 +310,7 @@ grid = "simple"

[needs.layouts.permalink_example.layout]
head = [
"<<meta(\"type_name\")>>: **<<meta(\"title\")>>** <<meta_id()>> <<permalink()>> <<collapse_button(\"meta\", collapsed=\"icon:arrow-down-circle\", visible=\"icon:arrow-right-circle\", initial=False)>> ",
"<<meta(\"type_name\")>>: **<<meta(\"title\")>>** <<meta_id()>> <<permalink()>> <<collapse_button(\"meta\", collapsed=\"icon:arrow-down-circle\", visible=\"icon:arrow-right-circle\", initial=False)>> ",
]
meta = ["<<meta_all(no_links=True)>>", "<<meta_links_all()>>"]

Expand All @@ -319,7 +319,7 @@ grid = "simple"

[needs.layouts.detail_view.layout]
head = [
"<<meta(\"type_name\")>>: **<<meta(\"title\")>>** <<meta_id()>> <<permalink()>> <<collapse_button(\"meta\", collapsed=\"icon:arrow-down-circle\", visible=\"icon:arrow-right-circle\", initial=False)>> <<sidebar(\"\")>>",
"<<meta(\"type_name\")>>: **<<meta(\"title\")>>** <<meta_id()>> <<permalink()>> <<collapse_button(\"meta\", collapsed=\"icon:arrow-down-circle\", visible=\"icon:arrow-right-circle\", initial=False)>> <<sidebar(\"\")>>",
]
meta = ["<<meta_all(no_links=True)>>", "<<meta_links_all()>>"]

Expand Down
Loading

0 comments on commit 4095f05

Please sign in to comment.