Skip to main content

Implementation of fy tool functionality - parsing and generating.

Project description

Fy Library

Fy Library is the core functional part of the fy tool. It contains code for discovering and parsing fy code, then generating resulting Python code.

Setting up local development

We develop the fy tool using the very same fy tool. But we cannot use the same copy that we use for development to transform edited fy files because files break during development.

For that purpose of avoiding breaking the very same tool that we use for development, we clone another repo that we use as a source code for running the fy cli tool.

1. Clone the repo once more to serve as a local fy cli tool

Clone the same fy repo once more in the local-fy-cli folder adjacent to this project folder. FYI, the second parameter in git clone is the directory to clone the repo in like:

git clone git@github.com:execution-flows/fy.git local-fy-cli

After cloning the repo your directory structure should be like:

├── fy
│   ├── cli
│   ├── documentation_site
│   ├── library
│   ├── local.fy.sh
├── local-fy-cli
│   ├── cli
│   ├── documentation_site
│   ├── library
│   ├── local.fy.sh

2. Set up poetry in the local-fy-cli/cli directory

cd local-fy-cli/cli
poetry env use 3.10
poetry install

3. Run the local.fy.sh to execute the tool

In the project root folder

./local.fy.sh

NOTE: local.fy.sh is configured with /library/src as a project root folder, so only files in that folder can be processed with it.

4. [Optional] Set up external tool in PyCharm

  1. PyCharm -> Settings -> Tools -> External Tools

  2. '+' (or Add) to create a new tool

  3. Fill in:

    • Name: local fy
    • Program: <path to local.fy.sh>
    • Arguments: $FileDir$
    • Working directory: <path to /library/src>

Now you can run the tool by selecting Tools -> External Tools -> local fy, or option-click on a file or folder and choose External Tools -> local fy.

To speed things up you can assign a keyboard shortcut to it in PyCharm -> Settings -> Keymap -> External Tools -> External Tools -> local fy. Then click on pencil at the top, and select Add Keyboard Shortcut.

Important: keep local-fy-cli up to date.

Regularly, as often as you do with the primary development fy repo, run git pull origin main in the local-fy-cli repo.

Testing

The main principle of fy tool development is Test-Driven-Development. The level of tests we use for development is the integration level.

The integration test in this project means writing the fy code, and comparing the generated Python code with the expected Python code.

To run the tests from poetry shell use the following command:

poetry run python -m unittest

Set-up code formatting, linting, and type checks

Use the poetry shell from the root project.

poetry env use 3.10
poetry install

We use pre-commit to run a bunch of checks before committing to git, if you want to run these checks at any time, on all files you can use

poetry run pre-commit run -a

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fy_library-0.5.13.tar.gz (45.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fy_library-0.5.13-py3-none-any.whl (197.7 kB view details)

Uploaded Python 3

File details

Details for the file fy_library-0.5.13.tar.gz.

File metadata

  • Download URL: fy_library-0.5.13.tar.gz
  • Upload date:
  • Size: 45.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for fy_library-0.5.13.tar.gz
Algorithm Hash digest
SHA256 1e22f23af73743dd71419d9e461219d14b844d070950a89859b5b161b44c920b
MD5 f8d2fad81cf30671386eddc9d6566c5b
BLAKE2b-256 b1e4f70eff9e2ab39c03fbca4630e8982b970332dde9f99e7b5a281373743525

See more details on using hashes here.

File details

Details for the file fy_library-0.5.13-py3-none-any.whl.

File metadata

  • Download URL: fy_library-0.5.13-py3-none-any.whl
  • Upload date:
  • Size: 197.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.3 Linux/6.8.0-1017-azure

File hashes

Hashes for fy_library-0.5.13-py3-none-any.whl
Algorithm Hash digest
SHA256 af64b334cdb7aae0578fb09286344305b70d3817fc99e1167fba1177d8e89e5b
MD5 599f3d24e9010dc4ebb21419c035b2ec
BLAKE2b-256 6e86b192aaf4034e3d95a55a384197df8d3c7bf2f8e4c8840d98eb91d4eee7a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page