profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/pawamoy/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Timothée Mazzucotelli pawamoy @sfeir France http://pawamoy.github.io/ I think I just like to create.

mkdocstrings/mkdocstrings 406

:blue_book: Automatic documentation from sources, for MkDocs.

pawamoy/aria2p 226

Command-line tool and library to interact with an aria2c daemon process with JSON-RPC.

pawamoy/copier-poetry 32

Copier template for Python projects managed by Poetry.

mkdocstrings/pytkdocs 30

Load Python objects documentation.

pawamoy/cookiecutter-awesome 23

Cookiecutter to create an awesome list.

pawamoy/dependenpy 18

Show the inter-dependencies between modules of Python packages.

pawamoy/awesome-repository 15

A curated list of services, tools and standards about (open source) repository management.

pawamoy/django-appsettings 11

Application settings helper for Django apps.

pawamoy/django-archan 9

A Django app that displays dependency matrices and other project architecture information

pawamoy/archan 8

Analysis of your architecture strength based on DSM data.

issue commentpawamoy/pawamoy.github.io

posts/unify-logging-for-a-gunicorn-uvicorn-app/

Not sure, you'd have to check how gunicorn is logging, and if there's a way for you to add the request handling time into your log format.

utterances-bot

comment created time in 11 hours

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

The Better Jinja VSCode extension by Samuel Colvin does wonders 😉

But I agree with you. I did that mistake several times (templating a file and forgetting to add the extension). And I like being able to simply tell Copier to try and render everything. I actually opened the ticket about empty extension suffix and sent the PR to make it possible 😄 The best of both world would be to have automatic detection of templating (and thus Jinja syntax highlighting) without an additional file extension.

About performance: using an extension suffix makes Copier even faster as only templated files pass through the Jinja engine 🙂

Anyway. I'll stop here and see what @Yajo decides.

karolzlot

comment created time in 15 hours

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

@karolzlot

it is faster to exclude files this way than to check each file and catch Exception

You might have misunderstood @Yajo's suggestion (or I misunderstood it myself!): this would be implemented in Copier itself, the template writers/users would not have to catch any exceptions themselves. It would automatically copy images and other binary files without trying to render them (well, trying, failing, and falling back to a simple copy).

I don't want to have different extensions before and after parsing because it makes correct syntax highlighing more difficult.

Could you expand on this? In my opinion, having a README.md.jinja in the template makes it very clear to the IDE that you want a Jinja+Markdown syntax highlighting, not just a Markdown one.

karolzlot

comment created time in 16 hours

pull request commentmkdocstrings/mkdocstrings

Optionally show base classes

@bkoropoff sorry for the delay, I'll get to this tomorrow.

bkoropoff

comment created time in a day

issue commentpexpect/ptyprocess

Use stdin in child process

Well of course it does not work on Windows. I'll stick to ptyprocess and turn echo off in the child process :slightly_smiling_face:

pawamoy

comment created time in a day

issue commentmkdocstrings/mkdocstrings

Add ability to link to source code on GitHub

Well summarized by @oprypin:

the links would probably need to know about Git commit hashes and such, but mkdocstrings so far has not entered the territory of understanding SCM systems

Not sure we want to enter such a territory. However I believe this could be achieved with a combo of extra plugins and template overriding. mkdocstrings-sourcelink seems to be a candidate!

dhirschfeld

comment created time in a day

issue commentpawamoy/pawamoy.github.io

posts/django-auth-server-for-shiny/

Hello, unfortunately I won't be able to help you as I don't use Windows. Since your issue seems more related to NginX than to the actual content of the post, I suggest you ask for help on StackOverflow or any other forum where people know about NginX + Windows :slightly_smiling_face: Good luck!

utterances-bot

comment created time in a day

issue commentpawamoy/pawamoy.github.io

posts/unify-logging-for-a-gunicorn-uvicorn-app/

You'll have more luck asking on the loguru issue tracker directly! Make sure you have the permissions to write a file in the current working directory.

utterances-bot

comment created time in a day

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

Well indeed @Yajo, it would be even more elegant and robust (in my opinion), nice suggestion.

karolzlot

comment created time in a day

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

That would probably be enough for Copier yes, thanks for the snippet @xsc27! But for edge-cases (there are always edge-cases), an option similar to _copy_without_render would be necessary.

karolzlot

comment created time in 2 days

startedaudreyfeldroy/binaryornot

started time in 3 days

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

Ah, true, my bad! Let see how CookieCutter does that then!

karolzlot

comment created time in 3 days

PR opened collerek/ormar

fix generation of nested Pydantic fields

Fixes #278

+1 -1

0 comment

1 changed file

pr created time in 3 days

push eventpawamoy/ormar

Timothée Mazzucotelli

commit sha 479ca7d61968ae233a7aa7fb29ad50c4dfc83991

fix generation of nested Pydantic fields

view details

push time in 3 days

fork pawamoy/ormar

python async orm with fastapi in mind and pydantic validation

https://collerek.github.io/ormar/

fork in 3 days

issue commentcollerek/ormar

Nested model not included in Pydantic model

Sure, you make it so easy, I cannot refuse 😁

pawamoy

comment created time in 3 days

issue commentcopier-org/copier

bug: _templates_suffix: "" gives UnicodeDecodeError on binary files ( .ico or .png for example )

On that day we entered the dark territory of binary vs. text detection.

https://unix.stackexchange.com/questions/275516/is-there-a-convenient-way-to-classify-files-as-binary-or-text https://stackoverflow.com/questions/567757/how-do-i-distinguish-between-binary-and-text-files

