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
-
PyCharm -> Settings -> Tools -> External Tools
-
'+' (or Add) to create a new tool
-
Fill in:
- Name:
local fy
- Program: <path to local.fy.sh>
- Arguments:
$FileDir$
- Working directory: <path to /library/src>
- Name:
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
Built Distribution
File details
Details for the file fy_library-0.3.5.tar.gz
.
File metadata
- Download URL: fy_library-0.3.5.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f707b8886d95e09b0738ffc2bf238d40fe5b1cf8152827cd6d371032c2c602b4 |
|
MD5 | 9338dbafdc76ae5214a89ff6fbb2af92 |
|
BLAKE2b-256 | 39b6c18eddfa2b0ec0ee5a1ed118b841bc686cbc0bdc91bc50abf8d7b172959d |
File details
Details for the file fy_library-0.3.5-py3-none-any.whl
.
File metadata
- Download URL: fy_library-0.3.5-py3-none-any.whl
- Upload date:
- Size: 153.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c2b2566e311ae07681da63c7ae9c079a71fc04c4556a5a60bfca10458b7b321 |
|
MD5 | 8ecb9e531944aaf7a6410e650f0fd7fd |
|
BLAKE2b-256 | 445158e4b8278cc018d308fa37b036cbdddcd523840d64e8e207f2f5ce14047d |