Skip to main content

Standalone Variables Static Typing

Project description

svst

Python Version Stable Version Downloads Documentation Status Checked with mypy Code style: black Linting: ruff Uses: ast

Standalone Variables Static Typing

Why?

Python is an amazing programming language; my main one for a lot of reasons. With the broad functionality, ease of use, development speed, and friendly community; I could be here all day saying good things about it.

At first, one of the major selling points the dynamic typing.

When you start scaling Python and using it on relatively complex codebases dealing with a lot of different entities and flows you can make a mistake and find the pitfall of not knowing why your variable is not behaving as you wish it was; between imense other issues. A perfect example of this is when you try to statically type an existing codebase with mypy you'll find how bad your code is in terms of type consistency; at least that happened to me).

After fixing a huge mess I wanted to go a step further and not only enforce the typing of functions/classes input and output but to type my standalone variables as well until I found that mypy doesn't check that because his goal is to find the balance between dynamic and static typing; I wanted to go full-on static.

At first, I created a simple file to do this, but soon I found that I needed a proper implementation of this to spread to all my projects and possibly help the community.

I'd like to extend immense gratitude to @alphasensei for pioneering the research and developing the initial proof of concept for this library.

This is an attempt of bringing full-on static typing to Python and, with it, much more robust codebases.

For the core functionality svst uses Abstract Syntax Trees.

Quick start

Svst can be installed using pip:

python3 -m pip install -U svst

You can type-check the standalone variables of a program like this:

svst DIRECTORY_OR_FILE

You can type-check a program including the mypy functionality like this as well:

svst --mypy DIRECTORY_OR_FILE

You can run a simple check hiding the errors:

svst --mypy --check DIRECTORY_OR_FILE

Intended Integrations [WiP]

  • Vim
  • PyCharm
  • VS Code
  • pre-commit

Documentation [WiP]

svst.readthedocs.org

Contributing

As you can see this project is still in pretty rough shape and a lot of improvement can be done.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Mozilla Public License Version 2.0. See LICENSE for more information.

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

svst-0.1.15.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

svst-0.1.15-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file svst-0.1.15.tar.gz.

File metadata

  • Download URL: svst-0.1.15.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for svst-0.1.15.tar.gz
Algorithm Hash digest
SHA256 a0a9f88ac5b653baed401ea483459dc21b38bf2830a4c93916532f7d20b11d0e
MD5 a68bdbd36f8fdeb9edf47ec4909f40d7
BLAKE2b-256 3c0c7a1f7a603a9ae06f164951833e4602335736f5454113241f9dc8415c0544

See more details on using hashes here.

File details

Details for the file svst-0.1.15-py3-none-any.whl.

File metadata

  • Download URL: svst-0.1.15-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for svst-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 abec43a6279f56f90281d65e25c6745ba2c964c3261e0406d8a978cb933405f5
MD5 c33a8a7bb369c28e0b85dcae33ac1c9a
BLAKE2b-256 f0081247e9632b7a75211338dcea2b40c6b67bf5836f16570bd0c8907b89d74e

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