Skip to content

Commit

Permalink
docs: add note on pragma parsing (vyperlang#3640)
Browse files Browse the repository at this point in the history
* Fix broken link in `structure-of-a-contract.rst`
* Add note on `pragma` version parsing
  • Loading branch information
pcaversaccio authored Oct 5, 2023
1 parent 5ca0cbf commit 435754d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/structure-of-a-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ Vyper supports several source code directives to control compiler modes and help
Version Pragma
--------------

The version pragma ensures that a contract is only compiled by the intended compiler version, or range of versions. Version strings use `NPM <https://docs.npmjs.com/about-semantic-versioning>`_ style syntax. Starting from v0.4.0 and up, version strings will use `PEP440 version specifiers <https://peps.python.org/pep-0440/#version-specifiers>_`.
The version pragma ensures that a contract is only compiled by the intended compiler version, or range of versions. Version strings use `NPM <https://docs.npmjs.com/about-semantic-versioning>`_ style syntax. Starting from v0.4.0 and up, version strings will use `PEP440 version specifiers <https://peps.python.org/pep-0440/#version-specifiers>`_.

As of 0.3.10, the recommended way to specify the version pragma is as follows:

.. code-block:: python
#pragma version ^0.3.0
.. note::

Both pragma directive versions ``#pragma`` and ``# pragma`` are supported.

The following declaration is equivalent, and, prior to 0.3.10, was the only supported method to specify the compiler version:

.. code-block:: python
Expand Down

0 comments on commit 435754d

Please sign in to comment.