Skip to main content

Small helper library for creating named scopes/inline modules

Project description

nya-scope (import name: nya_scope)

Small helper library for creating named scopes/inline modules Classes marked explicitly as scopes prevent intialization with a runtime error

Style Guide (optional)

You are free to adopt it in full, part, or not for your for your project, this is just what I found the most convenient for my projects for visual clarity & separation from other (regular) classes.

  1. Append __ after every name of classes that inherit from Scope:
    class ExampleScope__(Scope):
    	example_field = 42
    
  2. Manually mark all methods as either @staticmethod (and always provide full absolute path) or @classmethod
    class Outer__(Scope):
    	class Inner__(Scope):
    		value = 42
    
    		@classmethod
    		def class_method(here):  # noqa: N804 <-- if using ruff
    			# name your `cls`, `here` instead, it makes sense in this context
    			_ = here.value
    
    		@staticmethod
    		def static_method():
    			_ = Outer__.Inner__.value  # Inner__.value does not work
    

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

nya_scope-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

nya_scope-0.1.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file nya_scope-0.1.1.tar.gz.

File metadata

  • Download URL: nya_scope-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nya_scope-0.1.1.tar.gz
Algorithm Hash digest
SHA256 121afda50f2a79d36714a3ae9b7e2a3343116884d1db2b5185d62324903c7434
MD5 0669038f8e016bbe7fea7c7c743b3ead
BLAKE2b-256 6592019283aea9be3d75f7841c8721bf4cfa57b61e4928b67407a7b79b4a52fd

See more details on using hashes here.

File details

Details for the file nya_scope-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nya_scope-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nya_scope-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5875dcf1f81682a01d6cb37609f0c8396b3c993de6d77d0d64765a985eeabdf
MD5 7b5d8aac3dc984f15ccdf027b690dc5b
BLAKE2b-256 93bdb33258fa541060fd0647fc3fc68cfc643c2a5cf2d717e1e84aace7e2c20b

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