google / google/gin-config

Import module with alias

Open
#13 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
2.2k
Forks
122
Avg merge
5d 10h
Merged PRs (30d)
2

Description

A project I am working on has many modules and significant module depth. I would like to configure parameters in a number of functions and classes throughout the project using a gin file located in the root directory.

For a function `foo` located in module `a.b.c.d` I would like to set a number of function arguments. For module names longer than single letters, it seems a bit overwhelming to write the whole module path for each argument. Instead, I would like to import the module using an alias.

```
# Found in gin file
import a.b.c.d as m
m.foo.x = 4
m.foo.y = 2
```
Doing so gives me this error

```
^
SyntaxError: Expected newline.
```

I assume that this failure is because the parser does not currently support module aliases.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.