Git Product home page Git Product logo

abstracting-fastapi-services's People

Contributors

visini avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

abstracting-fastapi-services's Issues

Why a single app_exceptions.py?

I assume it's nicer to have the ./exceptions/ directory and put each service exception module containing relevant error data.

And if you were to add a new service called Bar:

./routers/      bar.py # Router instance and routes
./services/     bar.py # Business logic (including CRUD helpers)
./schemas/      bar.py # Data "schemas" (e.g., Pydantic models)
./models/       bar.py # Database models (e.g., SQLAlchemy models)
./exceptions/   bar.py # Exceptoins classes completely decoupled

license

it would be good if there was a licence with this code. I can see one of the forks has gone and added in their own licence and claimed copyright

`make dev` throws `[FileNotFoundError] [Errno 2] No such file or directory`

Edit: The following command...

poetry -vvv run uvicorn main:app --reload

throws:

[NoSuchOptionException]
The "--reload" option does not exist.

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/clikit/console_application.py", line 123, in run
    io = io_factory(
  File "/usr/lib/python3.9/site-packages/poetry/console/config/application_config.py", line 168, in create_io
    resolved_command = application.resolve_command(args)
  File "/usr/lib/python3.9/site-packages/clikit/console_application.py", line 110, in resolve_command
    return self._config.command_resolver.resolve(args, self)
  File "/usr/lib/python3.9/site-packages/clikit/resolver/default_resolver.py", line 43, in resolve
    result = self.process_default_commands(args, application.default_commands)
  File "/usr/lib/python3.9/site-packages/clikit/resolver/default_resolver.py", line 104, in process_default_commands
    if resolved_command.is_parsable():
  File "/usr/lib/python3.9/site-packages/clikit/resolver/resolve_result.py", line 43, in is_parsable
    self._parse()
  File "/usr/lib/python3.9/site-packages/clikit/resolver/resolve_result.py", line 49, in _parse
    self._parsed_args = self._command.parse(self._raw_args)
  File "/usr/lib/python3.9/site-packages/clikit/api/command/command.py", line 113, in parse
    return self._config.args_parser.parse(args, self._args_format, lenient)
  File "/usr/lib/python3.9/site-packages/clikit/args/default_args_parser.py", line 53, in parse
    self._parse(args, _fmt, lenient)
  File "/usr/lib/python3.9/site-packages/clikit/args/default_args_parser.py", line 101, in _parse
    self._parse_long_option(token, tokens, fmt, lenient)
  File "/usr/lib/python3.9/site-packages/clikit/args/default_args_parser.py", line 247, in _parse_long_option
    self._add_long_option(name, None, tokens, fmt, lenient)
  File "/usr/lib/python3.9/site-packages/clikit/args/default_args_parser.py", line 300, in _add_long_option
    raise NoSuchOptionException(name)

And regarding the environment... poetry env info throws:

Virtualenv
Python:         3.9.1
Implementation: CPython
Path:           ~/.cache/pypoetry/virtualenvs/fastapi-service-2hjJIUGa-py3.9
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr

Purpose of ServiceResult

When looking through the proposed design in the article, I was a little confused about the purpose of the ServiceResult class. My We already have Response and HTTPException from FastAPI/Starlette which seem to fulfill the same purpose. What benefit does having a dedicated ServiceResult provide? (for instance, what is a case where we would want to use __enter__ and __exit__ in a result rather than performing the behavior directly?)

Example Project ?

@visini ,

Loved the article accompanying this repository, Do you have a sample project either that you compiled or have referred to that follows this approach. I am trying to follow this approach but would greatly benefit from prototyping with an example to relate to it. Could you kindly share anything if available ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.