IDE Setup
Setting up your IDE for PyneCore scripts
IDE Setup for PyneCore
This guide helps you set up your Integrated Development Environment (IDE) for the most effective experience when working with PyneCore in your own projects.
Recommended IDEs
PyCharm (Recommended)
PyCharm is the recommended IDE for PyneCore scripts due to its heuristic type checker which better accommodates PyneCore’s dynamic behavior and AST transformations. PyCharm will generally work better “out of the box” when writing and running PyneCore scripts.
Benefits for PyneCore users:
- Heuristic type checking that understands dynamic Python behaviors
- Better handling of AST transformations that PyneCore uses internally
- More accurate code completion for Series operations and PyneCore functions
- Perfect handling of Series types - understands that they can be both indexed and used directly as values
- No false positives for PyneCore’s dynamic features
Setup Instructions
- Open your project in PyCharm
- Ensure PyneCore is installed in your project’s environment
- No additional configuration is needed
Visual Studio Code with Pylance
Visual Studio Code (or any fork of it like Cursor) with Pylance will work with PyneCore scripts, but you’ll likely encounter many false positive errors due to VS Code’s static type checking approach which cannot fully understand PyneCore’s dynamic code transformation. You will need additional configuration to suppress these irrelevant errors.
Setup Instructions
- Install the Python extension in VS Code
- Ensure Pylance is enabled as your language server
- Create a
pyrightconfig.jsonfile in your project root (see below)
Required Type Checking Configuration for VS Code
When using PyneCore in your own projects with VS Code, you will need to add a special configuration to prevent overwhelming false error messages. This is not a bug in your code or in PyneCore - it’s a fundamental limitation of static type checking with Python’s dynamic features.
The Series Type Challenge
The main challenge is that the Series type in PyneCore needs to function in two ways simultaneously:
- As a container that can be indexed (e.g.,
price[1]to get the previous bar’s value) - As a direct value that can be used in calculations (e.g.,
(high + low) / 2)
Python typing has no intersection type, so this dual nature cannot be expressed directly. Type checkers see Series[float] as plain float (Series is a transparent alias), which makes the scalar side fully type-correct. The indexing side is handled differently per type checker:
- PyCharm: Gets
[n]indexing from indexablefloat/int/boolstand-ins in PyneCore’s stubs - Pylance / Pyright: Needs
reportIndexIssueswitched off, which is part of the configuration below
PyneCore ships one set of stubs whose Series-indexing support is switched by a TYPECHECKER constant, so you’ll still need additional configuration for VS Code.
Creating the PyRight Configuration File
Create a file named pyrightconfig.json in the root directory of your project with the following content:
{
"reportIndexIssue": "none",
"typeCheckingMode": "basic",
"reportAssignmentType": "none",
"reportRedeclaration": "none",
"reportArgumentType": "none",
"defineConstant": {
"TYPECHECKER": "pyright"
}
}Why You Need This Configuration
Without this configuration, VS Code will show many red squiggly lines and error messages in PyneCore scripts, even though your code is perfectly valid and will run correctly. These errors are triggered by several aspects of PyneCore:
- The Series type’s dual nature (container and direct value) confuses static type checking
- AST transformations modify your code at import time in ways static analyzers can’t predict
- PyneCore’s dynamic property creation and operations aren’t visible to static analysis
Each setting in the configuration addresses a specific issue:
reportIndexIssue: Disables errors when using Series as an indexable object (e.g.,close[1])typeCheckingMode: Relaxes type checking to accommodate PyneCore’s dynamic behaviorreportAssignmentType: Avoids errors when a Series is treated as both a value and a containerreportRedeclaration: Prevents errors from AST transformations that modify variable declarationsreportArgumentType: Prevents errors with functions that accept Series argumentsdefineConstant: Sets theTYPECHECKERconstant that selects the pyright variant of PyneCore’s stubs
Type Stubs
PyneCore ships one set of type hint stubs. Series[T] is a transparent alias of T, and a TYPECHECKER constant selects how history indexing is typed:
- PyCharm:
float,intandboolare replaced by indexable stand-ins, sox[1]type-checks - Pyright / Pylance: The builtins stay unchanged, and
reportIndexIssueis switched off inpyrightconfig.json
The IDE is not detected automatically: for Pylance, TYPECHECKER is set by the defineConstant entry above. The fundamental limitations of static type checking still apply to Pylance.
Recommended IDE Extensions
PyCharm
- No additional extensions required for PyneCore functionality
- PyCharm Professional offers even better type inference capabilities
VS Code
- Python extension (includes Pylance)
- Even with the configuration, expect to see some false positive errors
Conclusion
Key takeaways for PyneCore users:
PyCharm provides a perfect experience with PyneCore’s Series types and dynamic features due to its heuristic type checker
If using VS Code, you should add the
pyrightconfig.jsonfile to your project to reduce false error messages
Choose the IDE that best fits your workflow, but be aware of the limitations and necessary configurations when working with PyneCore’s dynamic features.