Maybe you should simply exclude those images using _exclude in your copier.yml file.

karolzlot

comment created time in 3 days

issue commentcollerek/ormar

Nested model not included in Pydantic model

Well this diff seems to fix the issue!

                 relation_map=cls._skip_ellipsis(
-                    relation_map, field, default_return=dict()
+                    relation_map, name, default_return=dict()
                 ),
pawamoy

comment created time in 3 days

issue commentcollerek/ormar

Nested model not included in Pydantic model

In fact, cls._skip_ellipsis gets passed the field, which is then used as a key to get the result from the items, which is relation_map. Then cls.get_child actually runs return items.get(key, {}), and since the field cannot be found in the relation map, it returns an empty dict. So the fact that library is an ellipsis is not a problem. It seems the issue is that you pass the field instead of its name to cls._skip_ellipsis? But I just started looking at the code so I'm probably wrong 😅

pawamoy

comment created time in 3 days

issue commentcollerek/ormar

Nested model not included in Pydantic model

It is, yes!

I'm currently debugging: it seems that when generating the model, and reaching/recursing on the package field, the new relation map is computed using relation_map=cls._skip_ellipsis(relation_map, ...), and since library is an ellipsis, the new relation map becomes empty when handling the library field.

Then, _determine_pydantic_field_type fails to return a proper field (it returns None for library) because of if field.is_relation and name in relation_map:.

In the end, library is not included in the final model because of if field is not None:.

pawamoy

comment created time in 3 days

issue openedcollerek/ormar

Nested model not included in Pydantic model

Describe the bug I don't know if it comes from FastAPI, Pydantic or Ormar. When retrieving a Pydantic model from an Ormar model, the response example shown in the Swagger interface does not include a nested model. Same with the actual responses: they do not contain that nested model.

My models:

# meta classes removed for conciseness

class Library(ormar.Model):
    id: int = ormar.Integer(primary_key=True)
    name: str = ormar.String(max_length=100)


class Package(ormar.Model):
    id: int = ormar.Integer(primary_key=True)
    library: Library = ormar.ForeignKey(Library, related_name="packages")  # <-- of interest
    version: str = ormar.String(max_length=100)


class Ticket(ormar.Model):
    id: int = ormar.Integer(primary_key=True)
    number: int = ormar.Integer()
    status: str = ormar.String(max_length=100)


class TicketPackage(ormar.Model):
    id: int = ormar.Integer(primary_key=True)
    status: str = ormar.String(max_length=100)
    ticket: Ticket = ormar.ForeignKey(Ticket, related_name="packages")
    package: Package = ormar.ForeignKey(Package, related_name="tickets")  # <-- of interest

My route:

router = APIRouter(prefix="/tickets")
TicketPackageOut = TicketPackage.get_pydantic(exclude={"ticket"})


@router.get(
    "/{ticket_id}/packages",
    response_model=List[TicketPackageOut],
)
async def get_ticket_packages(ticket_id: int) -> List[TicketPackage]:
    return await TicketPackage.objects.select_related("package__library").filter(ticket__id=ticket_id).all()
    # Note how I "select the related package library".
    # If I print the return value of that query,
    # I can see that the library objects are here
    # with all their values (name) populated, as expected.

Expected behavior

The example and actual responses in Swagger should look like:

[
  {
    "id": 0,
    "status": "string",
    "package": {
      "version": "string",
      "id": 0,
      "library": {
        "id": 0,
        "name": "string"
      }
    }
  }
]

Actual behavior

The responses look like:

[
  {
    "id": 0,
    "status": "string",
    "package": {
      "version": "string",
      "id": 0
    }
  }
]

The package library is missing!

Screenshots

Example response Actual response
image image

You'll notice extra fields that I removed from the code above for conciseness.

Versions:

  • Database backend used: sqlite
  • Python version: 3.8.11
  • ormar version: 0.10.14
  • pydantic version: 1.8.2
  • if applicable fastapi version: 0.65.2

Additional context To add a bit of weirdness, I declare the same TicketPackageOut in another router (module), though excluding different fields, and the package library shows up correctly. I wondered if the order of import/declaration could matter, but didn't dig in the code to get an answer.

created time in 3 days

issue commentcollerek/ormar

update_or_create raising NoMatch()

Bumped into this as well. I was wondering anyway how ormar could know which kwargs to use to get the row and which one to use to update it / create it. Now I know that it always tries to create without an id/pk,

muqshots

comment created time in 4 days

delete branch pawamoy/django-zxcvbn-password

delete branch : pyup-scheduled-update-2021-07-05

delete time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha a4576f0b1b7e18f845da6cfa42cee3fae9be0aa5

Update django from 3.1.7 to 3.2.5

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha a628875db5603da8dad6147e59b6c007e38db105

Update sphinx-rtd-theme from 0.5.1 to 0.5.2

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha 3a314c99bd7a5343f8a8f403b0d72b2c7b494392

Update sphinx from 3.5.3 to 4.1.1

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha 9d9de7593dc930eb7ed7efa219697dce188210bf

Update pytest-django from 4.1.0 to 4.4.0

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha da0cd6267de0f8ed280efbd98dea6b7795dc5505

Update pytest-cov from 2.11.1 to 2.12.1

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha 74cb6b26d3dda5ebac18456d6b7b792e8bc6a14c

Update pytest from 6.2.3 to 6.2.4

view details

push time in 4 days

push eventpawamoy/django-zxcvbn-password

pyup-bot

commit sha 8680240816b9da839597160f59976d3be22e9ffc

Update tox from 3.23.0 to 3.24.0

view details

push time in 4 days