-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Python packaging infrastructure. #89
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[build-system] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["setuptools>=61.0", "build", "wheel"] | ||
|
||
[project] | ||
name = "spec_parser" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"Jinja2", | ||
"jsonpickle", | ||
"rdflib" | ||
] | ||
|
||
[project.scripts] | ||
spec-parser = "spec_parser.main:main" | ||
|
||
[tool.setuptools.package-data] | ||
"spec_parser.templates.mkdocs" = ["*.j2"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a way to have everything under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can change it to look for everything under |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from setuptools import setup | ||
setup() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,16 @@ | |
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from spec_parser import Model | ||
from runparams import RunParams | ||
from spec_parser.runparams import RunParams | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why move it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to avoid namespace collisions when installing the parser in a Python environment. If we're concerned about clarity surrounding purpose, we could move |
||
|
||
if __name__ == "__main__": | ||
|
||
def main(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why create a function? Is it something setuptools require? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes; this is how you get a |
||
cfg = RunParams() | ||
|
||
m = Model(cfg.input_dir) | ||
if not cfg.opt_nooutput: | ||
m.gen_all(cfg.output_dir, cfg) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these dependencies are only for generating output; they are not needed when simply checking the input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there value in leaving them out?
If you're wanting to avoid even hassling with installation when you just want to check, you can still run the main.py file; it's just done differently now. I can add docs to the README to mention that if we want.